Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-740868: snowpark-python and snowflake-sqlalchemy packages are not compatible #673

Closed
ndamclean opened this issue Feb 8, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@ndamclean
Copy link

ndamclean commented Feb 8, 2023

(also created an issue in the snowflake-sqlalchemy github: snowflakedb/snowflake-sqlalchemy#383)

  1. What version of Python are you using?
Python 3.8.13
  1. What operating system and processor architecture are you using?
Linux-5.15.0-58-generic-x86_64-with-glibc2.35
  1. What are the component versions in the environment (pip freeze)?

snowflake packages

snowflake-connector-python==2.9.0
snowflake-snowpark-python==1.1.0
snowflake-sqlalchemy==1.4.4

full outuput

asn1crypto==1.5.1
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==2.1.1
cloudpickle==2.0.0
cryptography==38.0.4
filelock==3.9.0
greenlet==2.0.2
idna==3.4
numpy==1.24.2
oscrypto==1.3.0
pandas==1.5.3
pyarrow==8.0.0
pycparser==2.21
pycryptodomex==3.17
PyJWT==2.6.0
pyOpenSSL==22.1.0
python-dateutil==2.8.2
pytz==2022.7.1
requests==2.28.2
six==1.16.0
snowflake-connector-python==2.9.0
snowflake-snowpark-python==1.1.0
snowflake-sqlalchemy==1.4.4
SQLAlchemy==1.4.46
typing_extensions==4.4.0
urllib3==1.26.14
  1. What did you do?

Run the following python script that uses snowflake SQLAlchemy and SnowPark.
(note environment variables used for snowsql are used to configure the Snowflake connection)

import json
import logging
import os
import uuid
from urllib.parse import urlunsplit, urlencode

import sqlalchemy as sa
from snowflake.snowpark.session import Session


for logger_name in ['snowflake.sqlalchemy', 'snowflake.connector']:
    logger = logging.getLogger(logger_name)
    logger.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    ch.setLevel(logging.DEBUG)
    ch.setFormatter(logging.Formatter('%(asctime)s - %(threadName)s %(filename)s:%(lineno)d - %(funcName)s() - %(levelname)s - %(message)s'))
    logger.addHandler(ch)


def get_snowflake_env_vars():
    try:
        account = os.environ["SNOWSQL_ACCOUNT"]
        user = os.environ["SNOWSQL_USER"]
        password = os.environ["SNOWSQL_PWD"]
        database = os.environ["SNOWSQL_DB"]
        schema = os.environ["SNOWSQL_SCHEMA"]
    except KeyError as err:
        # pylint: disable=raise-missing-from
        raise RuntimeError(f"Missing Snowflake environment variable: {err.args[0]}")

    # Optional env vars (may use default)
    role = os.environ.get("SNOWSQL_ROLE")
    warehouse = os.environ.get("SNOWSQL_WAREHOUSE")

    sf_env = {
        "account": account,
        "user": user,
        "password": password,
        "database": database,
        "role": role,
        "warehouse": warehouse,
        "schema": schema,
    }
    return {k: v for k, v in sf_env.items() if v is not None}


def init_db_engine(**create_engine_kwargs) -> sa.engine.Engine:
    """Initialize a database engine."""
    sf_env = get_snowflake_env_vars()
    sqlalchemy_url = urlunsplit(
        (
            "snowflake",  # scheme
            f'{sf_env["user"]}:{sf_env["password"]}@{sf_env["account"]}',  # netloc
            f'/{sf_env["database"]}/{sf_env["schema"]}',  # path
            urlencode({"warehouse": sf_env["warehouse"], "role": sf_env["role"]}),  # query string
            "",  # fragment
        )
    )
    return sa.create_engine(sqlalchemy_url, **create_engine_kwargs)


def get_snowpark_session():
    """Get a SnowPark client session instance."""
    sf_env = get_snowflake_env_vars()
    return Session.builder.configs(sf_env).create()


db_engine = init_db_engine()
snowpark_session = get_snowpark_session()

stmt1 = sa.sql.text("CREATE OR REPLACE SEQUENCE test_seq")
stmt2 = sa.sql.text(
    """
    CREATE OR REPLACE TABLE test_table (
        id INT NOT NULL DEFAULT test_seq.NEXTVAL,
        uid TEXT NOT NULL,
        name TEXT NOT NULL,
        inputs OBJECT,
        meta OBJECT,
        targets ARRAY
    )
    """
)
with db_engine.connect() as conn:
    conn.execute(stmt1)
    conn.execute(stmt2)

tbl = snowpark_session.table("test_table").select("id", "uid", "name", "inputs", "meta", "targets")
tbl.show()

stmt3 = sa.sql.text(
    """
    MERGE INTO test_table USING (
            SELECT
                :uid uid,
                :name name,
                parse_json(:inputs) inputs,
                parse_json(:meta) meta,
                NULLIF(ARRAY_CONSTRUCT(:targets), ARRAY_CONSTRUCT(NULL)) targets
        ) upsert_row
        ON
            test_table.uid = upsert_row.uid
        WHEN MATCHED THEN UPDATE SET
            test_table.name = upsert_row.name,
            test_table.inputs = upsert_row.inputs,
            test_table.meta = upsert_row.meta,
            test_table.targets = upsert_row.targets
        WHEN NOT MATCHED THEN INSERT
            (uid, name, inputs, meta, targets)
        VALUES (
            :uid,
            :name,
            parse_json(:inputs),
            parse_json(:meta),
            NULLIF(ARRAY_CONSTRUCT(:targets), ARRAY_CONSTRUCT(NULL))
        )
    """
)
with db_engine.connect() as conn:
    conn.execute(
        stmt3,
        uid=str(uuid.uuid4()),
        name="foo",
        inputs=json.dumps({"a": 1, "b": 2}),
        meta=json.dumps({"x": 1}),
        targets=["x"],
    )
    conn.execute(
        stmt3,
        uid=str(uuid.uuid4()),
        name="bar",
        inputs=json.dumps({"a": 1}),
        meta=json.dumps({"y": 2}),
        targets=None,
    )
    conn.execute(
        stmt3,
        uid=str(uuid.uuid4()),
        name="foo",
        inputs=json.dumps({"a": 1, "b": 2, "c": 3}),
        meta=json.dumps({"x": 1, "y": 2}),
        targets=["x", "y"],
    )
    
tbl.show()

with db_engine.connect() as conn:
    ret = conn.execute("SELECT * FROM test_table")
    print(ret.cursor.fetch_pandas_all())
  1. What did you expect to see?
    Program to run and exit without an error.

  2. Can you set logging to DEBUG and collect the logs?

Using python3.8 (3.8.13)
2023-02-10 15:56:03,096 - MainThread connection.py:280 - __init__() - INFO - Snowflake Connector for Python Version: 2.9.0, Python Version: 3.8.13, Platform: Linux-5.15.0-60-generic-x86_64-with-glibc2.35
2023-02-10 15:56:03,096 - MainThread connection.py:536 - connect() - DEBUG - connect
2023-02-10 15:56:03,096 - MainThread connection.py:832 - __config() - DEBUG - __config
2023-02-10 15:56:03,096 - MainThread connection.py:965 - __config() - INFO - This connection is in OCSP Fail Open Mode. TLS Certificates would be checked for validity and revocation status. Any other Certificate Revocation related exceptions or OCSP Responder failures would be disregarded in favor of connectivity.
2023-02-10 15:56:03,096 - MainThread connection.py:983 - __config() - INFO - Setting use_openssl_only mode to False
2023-02-10 15:56:03,096 - MainThread converter.py:145 - __init__() - DEBUG - use_numpy: False
2023-02-10 15:56:03,096 - MainThread connection.py:729 - __open_connection() - DEBUG - REST API object was created: jbulliw-main.snowflakecomputing.com:443
2023-02-10 15:56:03,097 - MainThread _auth.py:171 - authenticate() - DEBUG - authenticate
2023-02-10 15:56:03,097 - MainThread _auth.py:201 - authenticate() - DEBUG - assertion content: *********
2023-02-10 15:56:03,097 - MainThread _auth.py:204 - authenticate() - DEBUG - account=jbulliw-main, user=nmclean, database=RESILIENCE_DATA_ENG_NMCLEAN, schema=V1, warehouse=RESILIENCE_DATA_ENG_DEV_XS, role=ENGINEERING_DEV, request_id=a1468797-d13a-4667-890b-b1b95cfa2e0d
2023-02-10 15:56:03,097 - MainThread _auth.py:237 - authenticate() - DEBUG - body['data']: {'CLIENT_APP_ID': 'PythonSnowpark', 'CLIENT_APP_VERSION': '1.1.0', 'SVN_REVISION': None, 'ACCOUNT_NAME': 'jbulliw-main', 'LOGIN_NAME': 'nmclean', 'CLIENT_ENVIRONMENT': {'APPLICATION': 'PythonSnowpark', 'OS': 'Linux', 'OS_VERSION': 'Linux-5.15.0-60-generic-x86_64-with-glibc2.35', 'PYTHON_VERSION': '3.8.13', 'PYTHON_RUNTIME': 'CPython', 'PYTHON_COMPILER': 'GCC 11.2.0', 'OCSP_MODE': 'FAIL_OPEN', 'TRACING': 10, 'LOGIN_TIMEOUT': 120, 'NETWORK_TIMEOUT': None}, 'SESSION_PARAMETERS': {'CLIENT_PREFETCH_THREADS': 4}}
2023-02-10 15:56:03,097 - MainThread _auth.py:247 - authenticate() - DEBUG - Timeout set to 120
2023-02-10 15:56:03,097 - MainThread retry.py:351 - from_int() - DEBUG - Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
2023-02-10 15:56:03,097 - MainThread retry.py:351 - from_int() - DEBUG - Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
2023-02-10 15:56:03,097 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:03,097 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: 120, retry cnt: 1
2023-02-10 15:56:03,097 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: 35e911bb-8c2b-471d-bd90-ced1b6a29364
2023-02-10 15:56:03,097 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:03,098 - MainThread connectionpool.py:1003 - _new_conn() - DEBUG - Starting new HTTPS connection (1): jbulliw-main.snowflakecomputing.com:443
2023-02-10 15:56:03,389 - MainThread ocsp_snowflake.py:485 - reset_cache_dir() - DEBUG - cache directory: /home/nmclean/.cache/snowflake
2023-02-10 15:56:03,427 - MainThread ssl_wrap_socket.py:80 - ssl_wrap_socket_with_ocsp() - DEBUG - OCSP Mode: FAIL_OPEN, OCSP response cache file name: None
2023-02-10 15:56:03,427 - MainThread ocsp_snowflake.py:523 - reset_ocsp_response_cache_uri() - DEBUG - ocsp_response_cache_uri: file:///home/nmclean/.cache/snowflake/ocsp_response_cache.json
2023-02-10 15:56:03,427 - MainThread ocsp_snowflake.py:526 - reset_ocsp_response_cache_uri() - DEBUG - OCSP_VALIDATION_CACHE size: 210
2023-02-10 15:56:03,427 - MainThread ocsp_snowflake.py:333 - reset_ocsp_dynamic_cache_server_url() - DEBUG - OCSP response cache server is enabled: http://ocsp.snowflakecomputing.com/ocsp_response_cache.json
2023-02-10 15:56:03,427 - MainThread ocsp_snowflake.py:346 - reset_ocsp_dynamic_cache_server_url() - DEBUG - OCSP dynamic cache server RETRY URL: None
2023-02-10 15:56:03,427 - MainThread ocsp_snowflake.py:956 - validate() - DEBUG - validating certificate: jbulliw-main.snowflakecomputing.com
2023-02-10 15:56:03,428 - MainThread ocsp_asn1crypto.py:427 - extract_certificate_chain() - DEBUG - # of certificates: 3
2023-02-10 15:56:03,428 - MainThread ocsp_asn1crypto.py:432 - extract_certificate_chain() - DEBUG - subject: OrderedDict([('country_name', 'US'), ('state_or_province_name', 'California'), ('locality_name', 'San Mateo'), ('organization_name', 'Snowflake Inc.'), ('common_name', '*.us-central1.gcp.snowflakecomputing.com')]), issuer: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('common_name', 'DigiCert TLS RSA SHA256 2020 CA1')])
2023-02-10 15:56:03,428 - MainThread ocsp_asn1crypto.py:432 - extract_certificate_chain() - DEBUG - subject: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('common_name', 'DigiCert TLS RSA SHA256 2020 CA1')]), issuer: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('organizational_unit_name', 'www.digicert.com'), ('common_name', 'DigiCert Global Root CA')])
2023-02-10 15:56:03,429 - MainThread ocsp_asn1crypto.py:432 - extract_certificate_chain() - DEBUG - subject: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('organizational_unit_name', 'www.digicert.com'), ('common_name', 'DigiCert Global Root CA')]), issuer: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('organizational_unit_name', 'www.digicert.com'), ('common_name', 'DigiCert Global Root CA')])
2023-02-10 15:56:03,430 - MainThread ocsp_snowflake.py:722 - find_cache() - DEBUG - hit cache for subject: OrderedDict([('country_name', 'US'), ('state_or_province_name', 'California'), ('locality_name', 'San Mateo'), ('organization_name', 'Snowflake Inc.'), ('common_name', '*.us-central1.gcp.snowflakecomputing.com')])
2023-02-10 15:56:03,431 - MainThread ocsp_snowflake.py:722 - find_cache() - DEBUG - hit cache for subject: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('common_name', 'DigiCert TLS RSA SHA256 2020 CA1')])
2023-02-10 15:56:03,431 - MainThread ocsp_snowflake.py:1013 - _validate() - DEBUG - ok
2023-02-10 15:56:03,869 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /session/v1/login-request?request_id=a1468797-d13a-4667-890b-b1b95cfa2e0d&databaseName=RESILIENCE_DATA_ENG_NMCLEAN&schemaName=V1&warehouse=RESILIENCE_DATA_ENG_DEV_XS&roleName=ENGINEERING_DEV&request_guid=35e911bb-8c2b-471d-bd90-ced1b6a29364 HTTP/1.1" 200 None
2023-02-10 15:56:03,871 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:03,871 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:03,871 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:03,871 - MainThread _auth.py:366 - authenticate() - DEBUG - completed authentication
2023-02-10 15:56:03,872 - MainThread _auth.py:413 - authenticate() - DEBUG - token = ******
2023-02-10 15:56:03,872 - MainThread _auth.py:416 - authenticate() - DEBUG - master_token = ******
2023-02-10 15:56:03,872 - MainThread _auth.py:420 - authenticate() - DEBUG - id_token = NULL
2023-02-10 15:56:03,872 - MainThread _auth.py:424 - authenticate() - DEBUG - mfa_token = NULL
2023-02-10 15:56:03,874 - MainThread connection.py:648 - cursor() - DEBUG - cursor
2023-02-10 15:56:03,875 - MainThread connection.py:280 - __init__() - INFO - Snowflake Connector for Python Version: 2.9.0, Python Version: 3.8.13, Platform: Linux-5.15.0-60-generic-x86_64-with-glibc2.35
2023-02-10 15:56:03,875 - MainThread connection.py:536 - connect() - DEBUG - connect
2023-02-10 15:56:03,875 - MainThread connection.py:832 - __config() - DEBUG - __config
2023-02-10 15:56:03,875 - MainThread connection.py:965 - __config() - INFO - This connection is in OCSP Fail Open Mode. TLS Certificates would be checked for validity and revocation status. Any other Certificate Revocation related exceptions or OCSP Responder failures would be disregarded in favor of connectivity.
2023-02-10 15:56:03,875 - MainThread converter.py:145 - __init__() - DEBUG - use_numpy: False
2023-02-10 15:56:03,875 - MainThread connection.py:729 - __open_connection() - DEBUG - REST API object was created: jbulliw-main.snowflakecomputing.com:443
2023-02-10 15:56:03,875 - MainThread _auth.py:171 - authenticate() - DEBUG - authenticate
2023-02-10 15:56:03,875 - MainThread _auth.py:201 - authenticate() - DEBUG - assertion content: *********
2023-02-10 15:56:03,875 - MainThread _auth.py:204 - authenticate() - DEBUG - account=jbulliw-main, user=nmclean, database=RESILIENCE_DATA_ENG_NMCLEAN, schema=V1, warehouse=RESILIENCE_DATA_ENG_DEV_XS, role=ENGINEERING_DEV, request_id=d9a393d2-3ca9-450d-b8ac-4e385d3c1235
2023-02-10 15:56:03,875 - MainThread _auth.py:237 - authenticate() - DEBUG - body['data']: {'CLIENT_APP_ID': 'PythonConnector', 'CLIENT_APP_VERSION': '2.9.0', 'SVN_REVISION': None, 'ACCOUNT_NAME': 'jbulliw-main', 'LOGIN_NAME': 'nmclean', 'CLIENT_ENVIRONMENT': {'APPLICATION': 'PythonConnector', 'OS': 'Linux', 'OS_VERSION': 'Linux-5.15.0-60-generic-x86_64-with-glibc2.35', 'PYTHON_VERSION': '3.8.13', 'PYTHON_RUNTIME': 'CPython', 'PYTHON_COMPILER': 'GCC 11.2.0', 'OCSP_MODE': 'FAIL_OPEN', 'TRACING': 10, 'LOGIN_TIMEOUT': 120, 'NETWORK_TIMEOUT': None}, 'SESSION_PARAMETERS': {'AUTOCOMMIT': False, 'CLIENT_PREFETCH_THREADS': 4}}
2023-02-10 15:56:03,875 - MainThread _auth.py:247 - authenticate() - DEBUG - Timeout set to 120
2023-02-10 15:56:03,875 - MainThread retry.py:351 - from_int() - DEBUG - Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
2023-02-10 15:56:03,875 - MainThread retry.py:351 - from_int() - DEBUG - Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
2023-02-10 15:56:03,875 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:03,875 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: 120, retry cnt: 1
2023-02-10 15:56:03,875 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: f144dc8e-91c4-4cec-a063-6cec323e1b9a
2023-02-10 15:56:03,875 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:03,876 - MainThread connectionpool.py:1003 - _new_conn() - DEBUG - Starting new HTTPS connection (1): jbulliw-main.snowflakecomputing.com:443
2023-02-10 15:56:04,079 - MainThread ssl_wrap_socket.py:80 - ssl_wrap_socket_with_ocsp() - DEBUG - OCSP Mode: FAIL_OPEN, OCSP response cache file name: None
2023-02-10 15:56:04,079 - MainThread ocsp_snowflake.py:523 - reset_ocsp_response_cache_uri() - DEBUG - ocsp_response_cache_uri: file:///home/nmclean/.cache/snowflake/ocsp_response_cache.json
2023-02-10 15:56:04,079 - MainThread ocsp_snowflake.py:526 - reset_ocsp_response_cache_uri() - DEBUG - OCSP_VALIDATION_CACHE size: 210
2023-02-10 15:56:04,079 - MainThread ocsp_snowflake.py:333 - reset_ocsp_dynamic_cache_server_url() - DEBUG - OCSP response cache server is enabled: http://ocsp.snowflakecomputing.com/ocsp_response_cache.json
2023-02-10 15:56:04,080 - MainThread ocsp_snowflake.py:346 - reset_ocsp_dynamic_cache_server_url() - DEBUG - OCSP dynamic cache server RETRY URL: None
2023-02-10 15:56:04,080 - MainThread ocsp_snowflake.py:956 - validate() - DEBUG - validating certificate: jbulliw-main.snowflakecomputing.com
2023-02-10 15:56:04,080 - MainThread ocsp_asn1crypto.py:427 - extract_certificate_chain() - DEBUG - # of certificates: 3
2023-02-10 15:56:04,081 - MainThread ocsp_asn1crypto.py:432 - extract_certificate_chain() - DEBUG - subject: OrderedDict([('country_name', 'US'), ('state_or_province_name', 'California'), ('locality_name', 'San Mateo'), ('organization_name', 'Snowflake Inc.'), ('common_name', '*.us-central1.gcp.snowflakecomputing.com')]), issuer: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('common_name', 'DigiCert TLS RSA SHA256 2020 CA1')])
2023-02-10 15:56:04,082 - MainThread ocsp_asn1crypto.py:432 - extract_certificate_chain() - DEBUG - subject: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('common_name', 'DigiCert TLS RSA SHA256 2020 CA1')]), issuer: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('organizational_unit_name', 'www.digicert.com'), ('common_name', 'DigiCert Global Root CA')])
2023-02-10 15:56:04,083 - MainThread ocsp_asn1crypto.py:432 - extract_certificate_chain() - DEBUG - subject: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('organizational_unit_name', 'www.digicert.com'), ('common_name', 'DigiCert Global Root CA')]), issuer: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('organizational_unit_name', 'www.digicert.com'), ('common_name', 'DigiCert Global Root CA')])
2023-02-10 15:56:04,087 - MainThread ocsp_snowflake.py:722 - find_cache() - DEBUG - hit cache for subject: OrderedDict([('country_name', 'US'), ('state_or_province_name', 'California'), ('locality_name', 'San Mateo'), ('organization_name', 'Snowflake Inc.'), ('common_name', '*.us-central1.gcp.snowflakecomputing.com')])
2023-02-10 15:56:04,089 - MainThread ocsp_snowflake.py:722 - find_cache() - DEBUG - hit cache for subject: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('common_name', 'DigiCert TLS RSA SHA256 2020 CA1')])
2023-02-10 15:56:04,090 - MainThread ocsp_snowflake.py:1013 - _validate() - DEBUG - ok
2023-02-10 15:56:04,423 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /session/v1/login-request?request_id=d9a393d2-3ca9-450d-b8ac-4e385d3c1235&databaseName=RESILIENCE_DATA_ENG_NMCLEAN&schemaName=V1&warehouse=RESILIENCE_DATA_ENG_DEV_XS&roleName=ENGINEERING_DEV&request_guid=f144dc8e-91c4-4cec-a063-6cec323e1b9a HTTP/1.1" 200 None
2023-02-10 15:56:04,424 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:04,424 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:04,424 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:04,424 - MainThread _auth.py:366 - authenticate() - DEBUG - completed authentication
2023-02-10 15:56:04,424 - MainThread _auth.py:413 - authenticate() - DEBUG - token = ******
2023-02-10 15:56:04,424 - MainThread _auth.py:416 - authenticate() - DEBUG - master_token = ******
2023-02-10 15:56:04,425 - MainThread _auth.py:420 - authenticate() - DEBUG - id_token = NULL
2023-02-10 15:56:04,425 - MainThread _auth.py:424 - authenticate() - DEBUG - mfa_token = NULL
2023-02-10 15:56:04,426 - MainThread connection.py:648 - cursor() - DEBUG - cursor
2023-02-10 15:56:04,426 - MainThread cursor.py:662 - execute() - DEBUG - executing SQL/command
2023-02-10 15:56:04,427 - MainThread cursor.py:727 - execute() - INFO - query: [select current_database(), current_schema();]
2023-02-10 15:56:04,427 - MainThread connection.py:1334 - _next_sequence_counter() - DEBUG - sequence counter: 1
2023-02-10 15:56:04,427 - MainThread cursor.py:457 - _execute_helper() - DEBUG - Request id: 16b46520-caeb-4021-91db-6794cd7fca43
2023-02-10 15:56:04,427 - MainThread cursor.py:459 - _execute_helper() - DEBUG - running query [select current_database(), current_schema();]
2023-02-10 15:56:04,427 - MainThread cursor.py:466 - _execute_helper() - DEBUG - is_file_transfer: True
2023-02-10 15:56:04,427 - MainThread connection.py:1011 - cmd_query() - DEBUG - _cmd_query
2023-02-10 15:56:04,427 - MainThread connection.py:1034 - cmd_query() - DEBUG - sql=[select current_database(), current_schema();], sequence_id=[1], is_file_transfer=[False]
2023-02-10 15:56:04,427 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:04,427 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2023-02-10 15:56:04,427 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: a7479e1a-fb38-48d3-a317-4fbfae379764
2023-02-10 15:56:04,428 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:04,570 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=16b46520-caeb-4021-91db-6794cd7fca43&request_guid=a7479e1a-fb38-48d3-a317-4fbfae379764 HTTP/1.1" 200 None
2023-02-10 15:56:04,571 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:04,571 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:04,571 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:04,571 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01aa3f5c-0000-eea8-0001-777a03068aaa
2023-02-10 15:56:04,571 - MainThread cursor.py:734 - execute() - DEBUG - sfqid: 01aa3f5c-0000-eea8-0001-777a03068aaa
2023-02-10 15:56:04,572 - MainThread cursor.py:740 - execute() - INFO - query execution done
2023-02-10 15:56:04,572 - MainThread cursor.py:754 - execute() - DEBUG - SUCCESS
2023-02-10 15:56:04,572 - MainThread cursor.py:773 - execute() - DEBUG - PUT OR GET: False
2023-02-10 15:56:04,572 - MainThread cursor.py:864 - _init_result_and_meta() - DEBUG - Query result format: arrow
2023-02-10 15:56:04,572 - MainThread cursor.py:878 - _init_result_and_meta() - INFO - Number of results in first chunk: 1
2023-02-10 15:56:04,573 - MainThread arrow_iterator.cpython-38-x86_64-linux-gnu.so:0 - __cinit__() - DEBUG - Batches read: 1
2023-02-10 15:56:04,573 - MainThread CArrowIterator.cpp:16 - CArrowIterator() - DEBUG - Arrow BatchSize: 1
2023-02-10 15:56:04,573 - MainThread CArrowChunkIterator.cpp:50 - CArrowChunkIterator() - DEBUG - Arrow chunk info: batchCount 1, columnCount 2, use_numpy: 0
2023-02-10 15:56:04,573 - MainThread result_set.py:58 - result_set_iterator() - DEBUG - beginning to schedule result batch downloads
2023-02-10 15:56:04,574 - MainThread CArrowChunkIterator.cpp:74 - next() - DEBUG - Current batch index: 0, rows in current batch: 1
2023-02-10 15:56:04,574 - MainThread connection.py:648 - cursor() - DEBUG - cursor
2023-02-10 15:56:04,574 - MainThread cursor.py:662 - execute() - DEBUG - executing SQL/command
2023-02-10 15:56:04,574 - MainThread cursor.py:727 - execute() - INFO - query: [ROLLBACK]
2023-02-10 15:56:04,574 - MainThread connection.py:1334 - _next_sequence_counter() - DEBUG - sequence counter: 2
2023-02-10 15:56:04,574 - MainThread cursor.py:457 - _execute_helper() - DEBUG - Request id: 8993c60c-37b6-4a2d-9f28-5694a8e6867e
2023-02-10 15:56:04,574 - MainThread cursor.py:459 - _execute_helper() - DEBUG - running query [ROLLBACK]
2023-02-10 15:56:04,574 - MainThread cursor.py:466 - _execute_helper() - DEBUG - is_file_transfer: True
2023-02-10 15:56:04,574 - MainThread connection.py:1011 - cmd_query() - DEBUG - _cmd_query
2023-02-10 15:56:04,574 - MainThread connection.py:1034 - cmd_query() - DEBUG - sql=[ROLLBACK], sequence_id=[2], is_file_transfer=[False]
2023-02-10 15:56:04,575 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:04,575 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2023-02-10 15:56:04,575 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: c66aa823-e55e-407b-866e-1d16cc4d4400
2023-02-10 15:56:04,575 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:04,694 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=8993c60c-37b6-4a2d-9f28-5694a8e6867e&request_guid=c66aa823-e55e-407b-866e-1d16cc4d4400 HTTP/1.1" 200 None
2023-02-10 15:56:04,696 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:04,696 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:04,696 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:04,696 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01aa3f5c-0000-ee61-0001-777a03066cc2
2023-02-10 15:56:04,697 - MainThread cursor.py:734 - execute() - DEBUG - sfqid: 01aa3f5c-0000-ee61-0001-777a03066cc2
2023-02-10 15:56:04,697 - MainThread cursor.py:740 - execute() - INFO - query execution done
2023-02-10 15:56:04,697 - MainThread cursor.py:754 - execute() - DEBUG - SUCCESS
2023-02-10 15:56:04,697 - MainThread cursor.py:773 - execute() - DEBUG - PUT OR GET: False
2023-02-10 15:56:04,697 - MainThread cursor.py:864 - _init_result_and_meta() - DEBUG - Query result format: json
2023-02-10 15:56:04,697 - MainThread result_batch.py:440 - _parse() - DEBUG - parsing for result batch id: 1
2023-02-10 15:56:04,697 - MainThread cursor.py:878 - _init_result_and_meta() - INFO - Number of results in first chunk: 1
2023-02-10 15:56:04,698 - MainThread connection.py:648 - cursor() - DEBUG - cursor
2023-02-10 15:56:04,698 - MainThread cursor.py:662 - execute() - DEBUG - executing SQL/command
2023-02-10 15:56:04,698 - MainThread cursor.py:727 - execute() - INFO - query: [CREATE OR REPLACE SEQUENCE test_seq]
2023-02-10 15:56:04,698 - MainThread connection.py:1334 - _next_sequence_counter() - DEBUG - sequence counter: 3
2023-02-10 15:56:04,699 - MainThread cursor.py:457 - _execute_helper() - DEBUG - Request id: d91f7946-7f56-4dd0-a7c6-51d40be132a9
2023-02-10 15:56:04,699 - MainThread cursor.py:459 - _execute_helper() - DEBUG - running query [CREATE OR REPLACE SEQUENCE test_seq]
2023-02-10 15:56:04,699 - MainThread cursor.py:466 - _execute_helper() - DEBUG - is_file_transfer: True
2023-02-10 15:56:04,699 - MainThread connection.py:1011 - cmd_query() - DEBUG - _cmd_query
2023-02-10 15:56:04,699 - MainThread connection.py:1034 - cmd_query() - DEBUG - sql=[CREATE OR REPLACE SEQUENCE test_seq], sequence_id=[3], is_file_transfer=[False]
2023-02-10 15:56:04,699 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:04,699 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2023-02-10 15:56:04,699 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: d31ff1db-c0e8-418d-a67a-2b6a50809e3d
2023-02-10 15:56:04,699 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:04,880 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=d91f7946-7f56-4dd0-a7c6-51d40be132a9&request_guid=d31ff1db-c0e8-418d-a67a-2b6a50809e3d HTTP/1.1" 200 None
2023-02-10 15:56:04,881 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:04,882 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:04,882 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:04,882 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01aa3f5c-0000-eea8-0001-777a03068aae
2023-02-10 15:56:04,882 - MainThread cursor.py:734 - execute() - DEBUG - sfqid: 01aa3f5c-0000-eea8-0001-777a03068aae
2023-02-10 15:56:04,882 - MainThread cursor.py:740 - execute() - INFO - query execution done
2023-02-10 15:56:04,882 - MainThread cursor.py:754 - execute() - DEBUG - SUCCESS
2023-02-10 15:56:04,882 - MainThread cursor.py:773 - execute() - DEBUG - PUT OR GET: False
2023-02-10 15:56:04,882 - MainThread cursor.py:864 - _init_result_and_meta() - DEBUG - Query result format: json
2023-02-10 15:56:04,883 - MainThread result_batch.py:440 - _parse() - DEBUG - parsing for result batch id: 1
2023-02-10 15:56:04,883 - MainThread cursor.py:878 - _init_result_and_meta() - INFO - Number of results in first chunk: 1
2023-02-10 15:56:04,883 - MainThread connection.py:648 - cursor() - DEBUG - cursor
2023-02-10 15:56:04,883 - MainThread cursor.py:662 - execute() - DEBUG - executing SQL/command
2023-02-10 15:56:04,883 - MainThread cursor.py:727 - execute() - INFO - query: [CREATE OR REPLACE TABLE test_table ( id INT NOT NULL DEFAULT test_seq.NEXTVAL, u...]
2023-02-10 15:56:04,883 - MainThread connection.py:1334 - _next_sequence_counter() - DEBUG - sequence counter: 4
2023-02-10 15:56:04,884 - MainThread cursor.py:457 - _execute_helper() - DEBUG - Request id: b024446e-6a24-4bf2-bf04-c0c19d390b0f
2023-02-10 15:56:04,884 - MainThread cursor.py:459 - _execute_helper() - DEBUG - running query [CREATE OR REPLACE TABLE test_table ( id INT NOT NULL DEFAULT test_seq.NEXTVAL, u...]
2023-02-10 15:56:04,884 - MainThread cursor.py:466 - _execute_helper() - DEBUG - is_file_transfer: True
2023-02-10 15:56:04,884 - MainThread connection.py:1011 - cmd_query() - DEBUG - _cmd_query
2023-02-10 15:56:04,884 - MainThread connection.py:1034 - cmd_query() - DEBUG - sql=[CREATE OR REPLACE TABLE test_table ( id INT NOT NULL DEFAULT test_seq.NEXTVAL, u...], sequence_id=[4], is_file_transfer=[False]
2023-02-10 15:56:04,884 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:04,884 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2023-02-10 15:56:04,884 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: 05c99138-d0c3-4689-a365-3243d2862b31
2023-02-10 15:56:04,884 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:05,209 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=b024446e-6a24-4bf2-bf04-c0c19d390b0f&request_guid=05c99138-d0c3-4689-a365-3243d2862b31 HTTP/1.1" 200 None
2023-02-10 15:56:05,210 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:05,210 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:05,210 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:05,210 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01aa3f5c-0000-eea8-0001-777a03068ab2
2023-02-10 15:56:05,210 - MainThread cursor.py:734 - execute() - DEBUG - sfqid: 01aa3f5c-0000-eea8-0001-777a03068ab2
2023-02-10 15:56:05,210 - MainThread cursor.py:740 - execute() - INFO - query execution done
2023-02-10 15:56:05,211 - MainThread cursor.py:754 - execute() - DEBUG - SUCCESS
2023-02-10 15:56:05,211 - MainThread cursor.py:773 - execute() - DEBUG - PUT OR GET: False
2023-02-10 15:56:05,211 - MainThread cursor.py:864 - _init_result_and_meta() - DEBUG - Query result format: json
2023-02-10 15:56:05,211 - MainThread result_batch.py:440 - _parse() - DEBUG - parsing for result batch id: 1
2023-02-10 15:56:05,211 - MainThread cursor.py:878 - _init_result_and_meta() - INFO - Number of results in first chunk: 1
2023-02-10 15:56:05,211 - MainThread connection.py:648 - cursor() - DEBUG - cursor
2023-02-10 15:56:05,211 - MainThread cursor.py:662 - execute() - DEBUG - executing SQL/command
2023-02-10 15:56:05,211 - MainThread cursor.py:727 - execute() - INFO - query: [ROLLBACK]
2023-02-10 15:56:05,211 - MainThread connection.py:1334 - _next_sequence_counter() - DEBUG - sequence counter: 5
2023-02-10 15:56:05,212 - MainThread cursor.py:457 - _execute_helper() - DEBUG - Request id: 4637770d-44c6-4680-89b4-96f9494cf26d
2023-02-10 15:56:05,212 - MainThread cursor.py:459 - _execute_helper() - DEBUG - running query [ROLLBACK]
2023-02-10 15:56:05,212 - MainThread cursor.py:466 - _execute_helper() - DEBUG - is_file_transfer: True
2023-02-10 15:56:05,212 - MainThread connection.py:1011 - cmd_query() - DEBUG - _cmd_query
2023-02-10 15:56:05,212 - MainThread connection.py:1034 - cmd_query() - DEBUG - sql=[ROLLBACK], sequence_id=[5], is_file_transfer=[False]
2023-02-10 15:56:05,212 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:05,212 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2023-02-10 15:56:05,212 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: 20b86941-8b33-4e2c-baed-f664734bca35
2023-02-10 15:56:05,212 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:05,339 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=4637770d-44c6-4680-89b4-96f9494cf26d&request_guid=20b86941-8b33-4e2c-baed-f664734bca35 HTTP/1.1" 200 None
2023-02-10 15:56:05,340 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:05,341 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:05,341 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:05,341 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01aa3f5c-0000-ee39-0001-777a03067afa
2023-02-10 15:56:05,341 - MainThread cursor.py:734 - execute() - DEBUG - sfqid: 01aa3f5c-0000-ee39-0001-777a03067afa
2023-02-10 15:56:05,341 - MainThread cursor.py:740 - execute() - INFO - query execution done
2023-02-10 15:56:05,341 - MainThread cursor.py:754 - execute() - DEBUG - SUCCESS
2023-02-10 15:56:05,341 - MainThread cursor.py:773 - execute() - DEBUG - PUT OR GET: False
2023-02-10 15:56:05,341 - MainThread cursor.py:864 - _init_result_and_meta() - DEBUG - Query result format: json
2023-02-10 15:56:05,342 - MainThread result_batch.py:440 - _parse() - DEBUG - parsing for result batch id: 1
2023-02-10 15:56:05,342 - MainThread cursor.py:878 - _init_result_and_meta() - INFO - Number of results in first chunk: 1
2023-02-10 15:56:05,343 - MainThread cursor.py:662 - execute() - DEBUG - executing SQL/command
2023-02-10 15:56:05,343 - MainThread cursor.py:727 - execute() - INFO - query: [SELECT  *  FROM test_table]
2023-02-10 15:56:05,343 - MainThread connection.py:1334 - _next_sequence_counter() - DEBUG - sequence counter: 1
2023-02-10 15:56:05,343 - MainThread cursor.py:457 - _execute_helper() - DEBUG - Request id: b5c45fe6-a04d-45ed-9cba-c4947a18d18e
2023-02-10 15:56:05,343 - MainThread cursor.py:459 - _execute_helper() - DEBUG - running query [SELECT  *  FROM test_table]
2023-02-10 15:56:05,343 - MainThread cursor.py:466 - _execute_helper() - DEBUG - is_file_transfer: True
2023-02-10 15:56:05,343 - MainThread connection.py:1011 - cmd_query() - DEBUG - _cmd_query
2023-02-10 15:56:05,343 - MainThread connection.py:1034 - cmd_query() - DEBUG - sql=[SELECT  *  FROM test_table], sequence_id=[1], is_file_transfer=[False]
2023-02-10 15:56:05,343 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:05,344 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2023-02-10 15:56:05,344 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: 580a57b3-ae6d-4fab-9378-f2f7478cf0c1
2023-02-10 15:56:05,344 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:05,535 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=b5c45fe6-a04d-45ed-9cba-c4947a18d18e&request_guid=580a57b3-ae6d-4fab-9378-f2f7478cf0c1 HTTP/1.1" 200 None
2023-02-10 15:56:05,537 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:05,537 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:05,537 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:05,537 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01aa3f5c-0000-eea8-0001-777a03068ab6
2023-02-10 15:56:05,538 - MainThread cursor.py:734 - execute() - DEBUG - sfqid: 01aa3f5c-0000-eea8-0001-777a03068ab6
2023-02-10 15:56:05,538 - MainThread cursor.py:740 - execute() - INFO - query execution done
2023-02-10 15:56:05,538 - MainThread cursor.py:754 - execute() - DEBUG - SUCCESS
2023-02-10 15:56:05,538 - MainThread cursor.py:773 - execute() - DEBUG - PUT OR GET: False
2023-02-10 15:56:05,538 - MainThread cursor.py:864 - _init_result_and_meta() - DEBUG - Query result format: arrow
2023-02-10 15:56:05,538 - MainThread cursor.py:878 - _init_result_and_meta() - INFO - Number of results in first chunk: 0
2023-02-10 15:56:05,541 - MainThread cursor.py:662 - execute() - DEBUG - executing SQL/command
2023-02-10 15:56:05,542 - MainThread cursor.py:727 - execute() - INFO - query: [SELECT "ID", "UID", "NAME", "INPUTS", "META", "TARGETS" FROM test_table LIMIT 10...]
2023-02-10 15:56:05,542 - MainThread connection.py:1334 - _next_sequence_counter() - DEBUG - sequence counter: 2
2023-02-10 15:56:05,542 - MainThread cursor.py:457 - _execute_helper() - DEBUG - Request id: d1f4ff63-1c73-4349-a54a-56c45cc4fc79
2023-02-10 15:56:05,542 - MainThread cursor.py:459 - _execute_helper() - DEBUG - running query [SELECT "ID", "UID", "NAME", "INPUTS", "META", "TARGETS" FROM test_table LIMIT 10...]
2023-02-10 15:56:05,542 - MainThread cursor.py:466 - _execute_helper() - DEBUG - is_file_transfer: True
2023-02-10 15:56:05,542 - MainThread connection.py:1011 - cmd_query() - DEBUG - _cmd_query
2023-02-10 15:56:05,542 - MainThread connection.py:1034 - cmd_query() - DEBUG - sql=[SELECT "ID", "UID", "NAME", "INPUTS", "META", "TARGETS" FROM test_table LIMIT 10...], sequence_id=[2], is_file_transfer=[False]
2023-02-10 15:56:05,542 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:05,542 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2023-02-10 15:56:05,543 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: bcb57e68-c06b-4b17-856d-1bbfd5b5a699
2023-02-10 15:56:05,543 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:05,731 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=d1f4ff63-1c73-4349-a54a-56c45cc4fc79&request_guid=bcb57e68-c06b-4b17-856d-1bbfd5b5a699 HTTP/1.1" 200 None
2023-02-10 15:56:05,732 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:05,732 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:05,733 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:05,733 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01aa3f5c-0000-ee39-0001-777a03067afe
2023-02-10 15:56:05,733 - MainThread cursor.py:734 - execute() - DEBUG - sfqid: 01aa3f5c-0000-ee39-0001-777a03067afe
2023-02-10 15:56:05,733 - MainThread cursor.py:740 - execute() - INFO - query execution done
2023-02-10 15:56:05,733 - MainThread cursor.py:754 - execute() - DEBUG - SUCCESS
2023-02-10 15:56:05,733 - MainThread cursor.py:773 - execute() - DEBUG - PUT OR GET: False
2023-02-10 15:56:05,733 - MainThread cursor.py:864 - _init_result_and_meta() - DEBUG - Query result format: arrow
2023-02-10 15:56:05,733 - MainThread cursor.py:878 - _init_result_and_meta() - INFO - Number of results in first chunk: 0
2023-02-10 15:56:05,734 - MainThread result_set.py:58 - result_set_iterator() - DEBUG - beginning to schedule result batch downloads
snowtest_og.py:120: RemovedIn20Warning: Deprecated API features detected! These feature(s) are not compatible with SQLAlchemy 2.0. To prevent incompatible upgrades prior to updating applications, ensure requirements files are pinned to "sqlalchemy<2.0". Set environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings.  Set environment variable SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
  conn.execute(
2023-02-10 15:56:05,735 - MainThread connection.py:648 - cursor() - DEBUG - cursor
2023-02-10 15:56:05,735 - MainThread cursor.py:662 - execute() - DEBUG - executing SQL/command
2023-02-10 15:56:05,736 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 1, type: TEXT
2023-02-10 15:56:05,736 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 2, type: TEXT
2023-02-10 15:56:05,736 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 3, type: TEXT
2023-02-10 15:56:05,736 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 4, type: TEXT
2023-02-10 15:56:05,736 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 5, type: TEXT
2023-02-10 15:56:05,736 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 6, type: TEXT
2023-02-10 15:56:05,736 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 7, type: TEXT
2023-02-10 15:56:05,736 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 8, type: TEXT
2023-02-10 15:56:05,736 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 9, type: TEXT
2023-02-10 15:56:05,736 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 10, type: TEXT
2023-02-10 15:56:05,736 - MainThread cursor.py:727 - execute() - INFO - query: [MERGE INTO test_table USING ( SELECT ? uid, ? name, parse_json(?) inputs, parse_...]
2023-02-10 15:56:05,736 - MainThread connection.py:1334 - _next_sequence_counter() - DEBUG - sequence counter: 6
2023-02-10 15:56:05,736 - MainThread cursor.py:457 - _execute_helper() - DEBUG - Request id: 03dfb01d-c495-44e7-9499-62eb66dcbdda
2023-02-10 15:56:05,736 - MainThread cursor.py:459 - _execute_helper() - DEBUG - running query [MERGE INTO test_table USING ( SELECT ? uid, ? name, parse_json(?) inputs, parse_...]
2023-02-10 15:56:05,736 - MainThread cursor.py:466 - _execute_helper() - DEBUG - is_file_transfer: True
2023-02-10 15:56:05,736 - MainThread connection.py:1011 - cmd_query() - DEBUG - _cmd_query
2023-02-10 15:56:05,736 - MainThread connection.py:1034 - cmd_query() - DEBUG - sql=[MERGE INTO test_table USING ( SELECT ? uid, ? name, parse_json(?) inputs, parse_...], sequence_id=[6], is_file_transfer=[False]
2023-02-10 15:56:05,737 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:05,737 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2023-02-10 15:56:05,737 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: fdd961b9-4216-442c-9c51-87d2df344d4b
2023-02-10 15:56:05,737 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:06,321 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=03dfb01d-c495-44e7-9499-62eb66dcbdda&request_guid=fdd961b9-4216-442c-9c51-87d2df344d4b HTTP/1.1" 200 None
2023-02-10 15:56:06,322 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:06,322 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:06,322 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:06,322 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01aa3f5c-0000-ee61-0001-777a03066cc6
2023-02-10 15:56:06,323 - MainThread cursor.py:734 - execute() - DEBUG - sfqid: 01aa3f5c-0000-ee61-0001-777a03066cc6
2023-02-10 15:56:06,323 - MainThread cursor.py:740 - execute() - INFO - query execution done
2023-02-10 15:56:06,323 - MainThread cursor.py:754 - execute() - DEBUG - SUCCESS
2023-02-10 15:56:06,323 - MainThread cursor.py:773 - execute() - DEBUG - PUT OR GET: False
2023-02-10 15:56:06,323 - MainThread cursor.py:864 - _init_result_and_meta() - DEBUG - Query result format: json
2023-02-10 15:56:06,323 - MainThread result_batch.py:440 - _parse() - DEBUG - parsing for result batch id: 1
2023-02-10 15:56:06,324 - MainThread connection.py:648 - cursor() - DEBUG - cursor
2023-02-10 15:56:06,324 - MainThread cursor.py:662 - execute() - DEBUG - executing SQL/command
2023-02-10 15:56:06,324 - MainThread cursor.py:727 - execute() - INFO - query: [COMMIT]
2023-02-10 15:56:06,324 - MainThread connection.py:1334 - _next_sequence_counter() - DEBUG - sequence counter: 7
2023-02-10 15:56:06,324 - MainThread cursor.py:457 - _execute_helper() - DEBUG - Request id: 53e5de2a-7b84-4429-9829-6fbbf3b6e330
2023-02-10 15:56:06,324 - MainThread cursor.py:459 - _execute_helper() - DEBUG - running query [COMMIT]
2023-02-10 15:56:06,324 - MainThread cursor.py:466 - _execute_helper() - DEBUG - is_file_transfer: True
2023-02-10 15:56:06,324 - MainThread connection.py:1011 - cmd_query() - DEBUG - _cmd_query
2023-02-10 15:56:06,324 - MainThread connection.py:1034 - cmd_query() - DEBUG - sql=[COMMIT], sequence_id=[7], is_file_transfer=[False]
2023-02-10 15:56:06,324 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:06,325 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2023-02-10 15:56:06,325 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: dff14025-2ff1-4492-b830-903b93c50237
2023-02-10 15:56:06,325 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:06,583 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=53e5de2a-7b84-4429-9829-6fbbf3b6e330&request_guid=dff14025-2ff1-4492-b830-903b93c50237 HTTP/1.1" 200 None
2023-02-10 15:56:06,584 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:06,584 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:06,584 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:06,584 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01aa3f5c-0000-ee61-0001-777a03066cca
2023-02-10 15:56:06,585 - MainThread cursor.py:734 - execute() - DEBUG - sfqid: 01aa3f5c-0000-ee61-0001-777a03066cca
2023-02-10 15:56:06,585 - MainThread cursor.py:740 - execute() - INFO - query execution done
2023-02-10 15:56:06,585 - MainThread cursor.py:754 - execute() - DEBUG - SUCCESS
2023-02-10 15:56:06,585 - MainThread cursor.py:773 - execute() - DEBUG - PUT OR GET: False
2023-02-10 15:56:06,585 - MainThread cursor.py:864 - _init_result_and_meta() - DEBUG - Query result format: json
2023-02-10 15:56:06,585 - MainThread result_batch.py:440 - _parse() - DEBUG - parsing for result batch id: 1
2023-02-10 15:56:06,585 - MainThread cursor.py:878 - _init_result_and_meta() - INFO - Number of results in first chunk: 1
2023-02-10 15:56:06,586 - MainThread connection.py:648 - cursor() - DEBUG - cursor
2023-02-10 15:56:06,586 - MainThread cursor.py:662 - execute() - DEBUG - executing SQL/command
2023-02-10 15:56:06,586 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 1, type: TEXT
2023-02-10 15:56:06,586 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 2, type: TEXT
2023-02-10 15:56:06,586 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 3, type: TEXT
2023-02-10 15:56:06,586 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 4, type: TEXT
2023-02-10 15:56:06,586 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 5, type: ANY
2023-02-10 15:56:06,586 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 6, type: TEXT
2023-02-10 15:56:06,586 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 7, type: TEXT
2023-02-10 15:56:06,586 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 8, type: TEXT
2023-02-10 15:56:06,586 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 9, type: TEXT
2023-02-10 15:56:06,587 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 10, type: ANY
2023-02-10 15:56:06,587 - MainThread cursor.py:727 - execute() - INFO - query: [MERGE INTO test_table USING ( SELECT ? uid, ? name, parse_json(?) inputs, parse_...]
2023-02-10 15:56:06,587 - MainThread connection.py:1334 - _next_sequence_counter() - DEBUG - sequence counter: 8
2023-02-10 15:56:06,587 - MainThread cursor.py:457 - _execute_helper() - DEBUG - Request id: d93c9921-7560-402e-9698-0420d17b90d6
2023-02-10 15:56:06,587 - MainThread cursor.py:459 - _execute_helper() - DEBUG - running query [MERGE INTO test_table USING ( SELECT ? uid, ? name, parse_json(?) inputs, parse_...]
2023-02-10 15:56:06,587 - MainThread cursor.py:466 - _execute_helper() - DEBUG - is_file_transfer: True
2023-02-10 15:56:06,587 - MainThread connection.py:1011 - cmd_query() - DEBUG - _cmd_query
2023-02-10 15:56:06,587 - MainThread connection.py:1034 - cmd_query() - DEBUG - sql=[MERGE INTO test_table USING ( SELECT ? uid, ? name, parse_json(?) inputs, parse_...], sequence_id=[8], is_file_transfer=[False]
2023-02-10 15:56:06,587 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:06,587 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2023-02-10 15:56:06,587 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: bed3f014-fc2a-4f77-a169-f160bf7b82a0
2023-02-10 15:56:06,588 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:07,377 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=d93c9921-7560-402e-9698-0420d17b90d6&request_guid=bed3f014-fc2a-4f77-a169-f160bf7b82a0 HTTP/1.1" 200 None
2023-02-10 15:56:07,379 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:07,379 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:07,379 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:07,379 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01aa3f5c-0000-ee39-0001-777a03067b02
2023-02-10 15:56:07,379 - MainThread cursor.py:734 - execute() - DEBUG - sfqid: 01aa3f5c-0000-ee39-0001-777a03067b02
2023-02-10 15:56:07,379 - MainThread cursor.py:740 - execute() - INFO - query execution done
2023-02-10 15:56:07,379 - MainThread cursor.py:754 - execute() - DEBUG - SUCCESS
2023-02-10 15:56:07,380 - MainThread cursor.py:773 - execute() - DEBUG - PUT OR GET: False
2023-02-10 15:56:07,380 - MainThread cursor.py:864 - _init_result_and_meta() - DEBUG - Query result format: json
2023-02-10 15:56:07,380 - MainThread result_batch.py:440 - _parse() - DEBUG - parsing for result batch id: 1
2023-02-10 15:56:07,380 - MainThread connection.py:648 - cursor() - DEBUG - cursor
2023-02-10 15:56:07,380 - MainThread cursor.py:662 - execute() - DEBUG - executing SQL/command
2023-02-10 15:56:07,380 - MainThread cursor.py:727 - execute() - INFO - query: [COMMIT]
2023-02-10 15:56:07,380 - MainThread connection.py:1334 - _next_sequence_counter() - DEBUG - sequence counter: 9
2023-02-10 15:56:07,380 - MainThread cursor.py:457 - _execute_helper() - DEBUG - Request id: 5d18c1a4-3b86-4957-be7f-abc0129bee93
2023-02-10 15:56:07,381 - MainThread cursor.py:459 - _execute_helper() - DEBUG - running query [COMMIT]
2023-02-10 15:56:07,381 - MainThread cursor.py:466 - _execute_helper() - DEBUG - is_file_transfer: True
2023-02-10 15:56:07,381 - MainThread connection.py:1011 - cmd_query() - DEBUG - _cmd_query
2023-02-10 15:56:07,381 - MainThread connection.py:1034 - cmd_query() - DEBUG - sql=[COMMIT], sequence_id=[9], is_file_transfer=[False]
2023-02-10 15:56:07,381 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:07,381 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2023-02-10 15:56:07,381 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: 31b399ab-4b72-42bd-8ed5-ff9f4ff79e5a
2023-02-10 15:56:07,381 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:07,650 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=5d18c1a4-3b86-4957-be7f-abc0129bee93&request_guid=31b399ab-4b72-42bd-8ed5-ff9f4ff79e5a HTTP/1.1" 200 None
2023-02-10 15:56:07,651 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:07,651 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:07,651 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:07,651 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01aa3f5c-0000-eea8-0001-777a03068aba
2023-02-10 15:56:07,651 - MainThread cursor.py:734 - execute() - DEBUG - sfqid: 01aa3f5c-0000-eea8-0001-777a03068aba
2023-02-10 15:56:07,651 - MainThread cursor.py:740 - execute() - INFO - query execution done
2023-02-10 15:56:07,652 - MainThread cursor.py:754 - execute() - DEBUG - SUCCESS
2023-02-10 15:56:07,652 - MainThread cursor.py:773 - execute() - DEBUG - PUT OR GET: False
2023-02-10 15:56:07,652 - MainThread cursor.py:864 - _init_result_and_meta() - DEBUG - Query result format: json
2023-02-10 15:56:07,652 - MainThread result_batch.py:440 - _parse() - DEBUG - parsing for result batch id: 1
2023-02-10 15:56:07,652 - MainThread cursor.py:878 - _init_result_and_meta() - INFO - Number of results in first chunk: 1
2023-02-10 15:56:07,652 - MainThread connection.py:648 - cursor() - DEBUG - cursor
2023-02-10 15:56:07,653 - MainThread cursor.py:662 - execute() - DEBUG - executing SQL/command
2023-02-10 15:56:07,653 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 1, type: TEXT
2023-02-10 15:56:07,653 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 2, type: TEXT
2023-02-10 15:56:07,653 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 3, type: TEXT
2023-02-10 15:56:07,653 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 4, type: TEXT
2023-02-10 15:56:07,653 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 5, type: TEXT
2023-02-10 15:56:07,653 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 6, type: TEXT
2023-02-10 15:56:07,653 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 7, type: TEXT
2023-02-10 15:56:07,653 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 8, type: TEXT
2023-02-10 15:56:07,653 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 9, type: TEXT
2023-02-10 15:56:07,653 - MainThread connection.py:1239 - _process_params_qmarks() - DEBUG - idx: 10, type: TEXT
2023-02-10 15:56:07,653 - MainThread cursor.py:727 - execute() - INFO - query: [MERGE INTO test_table USING ( SELECT ? uid, ? name, parse_json(?) inputs, parse_...]
2023-02-10 15:56:07,653 - MainThread connection.py:1334 - _next_sequence_counter() - DEBUG - sequence counter: 10
2023-02-10 15:56:07,653 - MainThread cursor.py:457 - _execute_helper() - DEBUG - Request id: 7ecbec55-72e6-4e8e-94e0-cd09d2ebdf22
2023-02-10 15:56:07,653 - MainThread cursor.py:459 - _execute_helper() - DEBUG - running query [MERGE INTO test_table USING ( SELECT ? uid, ? name, parse_json(?) inputs, parse_...]
2023-02-10 15:56:07,653 - MainThread cursor.py:466 - _execute_helper() - DEBUG - is_file_transfer: True
2023-02-10 15:56:07,654 - MainThread connection.py:1011 - cmd_query() - DEBUG - _cmd_query
2023-02-10 15:56:07,654 - MainThread connection.py:1034 - cmd_query() - DEBUG - sql=[MERGE INTO test_table USING ( SELECT ? uid, ? name, parse_json(?) inputs, parse_...], sequence_id=[10], is_file_transfer=[False]
2023-02-10 15:56:07,654 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:07,654 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2023-02-10 15:56:07,654 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: f0b86f85-8760-4f80-9150-891da8ed03f2
2023-02-10 15:56:07,654 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:07,762 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=7ecbec55-72e6-4e8e-94e0-cd09d2ebdf22&request_guid=f0b86f85-8760-4f80-9150-891da8ed03f2 HTTP/1.1" 200 390
2023-02-10 15:56:07,763 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:07,763 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:07,763 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = 002099, after post request
2023-02-10 15:56:07,764 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01aa3f5c-0000-ee61-0001-777a03066cce
2023-02-10 15:56:07,764 - MainThread cursor.py:734 - execute() - DEBUG - sfqid: 01aa3f5c-0000-ee61-0001-777a03066cce
2023-02-10 15:56:07,764 - MainThread cursor.py:740 - execute() - INFO - query execution done
2023-02-10 15:56:07,764 - MainThread cursor.py:812 - execute() - DEBUG - {'data': {'internalError': False, 'errorCode': '002099', 'age': 0, 'sqlState': '42601', 'queryId': '01aa3f5c-0000-ee61-0001-777a03066cce', 'line': -1, 'pos': -1, 'type': 'COMPILATION'}, 'code': '002099', 'message': 'SQL compilation error: Batch size of 1 for bind variable 6 not the same as previous size of 2.', 'success': False, 'headers': None}
2023-02-10 15:56:07,768 - MainThread connection.py:648 - cursor() - DEBUG - cursor
2023-02-10 15:56:07,768 - MainThread cursor.py:662 - execute() - DEBUG - executing SQL/command
2023-02-10 15:56:07,768 - MainThread cursor.py:727 - execute() - INFO - query: [ROLLBACK]
2023-02-10 15:56:07,768 - MainThread connection.py:1334 - _next_sequence_counter() - DEBUG - sequence counter: 11
2023-02-10 15:56:07,768 - MainThread cursor.py:457 - _execute_helper() - DEBUG - Request id: 9e501ef7-b336-40a0-bd3d-6ba0b8cffa98
2023-02-10 15:56:07,768 - MainThread cursor.py:459 - _execute_helper() - DEBUG - running query [ROLLBACK]
2023-02-10 15:56:07,768 - MainThread cursor.py:466 - _execute_helper() - DEBUG - is_file_transfer: True
2023-02-10 15:56:07,768 - MainThread connection.py:1011 - cmd_query() - DEBUG - _cmd_query
2023-02-10 15:56:07,769 - MainThread connection.py:1034 - cmd_query() - DEBUG - sql=[ROLLBACK], sequence_id=[11], is_file_transfer=[False]
2023-02-10 15:56:07,769 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:07,769 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2023-02-10 15:56:07,769 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: 59b72708-6ef1-4d58-96b2-2e01e8820d59
2023-02-10 15:56:07,769 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:07,896 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=9e501ef7-b336-40a0-bd3d-6ba0b8cffa98&request_guid=59b72708-6ef1-4d58-96b2-2e01e8820d59 HTTP/1.1" 200 None
2023-02-10 15:56:07,897 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:07,897 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:07,897 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:07,897 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01aa3f5c-0000-ee75-0001-777a03069902
2023-02-10 15:56:07,898 - MainThread cursor.py:734 - execute() - DEBUG - sfqid: 01aa3f5c-0000-ee75-0001-777a03069902
2023-02-10 15:56:07,898 - MainThread cursor.py:740 - execute() - INFO - query execution done
2023-02-10 15:56:07,898 - MainThread cursor.py:754 - execute() - DEBUG - SUCCESS
2023-02-10 15:56:07,898 - MainThread cursor.py:773 - execute() - DEBUG - PUT OR GET: False
2023-02-10 15:56:07,898 - MainThread cursor.py:864 - _init_result_and_meta() - DEBUG - Query result format: json
2023-02-10 15:56:07,898 - MainThread result_batch.py:440 - _parse() - DEBUG - parsing for result batch id: 1
2023-02-10 15:56:07,898 - MainThread cursor.py:878 - _init_result_and_meta() - INFO - Number of results in first chunk: 1
2023-02-10 15:56:07,898 - MainThread connection.py:648 - cursor() - DEBUG - cursor
2023-02-10 15:56:07,898 - MainThread cursor.py:662 - execute() - DEBUG - executing SQL/command
2023-02-10 15:56:07,898 - MainThread cursor.py:727 - execute() - INFO - query: [ROLLBACK]
2023-02-10 15:56:07,899 - MainThread connection.py:1334 - _next_sequence_counter() - DEBUG - sequence counter: 12
2023-02-10 15:56:07,899 - MainThread cursor.py:457 - _execute_helper() - DEBUG - Request id: 19e52179-fd59-42a5-8725-e8cc7a7ad96c
2023-02-10 15:56:07,899 - MainThread cursor.py:459 - _execute_helper() - DEBUG - running query [ROLLBACK]
2023-02-10 15:56:07,899 - MainThread cursor.py:466 - _execute_helper() - DEBUG - is_file_transfer: True
2023-02-10 15:56:07,899 - MainThread connection.py:1011 - cmd_query() - DEBUG - _cmd_query
2023-02-10 15:56:07,899 - MainThread connection.py:1034 - cmd_query() - DEBUG - sql=[ROLLBACK], sequence_id=[12], is_file_transfer=[False]
2023-02-10 15:56:07,899 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:07,899 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2023-02-10 15:56:07,899 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: 2cc9bfd8-4a3f-46d4-b169-0893ca64cd8b
2023-02-10 15:56:07,899 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:08,009 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=19e52179-fd59-42a5-8725-e8cc7a7ad96c&request_guid=2cc9bfd8-4a3f-46d4-b169-0893ca64cd8b HTTP/1.1" 200 None
2023-02-10 15:56:08,011 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:08,011 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:08,011 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:08,011 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01aa3f5c-0000-ee61-0001-777a03066cd2
2023-02-10 15:56:08,012 - MainThread cursor.py:734 - execute() - DEBUG - sfqid: 01aa3f5c-0000-ee61-0001-777a03066cd2
2023-02-10 15:56:08,012 - MainThread cursor.py:740 - execute() - INFO - query execution done
2023-02-10 15:56:08,012 - MainThread cursor.py:754 - execute() - DEBUG - SUCCESS
2023-02-10 15:56:08,012 - MainThread cursor.py:773 - execute() - DEBUG - PUT OR GET: False
2023-02-10 15:56:08,012 - MainThread cursor.py:864 - _init_result_and_meta() - DEBUG - Query result format: json
2023-02-10 15:56:08,012 - MainThread result_batch.py:440 - _parse() - DEBUG - parsing for result batch id: 1
2023-02-10 15:56:08,012 - MainThread cursor.py:878 - _init_result_and_meta() - INFO - Number of results in first chunk: 1
---------------------------------------------------------
|"ID"  |"UID"  |"NAME"  |"INPUTS"  |"META"  |"TARGETS"  |
---------------------------------------------------------
|      |       |        |          |        |           |
---------------------------------------------------------

Traceback (most recent call last):
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
    self.dialect.do_execute(
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/snowflake/connector/cursor.py", line 827, in execute
    Error.errorhandler_wrapper(self.connection, self, error_class, errvalue)
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/snowflake/connector/errors.py", line 275, in errorhandler_wrapper
    handed_over = Error.hand_to_other_handler(
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/snowflake/connector/errors.py", line 330, in hand_to_other_handler
    cursor.errorhandler(connection, cursor, error_class, error_value)
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/snowflake/connector/errors.py", line 209, in default_errorhandler
    raise error_class(
snowflake.connector.errors.ProgrammingError: 002099 (42601): 01aa3f5c-0000-ee61-0001-777a03066cce: SQL compilation error: Batch size of 1 for bind variable 6 not the same as previous size of 2.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "snowtest_og.py", line 136, in <module>
    conn.execute(
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1380, in execute
    return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS)
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1572, in _execute_clauseelement
    ret = self._execute_context(
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1943, in _execute_context
    self._handle_dbapi_exception(
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2124, in _handle_dbapi_exception
    util.raise_(
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
    self.dialect.do_execute(
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/snowflake/connector/cursor.py", line 827, in execute
    Error.errorhandler_wrapper(self.connection, self, error_class, errvalue)
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/snowflake/connector/errors.py", line 275, in errorhandler_wrapper
    handed_over = Error.hand_to_other_handler(
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/snowflake/connector/errors.py", line 330, in hand_to_other_handler
    cursor.errorhandler(connection, cursor, error_class, error_value)
  File "/home/nmclean/.cache/pypoetry/virtualenvs/debug-QJDBDdE9-py3.8/lib/python3.8/site-packages/snowflake/connector/errors.py", line 209, in default_errorhandler
    raise error_class(
sqlalchemy.exc.ProgrammingError: (snowflake.connector.errors.ProgrammingError) 002099 (42601): 01aa3f5c-0000-ee61-0001-777a03066cce: SQL compilation error: Batch size of 1 for bind variable 6 not the same as previous size of 2.
[SQL: 
    MERGE INTO test_table USING (
            SELECT
                ? uid,
                ? name,
                parse_json(?) inputs,
                parse_json(?) meta,
                NULLIF(ARRAY_CONSTRUCT(?), ARRAY_CONSTRUCT(NULL)) targets
        ) upsert_row
        ON
            test_table.uid = upsert_row.uid
        WHEN MATCHED THEN UPDATE SET
            test_table.name = upsert_row.name,
            test_table.inputs = upsert_row.inputs,
            test_table.meta = upsert_row.meta,
            test_table.targets = upsert_row.targets
        WHEN NOT MATCHED THEN INSERT
            (uid, name, inputs, meta, targets)
        VALUES (
            ?,
            ?,
            parse_json(?),
            parse_json(?),
            NULLIF(ARRAY_CONSTRUCT(?), ARRAY_CONSTRUCT(NULL))
        )
    ]
[parameters: ('d13fe9fe-5667-4d8b-bdf4-1ee5aaa1c475', 'foo', '{"a": 1, "b": 2, "c": 3}', '{"x": 1, "y": 2}', ['x', 'y'], 'd13fe9fe-5667-4d8b-bdf4-1ee5aaa1c475', 'foo', '{"a": 1, "b": 2, "c": 3}', '{"x": 1, "y": 2}', ['x', 'y'])]
(Background on this error at: https://sqlalche.me/e/14/f405)
2023-02-10 15:56:08,070 - MainThread connection.py:581 - close() - INFO - closed
2023-02-10 15:56:08,070 - MainThread telemetry.py:211 - close() - DEBUG - Closing telemetry client.
2023-02-10 15:56:08,070 - MainThread connection.py:584 - close() - INFO - No async queries seem to be running, deleting session
2023-02-10 15:56:08,071 - MainThread network.py:1155 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 1/1 active sessions
2023-02-10 15:56:08,071 - MainThread network.py:835 - _request_exec_wrapper() - DEBUG - remaining request timeout: 5, retry cnt: 1
2023-02-10 15:56:08,071 - MainThread network.py:816 - add_request_guid() - DEBUG - Request guid: 1eaa4657-8f75-4882-80c3-341048af853e
2023-02-10 15:56:08,071 - MainThread network.py:1014 - _request_exec() - DEBUG - socket timeout: 60
2023-02-10 15:56:08,226 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://jbulliw-main.snowflakecomputing.com:443 "POST /session?delete=true&request_guid=1eaa4657-8f75-4882-80c3-341048af853e HTTP/1.1" 200 76
2023-02-10 15:56:08,227 - MainThread network.py:1040 - _request_exec() - DEBUG - SUCCESS
2023-02-10 15:56:08,227 - MainThread network.py:1160 - _use_requests_session() - DEBUG - Session status for SessionPool 'jbulliw-main.snowflakecomputing.com', SessionPool 0/1 active sessions
2023-02-10 15:56:08,227 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2023-02-10 15:56:08,229 - MainThread connection.py:595 - close() - DEBUG - Session is closed
@ndamclean ndamclean added bug Something isn't working needs triage Initial RCA is required labels Feb 8, 2023
@github-actions github-actions bot changed the title snowpark-python and snowflake-sqlalchemy packages are not compatible SNOW-740868: snowpark-python and snowflake-sqlalchemy packages are not compatible Feb 8, 2023
@sfc-gh-stan
Copy link
Collaborator

Hi @ndamclean, I cannot reproduce this. Looking at the logs, it seems like the error occurs when sqlalchemy engine tries to initialize a snowflake connector connection. Could you please try constructing the connection like:

from snowflake.sqlalchemy import URL
from sqlalchemy import create_engine

engine = create_engine(URL(
    account = 'abc123',
    user = 'testuser1',
    password = '0123456',
    database = 'testdb',
    schema = 'public',
    warehouse = 'testwh',
    role='myrole',
    timezone = 'America/Los_Angeles',
))

instead?

@ndamclean
Copy link
Author

@sfc-gh-stan this code works fine when I remove the part that imports the snowpark library and creates the snowpark session.

Are you sure you are using all the same versions of python and packages described in the ticket?

@sfc-gh-stan
Copy link
Collaborator

@sfc-gh-stan this code works fine when I remove the part that imports the snowpark library and creates the snowpark session.

Are you sure you are using all the same versions of python and packages described in the ticket?

I can confirm I'm using the same version of all the python packages, I'm using Python3.8.5 and running on MacOS. I changed the column names in the second last line to "key" and "value", and the code snippet finished without errors.

(test-env) stan@XNJJ67DMFL test % python3 script.py
-------------------
|"KEY"  |"VALUE"  |
-------------------
|       |         |
-------------------

None

If I use the init_db_engine function to establish the connection, I get sqlalchemy.exc.DatabaseError: (snowflake.connector.errors.DatabaseError) 250001 (08001): Failed to connect to DB: <snowflake_hostname>:443. Incorrect username or password was specified.

@ndamclean
Copy link
Author

ndamclean commented Feb 9, 2023

@sfc-gh-stan I don't know why it would be working on your end and not for me 🤷 My colleagues who use Mac OSX were able to reproduce this error.

Also I opened up a support ticket with Snowflake and linked this github issue and they were able to reproduce an error.
(case number 00476495 in case you are part of the Snowflake support team and have access)

If I use the init_db_engine function to establish the connection, I get sqlalchemy.exc.DatabaseError: (snowflake.connector.errors.DatabaseError) 250001 (08001): Failed to connect to DB: <snowflake_hostname>:443. Incorrect username or password was specified.

A version of this function has been in our code base for months and has been working just fine until we tried using the snowpark package.

@ndamclean
Copy link
Author

ndamclean commented Feb 9, 2023

I changed the column names in the second last line to "key" and "value", and the code snippet finished without errors.

I realized I had made a typo and I fixed the code in the ticket description. Sorry about that.

If i make this change (don't import snowpark and create a session), the code works.

--- a/snowtest.py
+++ b/snowtest2.py
@@ -54,11 +54,11 @@ def get_snowpark_session():
 
 
 db_engine = init_db_engine()
-snowpark_session = get_snowpark_session()
+#snowpark_session = get_snowpark_session()
 
 stmt = sa.sql.text("CREATE OR REPLACE TABLE test_table (key TEXT, value TEXT)")
 with db_engine.connect() as conn:
     conn.execute(stmt)
 
-tbl = snowpark_session.table("test_table").select("key", "value")
-print(tbl.show())
+#tbl = snowpark_session.table("test_table").select("key", "value")
+#print(tbl.show())

If i make this change (only use snowpark ; create a connection using SQLAlchemy but do not use it to execute queries), the code works:

--- a/snowtest.py
+++ b/snowtest3.py
@@ -2,6 +2,7 @@ import os
 from urllib.parse import urlunsplit, urlencode
 
 import sqlalchemy as sa
+from snowflake.snowpark import types as T
 
 
 def get_snowflake_env_vars():
@@ -56,9 +57,10 @@ def get_snowpark_session():
 db_engine = init_db_engine()
 snowpark_session = get_snowpark_session()
 
-stmt = sa.sql.text("CREATE OR REPLACE TABLE test_table (key TEXT, value TEXT)")
 with db_engine.connect() as conn:
-    conn.execute(stmt)
+    pass
 
+schema = T.StructType([T.StructField("key", T.StringType()), T.StructField("value", T.StringType())])
+snowpark_session.create_dataframe([["a", "b"]], schema).write.mode("overwrite").save_as_table("test_table")
 tbl = snowpark_session.table("test_table").select("key", "value")
 print(tbl.show())

@ndamclean
Copy link
Author

ndamclean commented Feb 9, 2023

@sfc-gh-stan in case it helps you reproduce this, here are the pyproject.toml and poetry.lock files I used to set up my environment using poetry.
pyproject.toml
poetry.lock

You could try setting up a new virtual environment using poetry and the above files to ensure our environments are identical.

Thank you for your help looking into this.

@ndamclean
Copy link
Author

@sfc-gh-stan Hi. I have a quick update on this. I was able to get the previous code working by upgrading to the newest versions of the packages (the snowflake-sqlalchemy package just had a release).

However, the actual code base I'm working with still has issues.

I updated the code sample here in this ticket to better reflect the errors coming from our code base.

The problem seemed to stem from the snowpark import changing the default parameter binding method from pyformat (client-side parameter binding) to qmark (server-side parameter binding).

The qmark parameter query binding seems to have some obscure bugs that affects some of our SQL queries.

I was able to work around the issue by adding constructor arguments to enforce usage of pyformat parameter bindings.

I explained my findings to the SF support person assigned to my ticket and they said they are investigating the issue but we have a workaround for now.

This is the patch to the code that works around the issue:

diff --git a/snowtest_original.py b/snowtest_fixed.py
index 250108f..c7ebb4f 100644
--- a/snowtest_original.py
+++ b/snowtest_fixed.py
@@ -46,13 +46,21 @@ def init_db_engine(**create_engine_kwargs) -> sa.engine.Engine:
             "",  # fragment
         )
     )
-    return sa.create_engine(sqlalchemy_url, **create_engine_kwargs)
+
+    create_engine_kwargs["connect_args"] = create_engine_kwargs.get("connect_args", {})
+    if "paramstyle" in create_engine_kwargs["connect_args"]:
+        raise RuntimeError(
+            "paramstyle must be set to pyformat, other param styles currently have SF connector bugs"
+        )
+    create_engine_kwargs["connect_args"]["paramstyle"] = "pyformat"
+    return sa.create_engine(sqlalchemy_url, paramstyle="pyformat", **create_engine_kwargs)
 
 
 def get_snowpark_session():
     """Get a SnowPark client session instance."""
-    sf_env = get_snowflake_env_vars()
-    return Session.builder.configs(sf_env).create()
+    connection_params = get_snowflake_env_vars()
+    connection_params["paramstyle"] = "pyformat"
+    return Session.builder.configs(connection_params).create()
 
 
 db_engine = init_db_engine()

@ndamclean
Copy link
Author

After all my investigations here, I think this might actually be a bug in the snowflake-connector-python package handling of qmark parameter formatting.

It does seem a bit weird that importing the snowflake.snowpark.session package has an impact on the default parameter formatting method used by other snowflake libraries, though, so maybe that should be considered a bug?

@sfc-gh-stan
Copy link
Collaborator

Hi @ndamclean , thank you so much for the pointers! The culprit is indeed the import statement from snowflake.snowpark.session import Session, this import statement executes snowflake.connector.paramstyle='qmark'.

Specifying paramstyle='pyformat' in the connection parameters did not fix this for me. I think what fixed the error is moving from snowflake.snowpark.session import Session to the top of file. Previously it was placed in get_snowpark_session(), meaning init_db_engine() is called before the paramstyle gets overwritten, which results in inconsistent paramstyle between sqlalchemy and snowflake-connetor-python, hence the failure. Originally I inserted the import statement at the top out of habit, so I wasn't able to reproduce this error.

This is a bug in Snowpark Python and I will work on the fix in the next sprint. Thanks again for all the investigation, we found a really obscure bug here 😄

@sfc-gh-stan sfc-gh-stan removed the needs triage Initial RCA is required label Feb 21, 2023
@sfc-gh-stan
Copy link
Collaborator

Should be fixed by #692 , closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants