### Run Minimal Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/examples/minimal/README.md Execute the minimal MiniJinja example using Cargo and observe the output. ```console $ cargo run 1. Hello John! 2. Hello Peter! ``` -------------------------------- ### Run Custom Loader Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/examples/custom-loader/README.md Execute the custom loader example to see template rendering in action. Ensure the 'templates' folder is present. ```console $ cargo run header Hello World! footer ``` -------------------------------- ### Install minijinja-cli with Homebrew Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja-cli/README.md Install the minijinja-cli tool using the Homebrew package manager. ```bash brew install minijinja-cli ``` -------------------------------- ### Run Streaming Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/examples/streaming/README.md Execute the streaming example using Cargo. This command initiates the process to demonstrate one-shot iterator streaming. ```bash $ cargo run ``` -------------------------------- ### Render Single Template from String Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/examples/hello/README.md This snippet shows the command to run the hello example and its expected output. ```console $ cargo run Hello John! ``` -------------------------------- ### Install minijinja-py Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja-py/README.md Install the minijinja package from PyPI using pip. This command fetches and installs the latest version of the library. ```bash $ pip install minijinja ``` -------------------------------- ### Install minijinja-cli with Shell Installer Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja-cli/README.md Use this command to automatically install minijinja-cli binaries. The script detects your platform and installs to a default location or a directory specified by MINIJINJA_CLI_INSTALL_DIR. ```bash curl -sSfL https://github.com/mitsuhiko/minijinja/releases/latest/download/minijinja-cli-installer.sh | sh ``` -------------------------------- ### Run Value Tracking Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/examples/value-tracking/README.md Execute the value tracking example using Cargo. This command initiates the process to demonstrate how dbt-jinja tracks resolved values. ```bash $"cargo run" ``` -------------------------------- ### SQL Model Configuration Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-schemas/src/schemas/project/configs/README_OMISSIBLE.md Example of a dbt SQL model using the `config` macro to set schema and database. This demonstrates how model-level configurations interact with project-level overrides. ```sql -- Package model with config {{ config(schema = 'something_else', database = 'my_db') }} select 1 as id ``` -------------------------------- ### Using the minijinja-cli for Templating Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/README.md Demonstrates how to install and use the minijinja command-line interface to render a simple template with a variable. ```bash $ curl -sSfL https://github.com/mitsuhiko/minijinja/releases/latest/download/minijinja-cli-installer.sh | sh $ echo "Hello {{ name }}" | minijinja-cli - -Dname=World Hello World ``` -------------------------------- ### Ambiguous resource selection example Source: https://github.com/dbt-labs/dbt-core/wiki/proposals/rfc_1_orchestration This example demonstrates an ambiguous resource selection command on the dbt CLI. It highlights the need for a more precise selection syntax. ```bash $ dbt run --models snowplow ``` -------------------------------- ### Jinja Template Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/README.md A basic Jinja template demonstrating inheritance and block usage. ```jinja {% extends "layout.html" %} {% block body %}

Hello {{ name }}!

