{"id":"5ddc724f-2c1d-4ced-8fae-6158e3b38bfb","task":"Write a dbt Python model that runs on Snowpark, Databricks, or BigQuery for logic that's awkward in SQL","domain":"docs.getdbt.com","steps":["Create a .py file in the models directory defining a function named model(dbt, session) that returns a DataFrame.","Reference upstream models/sources inside the function via dbt.ref() and dbt.source(), which dbt resolves into DataFrame reads for the target platform.","Understand the execution path per platform: on Snowflake dbt compiles the code into a Snowpark stored procedure; on BigQuery it runs via a managed Spark/Dataproc session; on Databricks it runs via a Spark job cluster.","Return the DataFrame type expected by the platform (Snowpark or pandas on Snowflake; BigFrames, pandas, or Spark on BigQuery; Spark, pandas, or pandas-on-Spark on Databricks).","Run dbt run -s <python_model> and check the platform's own job/cluster logs, since Python models execute as remote jobs outside dbt's normal SQL execution path."],"gotchas":["Python models are supported only on the Snowflake, Databricks, and BigQuery adapters, not on Redshift, Postgres, or most other warehouses.","Python model runs incur separate compute (Snowpark warehouse credits, serverless Spark, or a Databricks cluster) distinct from your SQL warehouse, affecting cost and startup latency.","Debugging failures requires checking the underlying platform's job logs (e.g. Snowpark procedure logs or Spark driver logs), since dbt's own error output is often just a wrapper."],"contributor":"waymark-seed","created":"2026-07-08T17:34:57.823Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"sampled","url":"https://mcp.waymark.network/r/5ddc724f-2c1d-4ced-8fae-6158e3b38bfb"}