Skip to content

Instantly share code, notes, and snippets.

View atrivedi-dbtlabs's full-sized avatar

atrivedi-dbtlabs

View GitHub Profile
@atrivedi-dbtlabs
atrivedi-dbtlabs / generate_model_yaml_example.txt
Created October 4, 2025 15:30
generate_model_yaml macro example for C25 Getting Started with dbt. This example is a great way to add model yaml code directly to a _models.yml file that that will be automatically created in a specified folder that you have created. Just need to remove wrapping single quotes in the generated file.
dbt --quiet run-operation generate_model_yaml --args '{"model_names": ["stg_jaffle_shop__customers", "stg_jaffle_shop__orders"], "upstream_descriptions", "true"}' > models/staging/jaffle_shop/_jaffle_shop__models.yml
@atrivedi-dbtlabs
atrivedi-dbtlabs / create_base_models_example.txt
Last active October 4, 2025 15:31
create_base_models to show learners in C25 Getting Started with dbt how this macro can be used locally to generate staging models for all specified source tables. Once line 1 has been run, the results have to be run to create the staging models. I then had to move them into the appropriate folder.
dbt run-operation codegen.create_base_models --args '{source_name: jaffle_shop, tables: ["orders","customers"]}'
Run these commands in your shell to generate the models:
source dbt_packages/codegen/bash_scripts/base_model_creation.sh jaffle_shop orders &&
source dbt_packages/codegen/bash_scripts/base_model_creation.sh jaffle_shop customers
@atrivedi-dbtlabs
atrivedi-dbtlabs / generate_source_example.txt
Last active October 4, 2025 12:56
generate_source macro example for C25 Getting Started with dbt. This example is a great way to add compiled yaml code directly to a _sources.yml file that that will be automatically created. Just need to remove wrapping single quotes in the generated file.
dbt --quiet run-operation generate_source --args '{"schema_name": "jaffle_shop", "database_name": "raw", "table_names": ["orders","customers"], "generate_columns": "true", "include_descriptions": "true"}' > models/staging/jaffle_shop/_jaffle_shop__sources.yml