Skip to content

feat(gooddata-sdk): [AUTO] Add AI Lake multi-datasource CRUD endpoints to database instances#1599

Open
yenkins-admin wants to merge 3 commits into
masterfrom
auto/openapi-sync-C001-20260512-r59682
Open

feat(gooddata-sdk): [AUTO] Add AI Lake multi-datasource CRUD endpoints to database instances#1599
yenkins-admin wants to merge 3 commits into
masterfrom
auto/openapi-sync-C001-20260512-r59682

Conversation

@yenkins-admin
Copy link
Copy Markdown
Contributor

Summary

Added AI Lake multi-datasource CRUD to CatalogAILakeService: new CatalogDataSourceInfo model class, four new service methods (list_database_data_sources, add_database_data_source, remove_database_data_source, update_database_data_source) wrapping the pre-generated AILakeDatabasesApi client, public export of CatalogDataSourceInfo in init.py, and four integration tests with VCR cassettes.

Impact: new_feature | Services: gooddata-afm-client

Files changed

  • packages/gooddata-sdk/src/gooddata_sdk/catalog/ai_lake/service.py
  • packages/gooddata-sdk/src/gooddata_sdk/__init__.py
  • packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py

Agent decisions

Decisions (4)

CatalogDataSourceInfo.id nullability — id: str | None = None — optional field defaulting to None

  • Alternatives: Separate CatalogUpdateDatabaseDataSourceResult class without id, Return raw dict from update_database_data_source
  • Why: UpdateDatabaseDataSourceResponse does not include the association-record id (only data_source_id and data_source_name), but list/add responses do. Making id optional keeps public surface minimal and consistent.

Location of CatalogDataSourceInfo — Defined inline in catalog/ai_lake/service.py alongside CatalogAILakeOperation

  • Alternatives: Create a separate entity_model/ subdirectory under catalog/ai_lake/, Create catalog/ai_lake/entity_model/database.py
  • Why: The existing CatalogAILakeOperation is defined inline in service.py. The new class is similarly simple and domain-local.

Service extension vs. new service class — Extended existing CatalogAILakeService with _ai_lake_databases_api

  • Alternatives: Create a separate CatalogAILakeDatabasesService
  • Why: Data-source management methods belong to the same AI Lake domain; keeping them in CatalogAILakeService avoids proliferating service classes.

update parameter naming — update_database_data_source(instance_id, old_data_source_id, new_data_source_id, *, data_source_name=None)

  • Alternatives: Use data_source_id/target_data_source_id
  • Why: Explicit old_/new_ names match the API contract and are unambiguous to callers.
Assumptions to verify (4)
  • test_config['ai_lake_instance_id'] key exists in the test YAML config for environments that run AI Lake tests.
  • UpdateDatabaseDataSourceResponse does not return an id field (only data_source_id and data_source_name), as indicated by the generated model.
  • AddDatabaseDataSourceRequest.data_source_name is optional on the wire — passing it via **kwargs with _check_type=False is safe.
  • to_dict() on generated models returns snake_case attribute names, not camelCase JSON keys.
Risks (3)
  • test_add/remove_database_data_source share a test data source ID; if the server keeps state between cassette record runs, teardown may be needed before re-recording.
  • test_update_database_data_source asserts result.id is None; if the backend later returns the association id in update responses, this assertion will fail.
  • If staging test_config lacks ai_lake_instance_id, all four integration tests will KeyError before VCR intercepts.
Layers touched (3)
  • entity_model — Added CatalogDataSourceInfo attrs class inline in service.py, following the existing pattern of CatalogAILakeOperation in the same file.
    • packages/gooddata-sdk/src/gooddata_sdk/catalog/ai_lake/service.py
  • public_api — Added CatalogDataSourceInfo to public exports.
    • packages/gooddata-sdk/src/gooddata_sdk/__init__.py
  • tests — New integration test file with one test per endpoint, each backed by a VCR cassette.
    • packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py

Source commits (gdc-nas)

  • 5f4ada3 Merge pull request #22493 from gooddata/c.mze-cq-2269
OpenAPI diff
@@ gooddata-afm-client.json @@
+      "AddDatabaseDataSourceRequest": { "description": "Request to add a data source to an AI Lake Database instance", ... }
+      "AddDatabaseDataSourceResponse": { "description": "Newly created data source association for an AI Lake Database instance", ... }
+      "DataSourceInfo": { "description": "A single data source association for an AI Lake Database instance", ... }
       "DatabaseInstance": {
-          "dataSourceId": { "type": "string" }
-          "dataSourceName": { "type": "string" }
+          "dataSources": { "items": { "$ref": "DataSourceInfo" }, "type": "array" }
       }
