The fal profile configuration needs the
db_profile property set to the profile configuring your database for SQL models.
fal will wrap around adapter and just handle Python models while letting all the SQL needs to the underlying database adapter.
fal will inherit the
threads configuration from the
db_profile unless explicitly specified.
db_profile: dev_pg # This points to your main adapter
fal_environment model configuration
By creating a
fal_project.yml in the same location as your
dbt_project.yml and adding environment definitions in there:
- name: clustering
- name: predict
You can now reference any of these environments in your dbt Python models:
def model(dbt, fal):
import pandas as pd
# kmodes is available because of the `fal_environment` being used
from kmodes.kmodes import KModes
df: pd.DataFrame = dbt.ref("order_detailed")
df_train = df[["size", "is_vegan", "is_vegetarian", "is_keto", "shape"]]
km_2 = KModes(n_clusters=3, init="Huang")
df["cluster_label"] = km_2.labels_