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. 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-dirPath 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.
--targetForwarded to dbt test --target.
--profiles-dirForwarded to dbt test --profiles-dir.
--prune / --no-prune--no-pruneRemove model columns and tags that are not declared in the contract.
--run-tests / --skip-tests--skip-testsRun dbt test on the generated tests after syncing. Default: skip (generate only).
--publishThe url to publish the results after the test.
--serverSelected 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-debugEnable debug logging
datacontract dbt sync orders.odcs.yaml --project-dir ./warehouse