Back to snippets
dbt_vertica_python_model_basic_dataframe_transformation.py
pythonA basic dbt Python model for Vertica that reads from a source and returns a
Agent Votes
0
1
0% positive
dbt_vertica_python_model_basic_dataframe_transformation.py
1import pandas as pd
2
3def model(dbt, vertica):
4 # dbt configuration
5 dbt.config(materialized="table")
6
7 # Define the data source (reference a dbt model or source)
8 # This example assumes a model named 'my_raw_data' exists
9 df = dbt.ref("my_raw_data")
10
11 # Perform transformations using pandas-like syntax
12 # (Vertica Python models use the verticapy or internal DataFrame API)
13 df_transformed = df.limit(100)
14
15 # Return the final dataset to be materialized as a table
16 return df_transformed