smart-data-lake / smart-data-lake/getting-started
Declare the foreign keys between the data objects
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 0
- Forks
- 2
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 1
Description
Why
The SDLB UI draws an Entity Relation Diagram from table.foreignKeys — data objects as nodes, declared foreign keys as edges, with the relation drawn onto the columns themselves once a node is opened. Nothing in this project declares a foreign key, so that view is empty on the deployed demo (https://smart-data-lake.github.io/getting-started/), and the UI repository has to patch keys into its own test fixtures to have anything to show.
The getting-started pipeline does have relations to declare, so the demo could show the real thing.
What
Add table.foreignKeys to the *.part-3-solution configs — the ones prepare.sh final seeds and the ones the deployed viz is built from.
Only valid keys: every key must name a data object of this configuration and columns that exist on both sides. SDLB rejects an unknown dataObjectId with a ConfigurationException, and a key pointing at a table that is not part of the pipeline says nothing about this data model.
Everything here references int-airports, whose primaryKey = [ident] is already declared.
config/departures.conf.part-3-solution — int-departures
table = {
catalog = ${env.catalog}
db = ${env.database}
name = int_departures
primaryKey = [icao24, estdepartureairport, dt]
foreignKeys = [
{ name = "fk_departure_airport", dataObjectId = "int-airports", columns = { estdepartureairport = "ident" } }
{ name = "fk_arrival_airport", dataObjectId = "int-airports", columns = { estarrivalairport = "ident" } }
]
}
config/btl.conf.part-3-solution — btl-departures-arrivals-airports and btl-distances
Both carry estdepartureairport and estarrivalairport, joined against int_airports.ident by join-departures-airports:
foreignKeys = [
{ name = "fk_departure_airport", dataObjectId = "int-airports", columns = { estdepartureairport = "ident" } }
{ name = "fk_arrival_airport", dataObjectId = "int-airports", columns = { estarrivalairport = "ident" } }
]
Not these
ext-airports, ext-departures, stg-airports and stg-departures-mock are webservice and file data objects with no table, so they cannot carry a foreign key.
Syntax
A foreign key names the data object it references, not a db and table: dataObjectId, since smart-data-lake/smart-data-lake#1148 (merged to develop-spark4). The older db/table form is gone, and the UI ignores a key still written that way, so these blocks need an SDLB build from develop-spark4 or later.
If this is wanted for the earlier part-*-solution variants too, the same two keys apply wherever int-departures and the btl-* data objects already exist.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with config/departures.conf.part-3-solution and config/btl.conf.part-3-solution, then inspect prepare.sh final to confirm which solution files seed the deployed demo. Add the specified foreign keys only to the table data objects named in the issue, and verify that each referenced object and column exists so the pipeline and its ER diagram expose the expected relationships.
Written by the indexing model from the issue text.
Assessment
- Domain
- data-engineering
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100