atviriduomenys / spinta

Spinta is a framework to describe, extract and publish data (a DEP Framework).
MIT License
13 stars 4 forks source link

Exposed intermediate table #663

Open sirex opened 5 months ago

sirex commented 5 months ago
d | r | b | m | property    | type    | ref
example                     |         |
                            |         |
  |   |   | Language        |         |
  |   |   |   | name@en     | text    |
  |   |   |   | countries[] | backref | Country
                            |         |
  |   |   | Country         |         |
  |   |   |   | name@en     | text    |
  |   |   |   | languages   | array   | CountryLanguage
  |   |   |   | languages[] | ref     | Language
                            |         |
  |   |   | CountryLanguage |         |
  |   |   |   | country     | ref     | Country
  |   |   |   | language    | ref     | Language

By default for many-to-many relations, under the hood a .../:table intermediate table is used for internal backends, to create many-to-many relation.

For external backends, such intermediate tables must be specified explicitly like in example above.

In the example language array CountryLanguage specifies the explicit intermediate table. ref column can also specify which columns should be used to associate two tables.

Following examples below, are identical:

languages array CountryLanguage
languages array CountryLanguage[country, language]

In [ ... ] brackets, we specify properties from CountryLanguage model. Order of columns in [], first always goes column from ref side, and the second from backref side.

Related

JuliusLADP commented 1 month ago

reikalinga geoportalo duomenų pritaikymui