Skip to content

feat(gooddata): support SQL-backed declarative LDM exports#203

Merged
nicosuave merged 2 commits into
mainfrom
update-gooddata-adapter
Jun 15, 2026
Merged

feat(gooddata): support SQL-backed declarative LDM exports#203
nicosuave merged 2 commits into
mainfrom
update-gooddata-adapter

Conversation

@nicosuave

Copy link
Copy Markdown
Member

Current GoodData SQL-backed declarative-LDM exports broke the GoodData adapter (a pydantic ValidationError on the dict-style sql field) and silently dropped join foreign keys defined with the newer reference shape. This updates sidemantic/adapters/gooddata.py to match the shapes gooddata-python-sdk emits today, while keeping every existing flat-format fixture green.

What changed

  • Object sql field — SQL-backed datasets use sql: {dataSourceId, statement} instead of a plain string. Both forms are now handled; the statement becomes Model.sql and the SQL data source id is captured in dataset metadata.
  • sources array references — the newer reference format replaces flat sourceColumns with sources: [{column, target: {id, type}, dataType}]. This array is now parsed for join foreign keys. Flat sourceColumns keeps working.
  • sourceColumnDataType — the renamed field for dataType on attributes and facts is now read (both names honored), so type mapping and aggregation inference work on current exports.
  • Object 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 (sourceFactReference with 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, sources foreign keys, sourceColumnDataType typing, object dataSourceTableId, aggregated facts, and WDF columns, plus an export round-trip. Existing flat-format and legacy fixtures remain unchanged and green.

Known limitations

  • Export is cloud-style: aggregated facts and the object dataSourceTableId/sql forms round-trip, but sources-array references downgrade to flat sourceColumns unless the original sources array is present in metadata.
  • GoodData analytics-model files (MAQL metrics, dashboards) are still out of scope and continue to raise GoodDataParseError.

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread sidemantic/adapters/gooddata.py
Comment thread sidemantic/adapters/gooddata.py
… 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread sidemantic/adapters/gooddata.py
Comment thread sidemantic/adapters/gooddata.py
@nicosuave nicosuave merged commit 92dc91f into main Jun 15, 2026
20 checks passed
@nicosuave nicosuave deleted the update-gooddata-adapter branch June 15, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant