🐍 Python has a more mature and robust ecosystem for formatting and linting (helped by the fact that it doesn't have a million distinct dialects). We recommend using those tools to format and lint your code in the style you prefer.
🛠️ Our current recommendations areinfo
☁️ dbt Cloud comes with the black formatter built-in to automatically lint and format their SQL. You don't need to download or configure anything, just click
Formatin a Python model and you're good to go!
import pandas as pd
def model(dbt, session):
# set length of time considered a churn
dbt.config(enabled=False, materialized="table", packages=["pandas==1.5.2"])
orders_relation = dbt.ref("stg_orders")
# converting a DuckDB Python Relation into a pandas DataFrame
orders_df = orders_relation.df()
orders_df["previous_order_at"] = orders_df.groupby("customer_id")[
orders_df["next_order_at"] = orders_df.groupby("customer_id")["ordered_at"].shift(