Back to Utils

Snippet · dbt

Generate Sources

Ready-to-use dbt run-operation commands for generating sources, staging models and project configuration. Copy and adjust the database and schema names.

generate_sources.sql
-- Generate sources.yml for all schemas in a database:
dbt run-operation generate_source_yaml \
  --args '{"database": "MY_DB"}'

-- Or for specific schemas:
dbt run-operation generate_source_yaml \
  --args '{"database": "MY_DB", "schemas": ["RAW", "LANDING"]}'

-- Per-schema split output:
dbt run-operation generate_source_yaml \
  --args '{"database": "MY_DB", "split": true}'


-- Generate staging models (SQL per table):
dbt run-operation generate_staging_models \
  --args '{"database": "MY_DB"}'

-- For specific schemas:
dbt run-operation generate_staging_models \
  --args '{"database": "MY_DB", "schemas": ["RAW"]}'


-- Generate dbt_project.yml snippet:
dbt run-operation generate_dbt_project_snippet \
  --args '{"database": "MY_DB"}'

Want more details about Generate Sources? View the full documentation →