Repository navigation
Fixes #22769: Ingest dbt Cloud artifacts from multiple jobs - #36596
Conversation
|
Local Java test run: FAILED — details
Failed: Tests run locally
Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts. Why these tests
Commandsmvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=ConfigResourceIT,DatabaseSmokeIT,GlossaryTermResourceIT,IngestionPipelineAgentTypeIT,IngestionPipelineLogStreamIT,IngestionPipelineLogStreamingResourceIT,IngestionPipelineOwnerInheritanceIT,IngestionPipelineProgressStreamIT,IngestionPipelineResourceIT,IngestionPipelineSortIT,K8sEnvVarSerializationIT,K8sOMJobOperatorIT,K8sPipelineEnvVarIT,OrphanIngestionPipelineCleanupIT,PipelineStatusAuthorizationIT,RunIngestionPipelineForEntityIT,SeedDataPresenceIT,TableResourceIT,TestConnectionDefinitionResourceIT,UserResourceIT,WorkflowRedeploySignalIT,WorkflowResourceIT,WorkflowSignalDeliveryIT,WorkflowTaskAssigneesIT,WorkflowTriggerPermissionsIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state -Dit.test=WorkflowDefinitionResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false |
Accept comma-separated dbt Cloud job IDs and add an opt-in dbtCloudIngestAllJobs flag that reads the latest completed run of every non-CI job. With no job IDs and the flag off, the single most recent run is read, as before.
Each job's manifest lists every model but only carries compiled SQL for the models that job built, so processing jobs one by one let a partial job blank out a full one. Merge the artifacts of jobs sharing an environment, preferring compiled nodes; skip jobs whose runs call fails for reasons other than auth, and keep the default path's messages.
Skipping every non-auth failure let a 429 or dbt Cloud's nested-status 401 drop a job silently and blank the models only it compiled. Skip only jobs with no completed run, retry 429, and download, merge and yield one environment at a time. Add the decision record.
In merge mode, fetch catalog and run_results with get_raw so only a 404 reads as absent; get also returns None after exhausting retries. Merge each environment's runs newest first. Cover the 429 retry with a test that drives the real REST client.
A job can override its environment's dbt version, and the manifest parser validates every node against the merged manifest's one schema version. Fail naming both jobs instead. Name the job and run when a merge finds no manifest, and warn when the default path gets no catalog.
Unioning nodes let a paused job's old run bring back models removed since, and replace a node's current config with an old one. Keep the newest run's nodes and only fill in compiled fields from older runs. Read a duplicated job ID once and warn once on a missing catalog.
Tested on a real account: an abandoned ad-hoc job whose last run failed at dbt seed has no manifest, and failing the whole scan on it would leave every later environment un-ingested. Leave that environment out, ingest the others, then fail the run naming the skipped environments.
ebf187d to
a54a106
Compare
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
The Python checkstyle failed. Please run You can install the pre-commit hooks with |
✅ Generated Sources Auto-UpdatedThe generated TypeScript types ( |
|
The Python checkstyle failed. Please run You can install the pre-commit hooks with |
A transport failure or a non-JSON body on a merged run's artifact escaped the per-environment guard and ended ingestion of every later environment. Both are now raised as DBTConfigException where the artifact is fetched. The decision record now says only listing jobs or runs fails at once; an artifact denied to the token skips its environment like any other failure. Also fixes CI: lazy %-style logging for the new log lines (G004, baseline pruned) and a dict[str, Any] annotation for the jobs query params.
Code Review ✅ Approved 3 closed / 3 findings🟡 Medium risk · Combining multiple dbt Cloud job artifacts per environment could yield incorrect model SQL, catalog columns, or test results in ingested metadata. Adds multi-job dbt Cloud artifact ingestion: ✅ 3 closed✅ Quality: Committed TS types not regenerated for new dbtCloudConfig schema
✅ Bug: Transport/JSON errors on artifacts abort all environments, not just one
✅ Quality: Artifact 401/403 skips the environment, but the ADR says auth fails at once
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
|
…37987) * dbt Cloud: ingest from multiple jobs or all jobs Accept comma-separated dbt Cloud job IDs and add an opt-in dbtCloudIngestAllJobs flag that reads the latest completed run of every non-CI job. With no job IDs and the flag off, the single most recent run is read, as before. * dbt Cloud: merge job artifacts per environment Each job's manifest lists every model but only carries compiled SQL for the models that job built, so processing jobs one by one let a partial job blank out a full one. Merge the artifacts of jobs sharing an environment, preferring compiled nodes; skip jobs whose runs call fails for reasons other than auth, and keep the default path's messages. * dbt Cloud: skip only jobs without a run; merge one environment at a time Skipping every non-auth failure let a 429 or dbt Cloud's nested-status 401 drop a job silently and blank the models only it compiled. Skip only jobs with no completed run, retry 429, and download, merge and yield one environment at a time. Add the decision record. * dbt Cloud: fail a merge on any failed artifact; newest run wins ties In merge mode, fetch catalog and run_results with get_raw so only a 404 reads as absent; get also returns None after exhausting retries. Merge each environment's runs newest first. Cover the 429 retry with a test that drives the real REST client. * dbt Cloud: refuse to merge manifests of different dbt versions A job can override its environment's dbt version, and the manifest parser validates every node against the merged manifest's one schema version. Fail naming both jobs instead. Name the job and run when a merge finds no manifest, and warn when the default path gets no catalog. * dbt Cloud: newest manifest decides the merged nodes Unioning nodes let a paused job's old run bring back models removed since, and replace a node's current config with an old one. Keep the newest run's nodes and only fill in compiled fields from older runs. Read a duplicated job ID once and warn once on a missing catalog. * dbt Cloud: a broken job skips only its environment Tested on a real account: an abandoned ad-hoc job whose last run failed at dbt seed has no manifest, and failing the whole scan on it would leave every later environment un-ingested. Leave that environment out, ingest the others, then fail the run naming the skipped environments. * docs: rewrap dbt Cloud multi-job decision record * Update generated TypeScript types and dereferenced schemas * dbt Cloud: an unreadable artifact skips only its environment A transport failure or a non-JSON body on a merged run's artifact escaped the per-environment guard and ended ingestion of every later environment. Both are now raised as DBTConfigException where the artifact is fetched. The decision record now says only listing jobs or runs fails at once; an artifact denied to the token skips its environment like any other failure. Also fixes CI: lazy %-style logging for the new log lines (G004, baseline pruned) and a dict[str, Any] annotation for the jobs query params. --------- (cherry picked from commit ab11430) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Himanshu Khairajani <[email protected]>



