Skip to main content

datacontract dbt sync

Generate dbt tests and model metadata from one or more ODCS contracts. Modifies the existing dbt model YAML in place (preserving comments and formatting), and creates new model YAML files or singular SQL tests if needed (if not run in dry-run mode). Use datacontract dbt test or pass --run-tests to run the generated tests.

datacontract dbt sync [OPTIONS] [CONTRACT]...
ArgumentDefaultDescription
[CONTRACT]...—Path(s) or glob(s) of ODCS contracts to sync. If omitted, syncs every *.odcs.yaml under --project-dir (default: current directory) and its subdirectories.
OptionDefaultDescription
--project-dir—Path to the dbt project root (must contain dbt_project.yml). Defaults to the current directory.
--schema-nameallWhich ODCS schema object to sync, by name.
--model-resolutionnameHow to map an ODCS schema to a dbt model name.
--target—Forwarded to dbt test --target.
--profiles-dir—Forwarded to dbt test --profiles-dir.
--prune / --no-prune--no-pruneRemove model columns and tags that are not declared in the contract.
--dry-run / --no-dry-run--no-dry-runRun in dry-run mode, without applying any changes to the dbt project.
--run-tests / --skip-tests--skip-testsRun dbt test on the generated tests after syncing. Default: skip (generate only).
--publish—The url to publish the results after the test.
--server—Selected ODCS server. Determines the dialect for data types and for the server label when publishing results. Default: Auto-selected if only one server exists, else --target.
--ssl-verification / --no-ssl-verification--ssl-verificationSSL verification when publishing test results.
--debug / --no-debug—Enable debug logging
datacontract dbt sync orders.odcs.yaml --project-dir ./warehouse