dbt-labs / dbt-snowflake

dbt-snowflake contains all of the code enabling dbt to work with Snowflake
https://getdbt.com
Apache License 2.0
296 stars 176 forks source link

Upgrade py38 objects in Snowflake #1203

Open colin-rogers-dbt opened 1 month ago

colin-rogers-dbt commented 1 month ago

We are reaching out because we have identified that your Snowflake account currently contains one or more objects using the Python 3.8 runtime. As Python 3.8 will reach its End-Of-Life (EOL) on October 14, 2024 [1], there will be no further bug fixes or security updates for this runtime.

As described in the Python runtime support policy [2], the end of support for language runtimes happens in two stages.

  1. Stage One: Starting October 14, 2024, Snowflake will no longer apply security patches or other updates to the Python 3.8 runtime, and objects using the Python 3.8 runtime will no longer be eligible for technical support.
  2. Stage Two: Starting March 31, 2025, you will no longer be able to create new objects using Python 3.8.

We recommend that you upgrade your existing Python 3.8 objects to Python 3.9 or greater before March 31, 2025. Please note that end of support does not impact execution, and you will still be able to update and invoke existing objects. However, they will be running on an unsupported runtime which will no longer be maintained or patched by the Snowflake team. For Streamlit in Snowflake (SiS), support for higher Python versions will be made available as part of BCR 2024_08.

The following command lists all objects using Python 3.8. To find all such objects in your account, repeat this command for each database:

-- To get a list of databases
SELECT * FROM information_schema.databases;

-- To get all Python 3.8 UDx of a database
SELECT
    function_catalog,
    function_schema,
    function_name,
    function_owner,
    argument_signature,
    function_definition
FROM <database_name>.information_schema.functions
WHERE runtime_version = '3.8';

-- To get all Python 3.8 Procedures
SET db=<database_name>;

WITH ddl_data AS (
    SELECT
        SPLIT(UPPER(ddl_string),
        'CREATE OR REPLACE') AS ddl_parts
    FROM (
        SELECT
            GET_DDL('DATABASE', $db, true) AS ddl_string
    ) gd
),
sp_ddl AS (
    SELECT
        'CREATE OR REPLACE ' \|\| TRIM(value) AS sp
    FROM ddl_data,
    LATERAL FLATTEN(input => ddl_parts)
    WHERE TRIM(value) != ''
      AND STARTSWITH (sp, 'CREATE OR REPLACE PROCEDURE')
)

SELECT
    REGEXP_SUBSTR(sp, 'PROCEDURE\\s+([A-Z0-9_.]+)', 1, 1, 'i', 1) AS name,
    REGEXP_SUBSTR(sp, 'RUNTIME_VERSION\\s*=\\s*\'([0-9.]+)\'', 1, 1, 'e', 1) AS runtime_version,
    REGEXP_SUBSTR(sp, 'LANGUAGE\\s+([A-Z]+)', 1, 1, 'e', 1) AS language, sp FROM sp_ddl
WHERE REGEXP_SUBSTR(sp, 'LANGUAGE\\s+([A-Z]+)', 1, 1, 'e', 1) = 'PYTHON';

If you have any concerns or require further assistance, please contact Snowflake Support [3].

[1] Status of Python versions

[2] Snowflake Python Runtime Support

[3] Snowflake Support

jtcohen6 commented 2 weeks ago

I'm not sure if it's the same issue, we are setting Python 3.8 as the default for all dbt Python models (running on Snowpark) if users do not explicitly configure a python_version for their models: https://github.com/dbt-labs/dbt-snowflake/blob/efeb82b087c95662a590ecf96e2c8cdf62cf68ed/dbt/adapters/snowflake/impl.py#L339

Given py38 EOL, we should probably update that to 3.9

mikealfare commented 2 weeks ago

Oof, good catch. I imagine we want to backport this to supported versions as well?