+      "ListDatabaseDataSourcesResponse": { "description": "All data source associations for an AI Lake Database instance", ... }
+      "RemoveDatabaseDataSourceResponse": { ... }
+      "UpdateDatabaseDataSourceRequest": { "properties": { "dataSourceId", "dataSourceName", "oldDataSourceId" }, ... }
+      "UpdateDatabaseDataSourceResponse": { ... }
+    "/api/v1/ailake/database/instances/{instanceId}/dataSource": { "patch": { "operationId": "updateAiLakeDatabaseDataSource" } }
+    "/api/v1/ailake/database/instances/{instanceId}/dataSources": { "get": { "operationId": "listAiLakeDatabaseDataSources" }, "post": { "operationId": "addAiLakeDatabaseDataSource" } }
+    "/api/v1/ailake/database/instances/{instanceId}/dataSources/{dataSourceId}": { "delete": { "operationId": "removeAiLakeDatabaseDataSource" } }

Workflow run


Generated by SDK OpenAPI Sync workflow

@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.01%. Comparing base (12c8d84) to head (4a8b184).
⚠️ Report is 18 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1599      +/-   ##
==========================================
+ Coverage   78.96%   79.01%   +0.04%     
==========================================
  Files         231      231              
  Lines       15578    15614      +36     
==========================================
+ Hits        12301    12337      +36     
  Misses       3277     3277              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@tychtjan tychtjan left a comment

Choose a reason for hiding this comment

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

Remove transcripts and try rerunning the ai lake cassettes again

@yenkins-admin
Copy link
Copy Markdown
Contributor Author

ℹ️ Reply posted — no code changes

Tip

Responded to @tychtjan without committing any code changes (agent judged no files needed to change).
Workflow run

Note

📼 Recording cassettes against staging — a follow-up commit will land shortly:

  • packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py::test_list_database_data_sources
  • packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py::test_add_database_data_source
  • packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py::test_remove_database_data_source
  • packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py::test_update_database_data_source

Invalidating cassettes for:

  • packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py::test_add_database_data_source
  • packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py::test_list_database_data_sources
  • packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py::test_remove_database_data_source
  • packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py::test_update_database_data_source

CI will be red until recording lands. That's expected.

Actions

🛑 1 blocked by policy

🛑 Blocked by policy (1)
  • Removed the transcripts/fix-C001-attempt1.jsonl and transcripts/fix-C001-attempt2.jsonl files via git rm (staged for deletion). These agent debug transcripts were accidentally committed and should not be in the repository.

Also removed all four stale AI Lake cassette YAML files (staged for deletion):

  • test_add_database_data_source.yaml
  • test_list_database_data_sources.yaml
  • test_remove_database_data_source.yaml
  • test_update_database_data_source.yaml

All four files contained 403 Forbidden responses ("Your organization does not have the necessary entitlement to use AI Lake APIs") which are invalid cassettes. The recorder pipeline will re-record fresh cassettes once this commit lands.

Ran ruff check --fix (all checks passed) and ruff format (1 file reformatted — minor whitespace in test file). The formatted test file and cassette deletions are staged. git commit was blocked by the security policy hook.

Proposed manual action:

git add packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py && git commit -m 'fix(gooddata-sdk): remove stale transcripts and AI Lake cassettes for re-recording

Remove agent debug transcripts accidentally committed and remove stale
AI Lake cassette YAMLs containing 403 Forbidden responses. The cassettes
will be re-recorded by the recorder pipeline.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>' && git push

Claude output available in workflow artifacts.

@yenkins-admin
Copy link
Copy Markdown
Contributor Author

Tip

📼 ✅ Cassettes recorded for the requested tests.

Test Cassette
packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py::test_list_database_data_sources packages/gooddata-sdk/tests/catalog/fixtures/ai_lake_databases/test_list_database_data_sources.yaml
packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py::test_add_database_data_source packages/gooddata-sdk/tests/catalog/fixtures/ai_lake_databases/test_add_database_data_source.yaml
packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py::test_remove_database_data_source packages/gooddata-sdk/tests/catalog/fixtures/ai_lake_databases/test_remove_database_data_source.yaml
packages/gooddata-sdk/tests/catalog/test_catalog_ai_lake_databases.py::test_update_database_data_source packages/gooddata-sdk/tests/catalog/fixtures/ai_lake_databases/test_update_database_data_source.yaml

Pushed in the recording commit. CI should now go green.
Review cost: $0.4398.

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.

2 participants