{% endblock %} ``` -------------------------------- ### Install minijinja-cli with Cargo Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja-cli/README.md Compile and install the minijinja-cli tool directly from source using Cargo, Rust's package manager. ```bash cargo install minijinja-cli ``` -------------------------------- ### Jinja Loop Unpacking Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja/tests/inputs/loop_bad_unpacking.txt Demonstrates a Jinja loop attempting to unpack a sequence. This specific example is expected to fail due to incorrect unpacking. ```jinja ``` -------------------------------- ### Start Local Jaeger and Export Traces Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-common/src/tracing/README.md Starts a local Jaeger instance for trace visualization and then runs dbt commands, exporting traces to OTLP. Ensure OTEL_EXPORTER_OTLP_ENDPOINT is set. ```bash cargo xtask telemetry OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318" cargo run -p dbt-cli -- --export-to-otlp cargo xtask telemetry --stop ``` -------------------------------- ### Install cargo-fuzz Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/fuzz/README.md Install the cargo-fuzz tool, which is required for running fuzz tests. ```bash cargo install cargo-fuzz ``` -------------------------------- ### dbt Project YAML Configuration Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-schemas/src/schemas/project/configs/README_OMISSIBLE.md Example of root project dbt_project.yml configuration demonstrating explicit null overrides for schema and database. This configuration will be inherited by child models. ```yaml # Root project dbt_project.yml models: my_package: +schema: null # Explicitly override to null +database: null # Explicitly override to null ``` -------------------------------- ### REPL Mode Examples Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja-cli/README.md Within the REPL, you can execute MiniJinja expressions. Type .help for assistance and .quit or ^D to exit. ```minijinja name|upper range(3) ``` -------------------------------- ### Invoking Jinja Template from Rust Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/README.md Example of how to use the minijinja environment in Rust to load, render, and output a template. ```rust use minijinja::{Environment, context}; fn main() { let mut env = Environment::new(); env.add_template("hello.txt", "Hello {{ name }}!").unwrap(); let template = env.get_template("hello.txt").unwrap(); println!("{}", template.render(context! { name => "World" }).unwrap()); } ``` -------------------------------- ### List Literal Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja-cli/src/syntax_help.txt Demonstrates list literals in MiniJinja, used for storing sequential data. Supports bracket notation. ```jinja ['list', 'of', 'objects'] ``` -------------------------------- ### Example Response for GET /api/v1/exposures/:id Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-docs-server/API-CONTRACTS.md This is an example JSON response for the GET /api/v1/exposures/:id endpoint. Fields marked with '// 🔧' require a backend change, and those with '// 🔍' need parquet schema verification. ```json { "unique_id": "exposure.jaffle_shop.revenue_dashboard", "name": "revenue_dashboard", "resource_type": "exposure", "package_name": "jaffle_shop", "description": "Top-line revenue dashboard used by the finance team.", "original_file_path": "models/exposures.yml", "file_path": "models/exposures.yml", "tags": ["finance", "exec"], "fqn": ["jaffle_shop", "revenue_dashboard"], "label": "Revenue Dashboard", "exposure_type": "dashboard", "maturity": "high", "url": "https://bi.example.com/dashboards/revenue", "owner_name": "Jane Doe", "owner_email": "jane.doe@example.com", "meta": { "team": "finance" }, "depends_on": [ { "unique_id": "model.jaffle_shop.orders", "edge_type": "model" }, { "unique_id": "source.jaffle_shop.raw_jaffle.orders", "edge_type": "source" } ], "created_at": 1747432300.5 } ``` -------------------------------- ### Generate Starter Manifest Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-metricflow/docs/metric-semantics.md Prints a starter manifest JSON with sample queries. Useful for understanding the expected structure and for initial setup. ```sh # 0. Print a starter manifest dbt-metricflow example ``` -------------------------------- ### Example Response for GET /api/v1/sources/:id Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-docs-server/API-CONTRACTS.md This JSON object represents a typical response from the GET /api/v1/sources/:id endpoint, illustrating the structure and data returned for a specific source. ```json { "unique_id": "source.jaffle_shop.raw_jaffle.orders", "name": "orders", "resource_type": "source", "package_name": "jaffle_shop", "description": "Raw orders table from the production Postgres database.", "original_file_path": "models/staging/sources.yml", "file_path": "models/staging/sources.yml", "tags": ["raw", "jaffle"], "fqn": ["jaffle_shop", "raw_jaffle", "orders"], "database_name": "raw", "schema_name": "jaffle_shop", "identifier": "orders", "source_name": "raw_jaffle", "source_description": "Raw tables synced from the Jaffle Shop production database.", "loader": "fivetran", "meta": { "owner": "data-eng" }, "referenced_by": [ { "unique_id": "model.jaffle_shop.stg_orders", "edge_type": "model" } ], "columns": [ { "name": "id", "index": 0, "data_type": "integer", "declared_type": "int", "inferred_type": null, "catalog_type": "INT64", "description": "Unique order identifier.", "label": null, "granularity": null } ], "freshness": { "status": "pass", "snapshotted_at": "2026-05-15T10:00:00Z", "max_loaded_at": "2026-05-15T09:45:00Z", "max_loaded_at_time_ago": 900.0, "criteria": { "error_after": { "count": 24, "period": "hour" }, "warn_after": { "count": 12, "period": "hour" } } }, "catalog": { "type": "table", "owner": "fivetran", "comment": "Raw orders synced from production PostgreSQL.", "primary_key": ["id"], "row_count_stat": 50000, "bytes_stat": 2097152, "stats": [ { "id": "has_stats", "label": "Has Stats?", "value": "true", "description": "Indicates whether there are statistics for this table", "include": false } ] } } ``` -------------------------------- ### Example Response for GET /api/v1/seeds Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-docs-server/API-CONTRACTS.md This JSON structure represents a typical response from the GET /api/v1/seeds endpoint, detailing seed metadata and pagination information. Note that some fields are marked as experimental or unverified. ```json { "data": [ { "unique_id": "seed.jaffle_shop.raw_customers", "name": "raw_customers", "resource_type": "seed", "package_name": "jaffle_shop", "description": "Raw customer seed file loaded from CSV.", "original_file_path": "seeds/raw_customers.csv", "row_count": 935, // 🔍 from dbt.catalog_stats; null when has_catalog_stats false or stat absent "executed_at": "2026-05-15T10:28:03Z" // 🔧 from dbt_rt.run_results.created_at; null when has_run_results false }, { "unique_id": "seed.jaffle_shop.raw_orders", "name": "raw_orders", "resource_type": "seed", "package_name": "jaffle_shop", "description": null, "original_file_path": "seeds/raw_orders.csv", "row_count": null, "executed_at": null } ], "page_info": { "total_count": 42, "start_cursor": "eyJzIjoiPHN0YXJ0X3NvcnRfdmFsdWU+IiwiaSI6Ijx1bmlxdWVfaWQ+In0", "end_cursor": "eyJzIjoiPHNvcnRfdmFsdWU+IiwiaSI6Ijx1bmlxdWVfaWQ+In0", "has_next_page": false } } ``` -------------------------------- ### Example Response for GET /api/v1/groups Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-docs-server/API-CONTRACTS.md This JSON structure represents the data returned when querying for groups. It includes group details and pagination information. ```json { "data": [ { "unique_id": "group.jaffle_shop.finance", "name": "finance", "owner_name": "Finance Data Team", "owner_email": "finance-data@jaffle.example", "owner_github": "jaffle/finance-data-team", "owner_slack": "#finance-data", "model_count": 12 }, { "unique_id": "group.jaffle_shop.marketing", "name": "marketing", "owner_name": "Marketing Analytics", "owner_email": "marketing-data@jaffle.example", "owner_github": null, "owner_slack": null, "model_count": 5 } ], "page_info": { "total_count": 42, "start_cursor": "eyJzIjoiPHN0YXJ0X3NvcnRfdmFsdWU+IiwiaSI6Ijx1bmlxdWVfaWQ+In0", "end_cursor": "eyJzIjoiPHNvcnRfdmFsdWU+IiwiaSI6Ijx1bmlxdWVfaWQ+In0", "has_next_page": false } } ``` -------------------------------- ### Initialize Environment with Templates Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja-py/README.md Sets up a MiniJinja environment by providing a dictionary of template names and their source code directly. ```python from minijinja import Environment env = Environment(templates={ "template_name": "Template source" }) ``` -------------------------------- ### GET /api/v1/exposures Response Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-docs-server/API-CONTRACTS.md This JSON structure represents a successful response from the `/api/v1/exposures` endpoint, including exposure data and pagination information. ```json { "data": [ { "unique_id": "exposure.jaffle_shop.revenue_dashboard", "name": "revenue_dashboard", "exposure_type": "dashboard", "maturity": "high", "owner_name": "Jane Doe", "owner_email": "jane.doe@example.com", "tags": ["finance", "exec"], "created_at": 1747432300.5, "depends_on": [ { "unique_id": "model.jaffle_shop.orders", "edge_type": "model" }, { "unique_id": "source.jaffle_shop.raw_jaffle.orders", "edge_type": "source" } ], "depends_on_truncated": false }, { "unique_id": "exposure.jaffle_shop.churn_notebook", "name": "churn_notebook", "exposure_type": "notebook", "maturity": "medium", "owner_name": "Alex Park", "owner_email": "alex.park@example.com", "tags": [], "created_at": 1747104900.0, "depends_on": [ { "unique_id": "model.jaffle_shop.customers", "edge_type": "model" } ], "depends_on_truncated": false } ], "page_info": { "total_count": 42, "start_cursor": "eyJzIjoiPHN0YXJ0X3NvcnRfdmFsdWU+IiwiaSI6Ijx1bmlxdWVfaWQ+In0", "end_cursor": "eyJzIjoiPHNvcnRfdmFsdWU+IiwiaSI6Ijx1bmlxdWVfaWQ+In0", "has_next_page": false } } ``` -------------------------------- ### Example Response for GET /api/v1/tests/facets Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-docs-server/API-CONTRACTS.md This JSON object shows the structure of a typical response from the /api/v1/tests/facets endpoint, detailing available filter options for tests. ```json { "results": [ { "value": "pass", "count": null }, { "value": "fail", "count": null }, { "value": "warn", "count": null }, { "value": "error", "count": null }, { "value": "skipped", "count": null }, { "value": "unknown", "count": null } ], "run_statuses": [ { "value": "success", "count": null }, { "value": "error", "count": null }, { "value": "skipped", "count": null }, { "value": "reused", "count": null } ], "test_types": [ { "value": "unit", "count": null }, { "value": "data", "count": null } ] } ``` -------------------------------- ### Example Response for GET /api/v1/seeds/facets Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-docs-server/API-CONTRACTS.md The response body is an empty object, as seeds do not expose filter dropdowns in dbt-ui. This endpoint exists for API uniformity. ```json {} ``` -------------------------------- ### Basic Template Rendering with C API Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja-cabi/README.md Demonstrates how to initialize the environment, add a template, set context variables, render the template, and clean up resources using the minijinja-cabi library. ```c #include #include int main() { mj_env *env = mj_env_new(); bool ok = mj_env_add_template(env, "hello", "Hello {{ name }}!"); mj_value ctx = mj_value_new_object(); mj_value_set_string_key(&ctx, "name", mj_value_new_string("C-Lang")); char *rv = mj_env_render_template(env, "hello", ctx); if (!rv) { mj_err_print(); } else { printf("%s\n", rv); mj_str_free(rv); } mj_env_free(env); return 0; } ``` -------------------------------- ### Example Response for GET /api/v1/snapshots Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-docs-server/API-CONTRACTS.md This JSON structure represents a typical response from the GET /api/v1/snapshots endpoint, showcasing snapshot data and pagination information. Fields marked with '// 🔧' are not yet returned and require backend changes, while '// 🔍' fields need verification against a real index. ```json { "data": [ { "unique_id": "snapshot.jaffle_shop.orders_snapshot", "name": "orders_snapshot", "resource_type": "snapshot", "package_name": "jaffle_shop", "materialized": "snapshot", "strategy": "timestamp", "updated_at": "updated_at", "execution_info": { "status": "success", "completed_at": "2026-05-15T10:32:11Z", "error": null }, "catalog": { "row_count_stat": 42000, "bytes_stat": 3145728, "last_modified_stat": "2026-05-15 10:30:00" } }, { "unique_id": "snapshot.jaffle_shop.customers_snapshot", "name": "customers_snapshot", "resource_type": "snapshot", "package_name": "jaffle_shop", "materialized": "snapshot", "strategy": "check", "updated_at": null, "execution_info": null, "catalog": null } ], "page_info": { "total_count": 42, "start_cursor": "eyJzIjoiPHN0YXJ0X3NvcnRfdmFsdWU+IiwiaSI6Ijx1bmlxdWVfaWQ+In0", "end_cursor": "eyJzIjoiPHNvcnRfdmFsdWU+IiwiaSI6Ijx1bmlxdWVfaWQ+In0", "has_next_page": false } } ``` -------------------------------- ### Implement TelemetryMiddleware for Span Counting Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-tracing/README.md Example of implementing the `TelemetryMiddleware` trait to count spans. This middleware increments a metric for each span start and passes through log records and span ends. ```rust use dbt_tracing::{ LogRecordInfo, SpanEndInfo, SpanStartInfo, data_provider::DataProvider, layer::TelemetryMiddleware, metrics::MetricKey, }; struct SpanCounter; impl TelemetryMiddleware for SpanCounter { fn on_span_start( &self, span: SpanStartInfo, data_provider: &mut DataProvider<'_>, ) -> Option { data_provider.increment_metric(MetricKey::from_raw(1), 1); Some(span) } fn on_log_record( &self, record: LogRecordInfo, _data_provider: &mut DataProvider<'_>, ) -> Option { Some(record) } fn on_span_end( &self, span: SpanEndInfo, _data_provider: &mut DataProvider<'_>, ) -> Option { Some(span) } } ``` -------------------------------- ### Snowflake Connection and Query Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-adbc/README.md Demonstrates loading the Snowflake ADBC driver, configuring a database connection using system settings or a URI, and executing a simple SQL query. ```rust use adbc_core::options::AdbcVersion; use adbc_core::{Connection, Statement}; use dbt_adbc::{connection, database, driver, Backend}; use arrow_array::{cast::AsArray, types::Decimal128Type}; # fn main() -> Result<(), Box> { // Load the driver let mut driver = driver::Builder::new(Backend::Snowflake) .with_version(AdbcVersion::V110) .build()?; // Construct a database using system configuration let mut database = database::Builder::from_snowsql_config()?.build(&mut driver)?; // ..or from a URI. let mut builder = database::Builder::new(Backend::Snowflake); builder.with_parse_uri("my_account/my_db/my_schema?role=R&warehouse=WH")?; let mut database = builder.build(&mut driver)?; // Create a connection to the database let mut connection = connection::Builder::default().build(&mut database)?; // Construct a statement to execute a query let mut statement = connection.new_statement()?; // Execute a query statement.set_sql_query("SELECT 21 + 21")?; let mut reader = statement.execute()?; // Check the result let batch = reader.next().expect("a record batch")?; assert_eq!( batch.column(0).as_primitive::().value(0), 42 ); # Ok(()) } ``` -------------------------------- ### Example dbt Semantic Model API Response Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-docs-server/API-CONTRACTS.md This JSON object represents a typical response from the GET /api/v1/semantic_models/:id endpoint, illustrating the structure and fields available for a dbt semantic model. ```json { "unique_id": "semantic_model.jaffle_shop.orders", "name": "orders", "resource_type": "semantic_model", "package_name": "jaffle_shop", "description": "Semantic model over the orders fact table.", "label": "Orders", "original_file_path": "models/semantic_models.yml", "file_path": "semantic_models.yml", "tags": ["finance", "semantic"], "fqn": ["jaffle_shop", "semantic_models", "orders"], "meta": { "owner": "data-eng" }, "group_name": "finance", "model": { "unique_id": "model.jaffle_shop.fct_orders", "name": "fct_orders", "access_level": "public", "alias": "fct_orders" }, "primary_entity": "order", "entities": [ { "name": "order", "type": "primary", "description": "Unique order identifier.", "label": null, "expr": "order_id", "role": null }, { "name": "customer", "type": "foreign", "description": "Customer that placed the order.", "label": null, "expr": "customer_id", "role": null } ], "dimensions": [ { "name": "ordered_at", "type": "time", "description": "Timestamp the order was placed.", "label": null, "expr": "ordered_at", "is_partition": false, "time_granularity": "day", "type_params": { "time_granularity": "day" } }, { "name": "status", "type": "categorical", "description": "Order lifecycle status.", "label": null, "expr": "status", "is_partition": false, "time_granularity": null, "type_params": null } ], "measures": [ { "name": "order_total", "agg": "sum", "description": "Sum of order totals.", "label": null, "expr": "amount", "create_metric": true, "agg_time_dimension": "ordered_at", "agg_params": null, "non_additive_dimension": null }, { "name": "order_count", "agg": "count", "description": "Number of orders.", "label": null, "expr": "1", "create_metric": false, "agg_time_dimension": "ordered_at", "agg_params": null, "non_additive_dimension": null } ], "depends_on": [ { "unique_id": "model.jaffle_shop.fct_orders", "edge_type": "ref" } ], "referenced_by": [ { "unique_id": "metric.jaffle_shop.total_orders", "edge_type": "metric" }, { "unique_id": "saved_query.jaffle_shop.orders_by_month", "edge_type": "saved_query" } ], "created_at": 1747432300.5 } ``` -------------------------------- ### Example Response for GET /api/v1/semantic_models Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-docs-server/API-CONTRACTS.md This JSON structure represents a paginated response containing a list of semantic models. It includes metadata for pagination and details for each semantic model such as its unique ID, name, package, entities, and description. ```json { "data": [ { "unique_id": "semantic_model.jaffle_shop.orders", "name": "orders", "package_name": "jaffle_shop", "group_name": "finance", "primary_entity": "order", "entities": [ { "name": "order", "type": "primary" }, { "name": "customer", "type": "foreign" } ], "description": "Semantic model over the orders fact table.", "created_at": 1747432300.5, "truncated": false }, { "unique_id": "semantic_model.jaffle_shop.customers", "name": "customers", "package_name": "jaffle_shop", "group_name": null, "primary_entity": "customer", "entities": [ { "name": "customer", "type": "primary" } ], "description": null, "created_at": 1747432301.1, "truncated": false } ], "page_info": { "total_count": 42, "start_cursor": "eyJzIjoiPHN0YXJ0X3NvcnRfdmFsdWU+IiwiaSI6Ijx1bmlxdWVfaWQ+In0", "end_cursor": "eyJzIjoiPHNvcnRfdmFsdWU+IiwiaSI6Ijx1bmlxdWVfaWQ+In0", "has_next_page": false } } ``` -------------------------------- ### Example Response for GET /api/v1/sources/facets Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-docs-server/API-CONTRACTS.md This JSON object represents a typical response from the /api/v1/sources/facets endpoint. It includes static freshness statuses and project-specific database and schema facets. The 'count' field is currently null and reserved for future use. ```json { "freshness_status": [ { "value": "pass", "count": null }, { "value": "warn", "count": null }, { "value": "error", "count": null }, { "value": "runtime_error", "count": null }, { "value": "no_data", "count": null } ], "databases": [ { "value": "raw", "count": null } ], "schemas": [ { "value": "jaffle_shop", "count": null }, { "value": "stripe", "count": null } ] } ``` -------------------------------- ### Generate and Open Local Documentation Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-cloud-api/README.md Use this command to build the documentation for the dbt Cloud API crate and automatically open it in your web browser. ```bash cargo doc --open ``` -------------------------------- ### Example Response for GET /api/v1/models/:id Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-docs-server/API-CONTRACTS.md This JSON object represents the detailed information returned for a specific dbt model. Fields like 'execution_info' and 'catalog' may be null if corresponding dbt commands (like 'dbt build' or 'dbt docs generate') have not been run. ```json { "unique_id": "model.jaffle_shop.orders", "name": "orders", "resource_type": "model", "package_name": "jaffle_shop", "materialized": "table", "description": "Final orders model combining payments and order status.", "database_name": "prod", "schema_name": "dbt_prod", "relation_name": "prod.dbt_prod.orders", "identifier": "orders", "original_file_path": "models/orders.sql", "file_path": "models/orders.sql", "access_level": "public", "group_name": "finance", "raw_code": "select order_id, ...\nfrom {{ ref('stg_orders') }}", "compiled_code": "select order_id, ...\nfrom prod.dbt_prod.stg_orders", "contract_enforced": true, "tags": ["finance", "core"], "fqn": ["jaffle_shop", "orders"], "columns": [ { "name": "order_id", "index": 0, "data_type": "integer", "declared_type": "int", "inferred_type": null, "catalog_type": "INT64", "description": "Unique order identifier.", "label": null, "granularity": null } ], "depends_on": [ { "unique_id": "model.jaffle_shop.stg_orders", "edge_type": "model" }, { "unique_id": "model.jaffle_shop.stg_payments", "edge_type": "model" } ], "referenced_by": [ { "unique_id": "exposure.jaffle_shop.revenue_dashboard", "edge_type": "exposure" } ], "execution_info": { "status": "success", "execution_time": 4.2, "completed_at": "2026-05-15T10:32:11Z" }, "catalog": { "type": "table", "owner": "dbt_runner", "bytes_stat": null, "row_count_stat": null } } ``` -------------------------------- ### Configuring with TRUE Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja/tests/parser-inputs/boolean_case_insensitive.txt Illustrates setting a configuration option to TRUE using the uppercase literal. ```jinja {{ config(enabled=TRUE) }} ``` -------------------------------- ### Run minijinja-cli to render a template Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja-cli/README.md Execute the installed minijinja-cli tool, providing the template file and a data file (e.g., JSON) as arguments. ```bash minijinja-cli my-template.j2 data.json ``` -------------------------------- ### Render Template from String Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/examples/line-statements/README.md This example shows how to render a simple template directly from a string. It's useful for quick tests or when templates are dynamically generated. ```console $ cargo run Hello John! ``` -------------------------------- ### Sample dbt ADBC Driver Commands Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-adbc/README.md Examples of running dbt commands with different environment variable configurations to control ADBC driver loading and rebuilding. ```bash DISABLE_AUTO_DRIVER_REBUILD= DISABLE_CDN_DRIVER_CACHE=0 ../fs3/target/debug/dbt seed ``` ```bash DISABLE_CDN_DRIVER_CACHE= ../fs3/target/debug/dbt seed ``` ```bash DISABLE_CDN_DRIVER_CACHE=0 cargo run --bin dbt seed ``` -------------------------------- ### Run Blackhole Server Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-adapter/tests/snowflake_context_deadline_exceeded_repro_project/README.md Start a black-hole server on localhost to simulate a hung connection. Ensure the host and port match your dbt profiles.yml configuration. ```sh python3 blackhole.py ``` -------------------------------- ### Run All Tests Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/CONTRIBUTING.md Execute all tests for the MiniJinja project using the provided make command. ```sh make test ``` -------------------------------- ### List Projects with Pagination Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-cloud-api/README.md This example demonstrates how to list projects for your dbt Cloud account using pagination. It skips the first 5 projects and retrieves the next 10. ```APIDOC ## GET /api/v3/accounts//projects/ ### Description Retrieves a paginated list of projects accessible by the authenticated token. ### Method GET ### Endpoint `/api/v3/accounts//projects/` ### Query Parameters - **limit** (integer) - Optional - Specifies the maximum number of records to retrieve (up to 100). - **offset** (integer) - Optional - Specifies the number of records to skip from the beginning. ### Request Example ```bash curl --request GET \ --url 'https://cloud.getdbt.com/api/v3/accounts//projects/?limit=10&offset=5' \ --header 'Content-Type: application/json' \ --header 'Authorization: Token ' ``` ### Response #### Success Response (200) - **data** (array) - An array of project objects. - **extra** (object) - Contains additional information about the request, including filters, order_by, and pagination details. - **pagination** (object) - **count** (integer) - The number of records returned in this response. - **total_count** (integer) - The total number of available records. #### Response Example ```json { "data": [ // ... project objects ... ], "extra": { "filters": {}, "order_by": "id", "pagination": { "count": 5, "total_count": 10 } } } ``` ``` -------------------------------- ### Configure Custom Syntax Delimiters (Old) Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/UPDATING.md Demonstrates the previous method for setting custom syntax delimiters in MiniJinja 1.x. ```rust use minijinja::{Environment, Syntax}; let mut env = Environment::new(); env.set_syntax(minijinja::Syntax { block_start: "{".into(), block_end: "}".into(), variable_start: "$".into(), variable_end: "}".into(), comment_start: "{*".into(), comment_end: "*}".into(), }) .unwrap(); ``` -------------------------------- ### Run Actix-Web Demo Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/examples/actix-web-demo/README.md Execute the Actix-Web demo application using Cargo. ```bash $ cargo run ``` -------------------------------- ### Run Custom Error Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/examples/custom-error/README.md Execute the custom error example using cargo run. This command initiates the dbt Jinja project to showcase custom error handling. ```console $ cargo run ``` -------------------------------- ### Including First Existing Template from a List Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja-cli/src/syntax_help.txt Shows how to provide a list of templates to include, and the first one that exists will be rendered. ```html {% include ['template1.html', 'template2.html'] %} ``` -------------------------------- ### Jinja Template Inheritance Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja/tests/parser-inputs/extends.txt This example shows how to extend a base template and override blocks. The `extends` tag specifies the parent template, and `block` tags define sections that can be overridden. ```jinja {% extends "layout.html" %} {% block title %}new title{% endblock %} {% block body %}new body{% endblock %} ``` -------------------------------- ### Jinja Comment Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/benchmarks/inputs/all_elements.html Illustrates how to add comments in Jinja templates that are ignored during rendering. ```jinja {# this is a comment #} ``` -------------------------------- ### Include Macro and Call Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja/tests/inputs/macro_include.txt This snippet shows how to include a macro file and then call the macro with different arguments. The `include` directive brings in macro definitions from another file, and subsequent calls demonstrate its usage. ```jinja {% - include "example_macro.txt" %} {% - set d = "should never show up" %} {{ example(1, 2, 3) }} {{ example(1, 2) }} ``` -------------------------------- ### Basic Template and Data File Usage Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja-cli/src/long_help.txt Renders a template file using a data file for context. Both arguments are positional. ```bash minijinja-cli hello.j2 hello.json ``` -------------------------------- ### Get Snapshots Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-docs-server/API-CONTRACTS.md Retrieves a list of snapshots in the dbt project. Supports pagination and sorting. ```APIDOC ## GET /api/v1/snapshots ### Description Retrieves a paginated list of snapshots available in the dbt project. This endpoint is used by the dbt-ui to display snapshot information. ### Method GET ### Endpoint /api/v1/snapshots ### Query Parameters - **first** (u32) - Optional - The number of snapshots to return per page. Defaults to 100, with a maximum of 1000. Server clamps values above 5000. - **after** (string) - Optional - A cursor for fetching the next page of results. Obtained from `page_info.end_cursor` of the previous response. Omit for the first page. - **sort** (string) - Optional - Specifies the sorting order. Format is `:`. Allowed columns are `name`, `package_name`, `updated_at`. Defaults to `name:asc`. ### Response #### Success Response (200) - **data** (SnapshotSummary[]) - A list of snapshot summary objects. - **page_info** (PageInfo) - Information about the pagination, including total count and cursors. ### Response Example ```json { "data": [ { "unique_id": "snapshot.jaffle_shop.orders_snapshot", "name": "orders_snapshot", "resource_type": "snapshot", "package_name": "jaffle_shop", "materialized": "snapshot", "strategy": "timestamp", "updated_at": "updated_at", "execution_info": { "status": "success", "completed_at": "2026-05-15T10:32:11Z", "error": null }, "catalog": { "row_count_stat": 42000, "bytes_stat": 3145728, "last_modified_stat": "2026-05-15 10:30:00" } } ], "page_info": { "total_count": 42, "start_cursor": "eyJzIjoiPHN0YXJ0X3NvcnRfdmFsdWU+IiwiaSI6Ijx1bmlxdWVfaWQ+In0", "end_cursor": "eyJzIjoiPHNvcnRfdmFsdWU+IiwiaSI6Ijx1bmlxdWVfaWQ+In0", "has_next_page": false } } ``` ### Field Reference - `data[*].unique_id` (string): Unique identifier for the snapshot. - `data[*].name` (string): The name of the snapshot. - `data[*].resource_type` (string): Always "snapshot" for this endpoint. - `data[*].package_name` (string | null): The dbt package the snapshot belongs to. - `data[*].materialized` (string): Always "snapshot" for this resource type. - `data[*].strategy` (string | null): The snapshot strategy used (e.g., "timestamp", "check"). - `data[*].updated_at` (string | null): Timestamp of the last update. - `data[*].execution_info` (object | null): Information about the last execution. - `status` (string): Execution status (e.g., "success"). - `completed_at` (string): Timestamp when the execution completed. - `error` (string | null): Error message if execution failed. - `data[*].catalog` (object | null): Catalog information for the snapshot. - `row_count_stat` (integer): Number of rows in the snapshot. - `bytes_stat` (integer): Size of the snapshot in bytes. - `last_modified_stat` (string): Timestamp of the last modification. ``` -------------------------------- ### Map Literal Example Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja-cli/src/syntax_help.txt Shows map literals in MiniJinja for key-value pairs. Keys must be unique. ```jinja {'map': 'of', 'key': 'and', 'value': 'pairs'} ``` -------------------------------- ### Initialize Namespace with Dictionary in Jinja Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja/tests/inputs/namespace.txt Demonstrates initializing a namespace from a dictionary. This is useful for setting multiple initial properties at once. ```jinja {% set ns = namespace({"found": true}) %} {{ ns }} ``` -------------------------------- ### Include Templates in MiniJinja Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-jinja/minijinja-cli/src/syntax_help.txt Demonstrates how to include other templates. Supports including multiple files and ignoring missing files. ```jinja {% include ['page_detailed.html', 'page.html'] %} {% include ['special_sidebar.html', 'sidebar.html'] ignore missing %} ``` -------------------------------- ### Get Groups Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-docs-server/API-CONTRACTS.md Retrieves a list of groups with support for pagination and sorting. This endpoint is used by the dbt-ui GroupFilterView. ```APIDOC ## GET /api/v1/groups ### Description Retrieves a list of groups, supporting pagination and sorting. This endpoint is designed to be used by the dbt-ui GroupFilterView component. ### Method GET ### Endpoint /api/v1/groups ### Query Parameters - **first** (u32) - Optional - Defaults to `100` (max `1000`). Per-page row count. Server clamps the value to `[1, 5000]`. Mirrors `GET /api/v1/models`. - **after** (string) - Optional - Opaque base64 cursor returned as `page_info.end_cursor` on the previous page. Omit for the first page. Tampering yields a 400 Bad Request. - **sort** (string) - Optional - Defaults to `name:asc`. Specifies sorting order in the format `:`. Only `name` is sortable. A `400 Bad Request` is returned for unknown columns or directions. ### Response #### Success Response (200) - **data** (array) - An array of group objects. - **unique_id** (string) - The unique identifier for the group. - **name** (string) - The name of the group. - **owner_name** (string) - The name of the group owner. - **owner_email** (string) - The email address of the group owner. - **owner_github** (string | null) - The GitHub handle of the group owner. - **owner_slack** (string | null) - The Slack handle of the group owner. - **model_count** (integer) - The number of models associated with this group. - **page_info** (object) - Pagination information. - **total_count** (integer) - The total number of groups available. - **start_cursor** (string) - The cursor for the start of the current page. - **end_cursor** (string) - The cursor for the end of the current page. - **has_next_page** (boolean) - Indicates if there is a next page of results. ### Request Example ```json { "example": "request body" } ``` ### Response Example ```json { "data": [ { "unique_id": "group.jaffle_shop.finance", "name": "finance", "owner_name": "Finance Data Team", "owner_email": "finance-data@jaffle.example", "owner_github": "jaffle/finance-data-team", "owner_slack": "#finance-data", "model_count": 12 }, { "unique_id": "group.jaffle_shop.marketing", "name": "marketing", "owner_name": "Marketing Analytics", "owner_email": "marketing-data@jaffle.example", "owner_github": null, "owner_slack": null, "model_count": 5 } ], "page_info": { "total_count": 42, "start_cursor": "eyJzIjoiPHN0YXJ0X3NvcnRfdmFsdWU+IiwiaSI6Ijx1bmlxdWVfaWQ+In0", "end_cursor": "eyJzIjoiPHNvcnRfdmFsdWU+IiwiaSI6Ijx1bmlxdWVfaWQ+In0", "has_next_page": false } } ``` ``` -------------------------------- ### Build ADBC Go Drivers Source: https://github.com/dbt-labs/dbt-core/blob/main/crates/dbt-adbc/README.md Clone the dbt-labs fork of apache/arrow-adbc, navigate to the driver's source directory, and build it using Go commands. Use 'make' for platform-specific library builds. ```bash git clone git@github.com:dbt-labs/arrow-adbc.git cd arrow-adbc cd go/adbc/driver/bigquery # source directory go build -v ./... # build go cd go/adbc/pkg # build directory for all Go drivers make clean || make libadbc_driver_bigquery.dylib ```