Describe your changes:
Fixes #22769
The dbt Cloud artifact source (
dbtConfigType: cloud) could only read one run: the given job's latest, or with no job ID, the latest completed run of any job in the account. Projects that split models across jobs could ingest only one of them, and an empty Job ID picked an arbitrary job each run.This PR:
dbtCloudJobIdaccepts comma-separated job IDs (553344,553345). It stays a string, so stored pipelines need no migration.dbtCloudIngestAllJobsflag (defaultfalse). It reads every job of the project, or of the account when no project is set, and skips CI jobs, which build into temporary PR schemas. Job IDs take precedence over it.How multiple jobs are combined. Every job's
manifest.jsonlists the whole project, but dbt only setscompiled_codeon the nodes that run compiled, and only adocs generatejob has a catalog. Feeding the jobs to the source one after another would let a partial job (dbt run -s tag:hourly) overwrite every model's data model written by a full job, with no SQL and no catalog columns. Instead:run_resultsfiles are concatenated, and the source already keeps the newest result per test.get_raw, so that only a 404 reads as "absent".Decision record:
docs/decisions/2026-10-29-dbt-cloud-multi-job-artifacts-merge-per-environment.md.Type of change:
High-level design:
openmetadata-spec/.../dbtconfig/dbtCloudConfig.json):dbtCloudJobIddescription updated, and a new optionaldbtCloudIngestAllJobs: boolean = false. The UI form is rendered from the schema (RJSF). The three generated UI schema copies were regenerated withparse-schema, and no hand-written UI or Java code reads these fields.dbt_config.py, the dbt Cloud handler:/accounts/{id}/jobs/(paginated, CI skipped);_get_dbt_cloud_latest_run+_get_dbt_cloud_run_files, the old path unchanged;_get_dbt_cloud_merged_files: latest run per job, grouped byenvironment_id, sorted newest first, fetched strictly, checked for the same schema version, then_merge_dbt_files._dbt_cloud_get, so the jobs list and the runs list report errors the same way.retry_codes=[429, 503, 504],limit_codes=[]), because an all-jobs scan makes one runs call per job.DbtFilesper job: rejected because a partial job blanks SQL and catalog columns, and the project gets re-processed N times.Database/workflows/dbt.mdtakes precedence over this one, so it needs the same help-text update.Tests:
Use cases covered
/runscall, no/jobs/call. A realDbtCloudConfigbuilt without the flag behaves the same way./jobs/, skips CI jobs and passesproject_id. Job IDs take precedence over the flag.requests.Session.requestandtime.sleeppatched.Unit tests
ingestion/tests/unit/test_dbt_config_errors.py. 46 passed, with 28 new cases inTestDbtCloudMultipleJobsandTestDbtCloudRateLimit, plus updates toTestDbtCloudErrorClassification.python -m pytest tests/unit/test_dbt.py -k "not DbtUnitTest" tests/unit/test_dbt_config_errors.py tests/unit/test_dbt_http_config.py tests/unit/utils/test_gcs_client_impersonation.py tests/unit/test_dbt_ingest.py tests/unit/test_dbt_test_definition.py tests/unit/test_dbt_test_descriptions.py tests/unit/test_workflow_parse.py→ 242 passed, 119 deselected. These are every unit test file that importsdbt_config, plus the other dbt test files.test_dbt.py::DbtUnitTest(119 tests). In this environment it stalls attest_dbt_raw_query, and it stalls in the same place withorigin/main'sdbt_config.py, so the cause is the local environment, not this change. None of it uses the dbt Cloud handler. CI runs it.APIError, and the non-strict run_resultsexcept.ruff format/ruff checkclean.Backend integration tests
make java_affectedselects no Java unit tests and 26 integration tests (<- area ingestion-pipelines/ smoke) because of the schema touch. No Java code reads the new optional field; the only Java change is the generatedDbtCloudConfigPOJO.Local Java test run: 2 flaky failures, both unrelated (commit
ebf187d8aab, before the rebase ontomain; JDK 21,mysql-elasticsearch)WorkflowRedeploySignalIT#suspendedWorkflowRedeployedTakesNoSignal: a flake under parallel load; passes 2/2 when re-run aloneWorkflowDefinitionResourceIT#test_dataProductPortCannotBecomeBothKindsThroughOneRequest: a known approval flake, fixed onmainby #36560 after this branch was cut. The branch has since been rebased ontomainto pick that fix upBoth are governance-workflow tests that this change can't reach. Per-class details are in this comment. The suite was not re-run after the rebase; the merge queue runs it in full.
Ingestion integration tests
ingestion/tests/integration/, and the change is covered at the HTTP-client boundary.Playwright (UI) tests
Manual testing performed
Ran the fetcher (
get_dbt_details, this branch's code) against a real dbt Cloud account on a*.us1.dbt.comcell host: 1 project-less scan, about 15 jobs across 6 environments, dbt 2025.11 → 2026.10.dbt seedand never writes a manifest.dbt artifacts of 1 dbt Cloud environment(s) were not ingested: [70471823526777] Manifest file not found in dbt Cloud for run [70471869382033] of job [70471823571802].test_a_broken_job_skips_only_its_environment_then_fails_the_runcovers a broken environment in the middle.70471823472765has a full job (70471823495457: seed/run/test + docs, latest run today) and a partial job (70471823538804:dbt run --select customers)."70471823538804,70471823495457"): one merged set. The newest manifest decides the nodes, andcustomerskeeps its SQL from the partial job, so 1 of 5 compiled plus its test result." 70471823495457, 70471823495457 ,": de-duplicated to the single-job path.metadata ingestinto a local OpenMetadata server (2.0.0-SNAPSHOT). I created a Redshift service with the 8 jaffle_shop tables indev.dbt_production, then ran three dbt workflows (dbtConfigType: cloud) in order:70471823526777reported asDBT Configuration Error … 1 dbt Cloud environment(s) were not ingestedwhile every other environment was ingestedLineage (upstream edges) matched in all three. The remaining warnings come from this test instance: a missing
openmetadataowner, and dbt tags and custom properties that don't exist there.Open question: a second environment on this account also builds into
dev.dbt_production. In all-jobs mode it was ingested after jaffle_shop and added two column descriptions; nothing was lost here. Environments are ingested separately, though, so two environments targeting the same schema both write to the same tables, and the later one wins.UI screen recording:
Not applicable: this is not a UI feature. The only UI changes are a new boolean field rendered automatically from the JSON schema, and help text.
Checklist:
I have read the CONTRIBUTING document.
My PR title is
Fixes <issue-number>: <short explanation>My PR is linked to a GitHub issue via
Fixes #<issue-number>above.I have commented on my code, particularly in hard-to-understand areas.
For JSON Schema changes: no migration needed. The new field is optional with a
falsedefault, anddbtCloudJobIdkeeps its type.For a UI feature or feature task: not applicable (see above).
I have added tests (unit / integration / Playwright as applicable) and listed them above.
Self-review: I reviewed the final diff against
REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.Reviewed SHA
a98c6a8(six passes). Every 🔴 from earlier passes is fixed in this branch: per-job overwrite → per-environment merge; silent per-job skips → skip only no-run jobs, plus strict artifact fetch; mixed dbt versions → explicit failure; stale nodes from old runs → the newest manifest is authoritative. Answered rather than changed: Collate's owndbt.mdcopy needs the same help text (separate repo, follow-up)._compiled_queryreads raw manifest dicts before parsing, sodbt_utils.get_dbt_compiled_query, which reads parsed node objects, can't be reused.Decision check: adds
docs/decisions/2026-10-29-dbt-cloud-multi-job-artifacts-merge-per-environment.md.The issue properly describes why the new feature is needed.
I have updated the documentation (in-app help
Database/workflows/dbt.md).I have added tests around the new logic.
🤖 Generated with Claude Code