Generation¶
Adapter Layer¶
The adapter module wraps datacontract-cli exporters and adds lineage-aware rendering from ODPS products.
dbt_contracts.core.adapter
¶
Adapter layer wrapping datacontract-cli exporters for dbt artifact generation.
Provides lineage-aware rendering of ODCS contracts into dbt sources, models, and staging SQL, using ODPS products to determine contract classification.
LintResult
¶
Bases: BaseModel
Result of validating an ODCS contract against the JSON schema.
Source code in src/dbt_contracts/core/adapter.py
GenerationResult
¶
Bases: BaseModel
Combined dbt artifacts produced by rendering contracts.
Source code in src/dbt_contracts/core/adapter.py
lint(contract)
¶
Validate an ODCS contract against the JSON schema.
Delegates to datacontract-cli's lint functionality. Serializes the contract to YAML first, as datacontract-cli only runs full JSON schema validation when receiving a YAML string (not an object).
Source code in src/dbt_contracts/core/adapter.py
render(contracts, products, default_server_type='snowflake')
¶
Render ODCS contracts into dbt artifacts using ODPS lineage.
Classifies each contract as source, model, or ref based on ODPS port definitions, then calls the appropriate datacontract-cli exporter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
contracts
|
list[OpenDataContractStandard]
|
ODCS contract objects to render. |
required |
products
|
list[OpenDataProductStandard]
|
ODPS product objects defining lineage between contracts. |
required |
default_server_type
|
str
|
Fallback server type when a contract has no servers. |
'snowflake'
|
Returns:
| Type | Description |
|---|---|
GenerationResult
|
GenerationResult with sources, models, and staging SQL dicts. |