def model(dbt,session):
dbt.config(materialized=“table”)
df=dbt.ref(“model_json”)
print(f"Got dbt:{df}")
return df
help please
Note: @kvch771234
originally posted this reply in Slack. It might not have transferred perfectly.
Hi <@U055N498TAN>, python models don’t support print
unfortunately, because the processing is all done inside of the data warehouse and isn’t exposed to dbt.
Note: @joellabes (dbt Labs)
originally posted this reply in Slack. It might not have transferred perfectly.
okay <@UTBSZ3ZC0> then how can i check my results after writing code?
Note: @kvch771234
originally posted this reply in Slack. It might not have transferred perfectly.
Which warehouse are you using? If it’s Databricks/Spark then you can check the job’s logs on its side for example. For others, I don’t know whether they have an equivalent behaviour offhand. I can’t find the issue right now, but we are also considering adding some way to print to dbt from inside of a Python model.
<@UTBSZ3ZC0> right now im using snowflake
Note: @kvch771234
originally posted this reply in Slack. It might not have transferred perfectly.
This is currently in limited access from Snowflake: Logging Messages from Stored Procedures, UDFs, and UDTFs | Snowflake Documentation
You may want to reach out to your Snowflake rep and ask if it can be enabled for your account
Realize this is late but had to share since its still basically the same status. I’ve been using:
if variable == whatever:
raise Exception (“error occured here {}”.format(variableInQuestion))
yeah, halts execution but at least you can inspect the code variables and iterate from there. Hope this helps. Exceptions will print to console.