fal configurations
The dbt-fal
adapter is no longer actively maintained. This means although the adapter is still operational, there is no further development or bug fixes planned and it may not be compatible with future versions of dbt. dbt-fal
was test until dbt v1.5.
Documentation for dbt-fal
are kept for reference purposes only and will eventually be removed from the site in the future.
Setting the db_profile
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.
Example:
jaffle_shop:
target: dev_with_fal
outputs:
dev_with_fal:
type: fal
db_profile: dev_pg # This points to your main adapter
dev_pg:
type: postgres
...
Using 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:
environments:
- name: clustering
type: conda
packages:
- kmodes==0.12.2
- name: predict
type: venv
requirements:
- prophet
You can now reference any of these environments in your dbt Python models:
def model(dbt, fal):
dbt.config({
"fal_environment": "clustering"
})
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")
km_2.fit_predict(df_train)
df["cluster_label"] = km_2.labels_
return df