The problem I’m having
I am using a Python Model that is run via a dbt Core run command via command line inside a Airflow DAG. Airflow environment is set to default to Python 3.11 however when the model is compiled to a stored procedure in Snowflake its runtime is set to Python 3.8 so it fails as 3.8 is deprecated in Snowflake. I am using dbt-core 1.5.1 and dbt-snowflake 1.5.2
The context of why I’m trying to do this
To deploy a Python model to Snowflake
What I’ve already tried
Checked the worker environment to see the version of Python
Some example code or error messages
[2025-07-02, 15:32:03 UTC] {subprocess.py:93} INFO - e[0m15:32:03 File "/usr/lib/python_udf/420adbb1758814c9ace7e62d75605c09856a90d79cedb258e067f56489192c90/lib/python3.8/site-packages/snowflake/connector/errors.py", line 287, in hand_to_other_handler
[2025-07-02, 15:32:03 UTC] {subprocess.py:93} INFO - e[0m15:32:03 cursor.errorhandler(connection, cursor, error_class, error_value)
[2025-07-02, 15:32:03 UTC] {subprocess.py:93} INFO - e[0m15:32:03 File "/usr/lib/python_udf/420adbb1758814c9ace7e62d75605c09856a90d79cedb258e067f56489192c90/lib/python3.8/site-packages/snowflake/connector/errors.py", line 165, in default_errorhandler
[2025-07-02, 15:32:03 UTC] {subprocess.py:93} INFO - e[0m15:32:03 raise error_class(
[2025-07-02, 15:32:03 UTC] {subprocess.py:93} INFO - e[0m15:32:03 snowflake.snowpark.exceptions.SnowparkSQLException: (1304): 01bd6c04-030d-e072-0057-c90705bd66de: 391569 (22023): 01bd6c04-030d-e072-0057-c90705bd66de: SQL compilation error: Python runtime version 3.8 is decommissioned. Please update your code to Python runtime version 3.9 or later
Put code inside backticks
to preserve indentation
which is especially important
for Python and YAML!