feat(gooddata): support SQL-backed declarative LDM exports#203
Conversation
Handle current GoodData declarative-LDM shapes that previously broke the
adapter:
- sql may be an object {dataSourceId, statement} for SQL-backed datasets
(was raising a pydantic ValidationError); both object and legacy string
forms are now supported, with the SQL data source id captured in metadata.
- References may use a sources array ({column, target, dataType}) that
replaced flat sourceColumns; parse it for join foreign keys while keeping
flat sourceColumns support.
- sourceColumnDataType is read as the newer name for dataType on attributes
and facts (both names honored).
- dataSourceTableId may be an object {dataSourceId, id, type, path}; coerce
its path to a table name and preserve the object form on export.
- Add aggregatedFacts (aggregate awareness: source fact + SUM/MIN/MAX) and
workspaceDataFilterColumns on datasets, both round-tripped on export.
Realizes the gooddata-python-sdk declarative_ldm fixtures as passing parse
cases and keeps existing flat-format fixtures green.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2c9f6c71f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… keys
Re-emit SDK object-form sql ({dataSourceId, statement}) on export instead of
collapsing to a bare string, keeping the data source nested rather than hoisting
it to a top-level dataSourceId. Set the full composite foreign key for multi-column
sources references so the SQL planner joins on every column instead of defaulting
to <target>_id.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2dc7bccb7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Current GoodData SQL-backed declarative-LDM exports broke the GoodData adapter (a pydantic ValidationError on the dict-style
sqlfield) and silently dropped join foreign keys defined with the newer reference shape. This updatessidemantic/adapters/gooddata.pyto match the shapes gooddata-python-sdk emits today, while keeping every existing flat-format fixture green.What changed
sqlfield — SQL-backed datasets usesql: {dataSourceId, statement}instead of a plain string. Both forms are now handled; the statement becomesModel.sqland the SQL data source id is captured in dataset metadata.sourcesarray references — the newer reference format replaces flatsourceColumnswithsources: [{column, target: {id, type}, dataType}]. This array is now parsed for join foreign keys. FlatsourceColumnskeeps working.sourceColumnDataType— the renamed field fordataTypeon attributes and facts is now read (both names honored), so type mapping and aggregation inference work on current exports.dataSourceTableId—{dataSourceId, id, type, path: [...]}is coerced to a table name from its path; the legacy string form still works, and the original object form is preserved on export.aggregatedFacts— aggregate-awareness facts (sourceFactReferencewith a SUM/MIN/MAX operation pointing at a source fact) are imported as metrics with the corresponding aggregation, and round-tripped on export.workspaceDataFilterColumns— stored on dataset metadata and emitted on export.Tests
The two gooddata-python-sdk fixtures (
sdk_declarative_ldm.json,sdk_declarative_ldm_with_sql_dataset.json) move from expected-failure to passing parse cases, with assertions covering object sql,sourcesforeign keys,sourceColumnDataTypetyping, objectdataSourceTableId, aggregated facts, and WDF columns, plus an export round-trip. Existing flat-format and legacy fixtures remain unchanged and green.Known limitations
dataSourceTableId/sqlforms round-trip, butsources-array references downgrade to flatsourceColumnsunless the originalsourcesarray is present in metadata.GoodDataParseError.