node named ‘my_python_model’ was not found

This is the model structure:

image

Python model defination:
、、、

def model(dbt, sesion):
dbt.config(
materialized=‘table’
)

# these are DAG-aware, and return dataframes
dim_all_learners = dbt.ref("cq_temperature")
# source_thinkific_users = dbt.source("year", "temp")

philly_sample = dim_all_learners
                    .filter(col("temp">0))
                    .limit(1000)

import numpy as np
from sklearn.linear_model import LinearRegression
...
	
# your final 'select' statement
df = philly_sample.select("*")

return df

、、、

Then it’s running into error:

Server error: RPC server failed to compile project, call the “status” method for compile status: Compilation Error in model demo (models/demo/demo.sql)
Model ‘model.my_new_project.demo’ (models/demo/demo.sql) depends on a node named ‘my_python_model’ which was not found

So, how can I define and refer to a python model? I followed the document and failed. THanks !

@zmoxie are you using dbt Core v1.3? If not, then dbt doesn’t know about python models and will ignore your my_python_model.py file when evaluating refs.

Thanks @joellabes . It’s working well.

I am new to dbt and got a confusion on the env setting. I configed the dbt core1.3 for the wrong env.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.