snowflake-connector-python icon indicating copy to clipboard operation
snowflake-connector-python copied to clipboard

SNOW-653040: connection.cursor() does not inherit the connection database

Open jmg-duarte opened this issue 1 year ago • 1 comments

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using?
Python 3.8.9 (default, Nov  5 2021, 08:52:49) 
[Clang 13.0.0 (clang-1300.0.29.3)]

And

Python 3.10.2 (main, Mar 17 2022, 16:11:52) [Clang 13.0.0 (clang-1300.0.29.30)]
  1. What operating system and processor architecture are you using?
macOS-11.5.2-x86_64-i386-64bit
  1. What are the component versions in the environment (pip freeze)?
asn1crypto==1.5.1
certifi==2022.6.15
cffi==1.15.1
charset-normalizer==2.1.1
cryptography==36.0.2
filelock==3.8.0
idna==3.3
oscrypto==1.3.0
pycparser==2.21
pycryptodomex==3.15.0
PyJWT==2.4.0
pyOpenSSL==22.0.0
pytz==2022.2.1
requests==2.28.1
snowflake-connector-python==2.7.12
typing_extensions==4.3.0
urllib3==1.26.12
  1. What did you do?
from snowflake.connector import connect

conn_kwargs = {
    "database": "MY_DB"
    # ...
}

with connect(**conn_kwargs) as conn:
    print(conn.database) # prints "MY_DB" as expected
    with conn.cursor() as cursor:
        cursor.execute("create schema if not exists MY_SCHEMA") # Error
        # snowflake.connector.errors.ProgrammingError: 090105 (22000): 01a69c98-0101-683b-0001-09be0d2440d6: Cannot perform CREATE SCHEMA. This session does not have a current database. Call 'USE DATABASE', or use a qualified name.
  1. What did you expect to see?

The cursor inheriting the database.

  1. Can you set logging to DEBUG and collect the logs?
2022-08-29 13:49:09,951 - MainThread ssl_wrap_socket.py:43 - inject_into_urllib3() - DEBUG - Injecting ssl_wrap_socket_with_ocsp
2022-08-29 13:49:10,060 - MainThread cursor.py:80 - <module>() - DEBUG - Failed to import pyarrow. Cannot use pandas fetch API
2022-08-29 13:49:10,107 - MainThread connection.py:270 - __init__() - INFO - Snowflake Connector for Python Version: 2.7.12, Python Version: 3.10.2, Platform: macOS-11.5.2-x86_64-i386-64bit
2022-08-29 13:49:10,107 - MainThread connection.py:512 - connect() - DEBUG - connect
2022-08-29 13:49:10,107 - MainThread connection.py:802 - __config() - DEBUG - __config
2022-08-29 13:49:10,107 - MainThread connection.py:926 - __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.
2022-08-29 13:49:10,107 - MainThread connection.py:944 - __config() - INFO - Setting use_openssl_only mode to False
2022-08-29 13:49:10,108 - MainThread converter.py:145 - __init__() - DEBUG - use_numpy: False
2022-08-29 13:49:10,108 - MainThread connection.py:705 - __open_connection() - DEBUG - REST API object was created: ui76830.west-europe.azure.snowflakecomputing.com:443
2022-08-29 13:49:10,108 - MainThread retry.py:351 - from_int() - DEBUG - Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
2022-08-29 13:49:10,109 - MainThread retry.py:351 - from_int() - DEBUG - Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
2022-08-29 13:49:10,109 - MainThread network.py:1147 - _use_requests_session() - DEBUG - Session status for SessionPool 'ui76830.west-europe.azure.snowflakecomputing.com', SessionPool 1/1 active sessions
2022-08-29 13:49:10,109 - MainThread network.py:827 - _request_exec_wrapper() - DEBUG - remaining request timeout: 120, retry cnt: 1
2022-08-29 13:49:10,109 - MainThread network.py:808 - add_request_guid() - DEBUG - Request guid: 19d3c576-4d7d-49b4-a029-bd8288af892d
2022-08-29 13:49:10,109 - MainThread network.py:1006 - _request_exec() - DEBUG - socket timeout: 60
2022-08-29 13:49:10,176 - MainThread connectionpool.py:1003 - _new_conn() - DEBUG - Starting new HTTPS connection (1): ui76830.west-europe.azure.snowflakecomputing.com:443
2022-08-29 13:49:10,485 - MainThread cache.py:490 - _save() - DEBUG - acquiring /Users/duarte/Library/Caches/Snowflake/ocsp_cache.lock timed out, skipping saving...
2022-08-29 13:49:10,487 - MainThread ocsp_snowflake.py:507 - reset_cache_dir() - DEBUG - cache directory: /Users/duarte/Library/Caches/Snowflake
2022-08-29 13:49:10,585 - MainThread ssl_wrap_socket.py:80 - ssl_wrap_socket_with_ocsp() - DEBUG - OCSP Mode: FAIL_OPEN, OCSP response cache file name: None
2022-08-29 13:49:10,585 - MainThread ocsp_snowflake.py:549 - reset_ocsp_response_cache_uri() - DEBUG - ocsp_response_cache_uri: file:///Users/duarte/Library/Caches/Snowflake/ocsp_response_cache.json
2022-08-29 13:49:10,585 - MainThread ocsp_snowflake.py:550 - reset_ocsp_response_cache_uri() - DEBUG - OCSP_VALIDATION_CACHE size: 0
2022-08-29 13:49:10,585 - MainThread ocsp_snowflake.py:332 - reset_ocsp_dynamic_cache_server_url() - DEBUG - OCSP response cache server is enabled: http://ocsp.snowflakecomputing.com/ocsp_response_cache.json
2022-08-29 13:49:10,585 - MainThread ocsp_snowflake.py:368 - reset_ocsp_dynamic_cache_server_url() - DEBUG - OCSP dynamic cache server RETRY URL: None
2022-08-29 13:49:10,589 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-09-15 19:41:06+00:00
2022-08-29 13:49:10,590 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-09-15 19:45:34+00:00
2022-08-29 13:49:10,592 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-06-22 07:00:00+00:00
2022-08-29 13:49:10,595 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00
2022-08-29 13:49:10,596 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00
2022-08-29 13:49:10,599 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2022-10-15 00:00:00+00:00
2022-08-29 13:49:10,624 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 15:48:31+00:00
2022-08-29 13:49:10,637 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 16:47:06+00:00
2022-08-29 13:49:10,639 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 16:47:06+00:00
2022-08-29 13:49:10,642 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 15:48:31+00:00
2022-08-29 13:49:10,644 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 16:47:06+00:00
2022-08-29 13:49:10,646 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 16:47:06+00:00
2022-08-29 13:49:10,652 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 15:48:31+00:00
2022-08-29 13:49:10,654 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 15:48:31+00:00
2022-08-29 13:49:10,659 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 15:48:31+00:00
2022-08-29 13:49:10,661 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 15:48:31+00:00
2022-08-29 13:49:10,663 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 16:47:06+00:00
2022-08-29 13:49:10,665 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 16:47:06+00:00
2022-08-29 13:49:10,667 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 15:48:31+00:00
2022-08-29 13:49:10,670 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 16:47:06+00:00
2022-08-29 13:49:10,673 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 16:47:06+00:00
2022-08-29 13:49:10,676 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 16:47:06+00:00
2022-08-29 13:49:10,679 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 15:48:31+00:00
2022-08-29 13:49:10,683 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 15:48:31+00:00
2022-08-29 13:49:10,685 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 15:48:31+00:00
2022-08-29 13:49:10,687 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 15:48:31+00:00
2022-08-29 13:49:10,690 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 15:48:31+00:00
2022-08-29 13:49:10,692 - MainThread ocsp_asn1crypto.py:238 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-07-15 16:47:06+00:00
2022-08-29 13:49:10,693 - MainThread ocsp_snowflake.py:585 - read_ocsp_response_cache_file() - DEBUG - Read OCSP response cache file: /Users/duarte/Library/Caches/Snowflake/ocsp_response_cache.json, count=184
2022-08-29 13:49:10,693 - MainThread ocsp_snowflake.py:1118 - validate() - DEBUG - validating certificate: ui76830.west-europe.azure.snowflakecomputing.com
2022-08-29 13:49:10,693 - MainThread ocsp_asn1crypto.py:439 - extract_certificate_chain() - DEBUG - # of certificates: 2
2022-08-29 13:49:10,696 - MainThread ocsp_asn1crypto.py:444 - extract_certificate_chain() - DEBUG - subject: OrderedDict([('country_name', 'US'), ('state_or_province_name', 'California'), ('locality_name', 'San Mateo'), ('organization_name', 'Snowflake Inc.'), ('common_name', '*.west-europe.azure.snowflakecomputing.com')]), issuer: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('common_name', 'DigiCert TLS RSA SHA256 2020 CA1')])
2022-08-29 13:49:10,698 - MainThread ocsp_asn1crypto.py:444 - 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')])
2022-08-29 13:49:10,703 - MainThread ocsp_asn1crypto.py:123 - read_cert_bundle() - DEBUG - reading certificate bundle: /Users/duarte/Documents/data/pdbt/snowflake/lib/python3.10/site-packages/certifi/cacert.pem
2022-08-29 13:49:10,731 - MainThread ocsp_asn1crypto.py:465 - create_pair_issuer_subject() - DEBUG - not found issuer_der: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('organizational_unit_name', 'www.digicert.com'), ('common_name', 'DigiCert Global Root CA')])
2022-08-29 13:49:10,733 - MainThread ocsp_snowflake.py:725 - 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', '*.west-europe.azure.snowflakecomputing.com')])
2022-08-29 13:49:10,735 - MainThread ocsp_snowflake.py:725 - find_cache() - DEBUG - hit cache for subject: OrderedDict([('country_name', 'US'), ('organization_name', 'DigiCert Inc'), ('common_name', 'DigiCert TLS RSA SHA256 2020 CA1')])
2022-08-29 13:49:10,738 - MainThread ocsp_snowflake.py:647 - write_ocsp_response_cache_file() - DEBUG - writing OCSP response cache file to /Users/duarte/Library/Caches/Snowflake/ocsp_response_cache.json
2022-08-29 13:49:10,738 - MainThread ocsp_snowflake.py:1794 - encode_ocsp_response_cache() - DEBUG - encoding OCSP response cache to JSON
2022-08-29 13:49:10,765 - MainThread ocsp_snowflake.py:1175 - _validate() - DEBUG - ok
2022-08-29 13:49:11,159 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://ui76830.west-europe.azure.snowflakecomputing.com:443 "POST /session/v1/login-request?request_id=81cba3e0-6219-443b-8def-9773b9431b0c&databaseName=datafountain_test&warehouse=data_xsmall&request_guid=19d3c576-4d7d-49b4-a029-bd8288af892d HTTP/1.1" 200 None
2022-08-29 13:49:11,161 - MainThread network.py:1032 - _request_exec() - DEBUG - SUCCESS
2022-08-29 13:49:11,162 - MainThread network.py:1152 - _use_requests_session() - DEBUG - Session status for SessionPool 'ui76830.west-europe.azure.snowflakecomputing.com', SessionPool 0/1 active sessions
2022-08-29 13:49:11,162 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2022-08-29 13:49:11,163 - MainThread connection.py:624 - cursor() - DEBUG - cursor
2022-08-29 13:49:11,163 - MainThread cursor.py:630 - execute() - DEBUG - executing SQL/command
2022-08-29 13:49:11,163 - MainThread cursor.py:669 - execute() - DEBUG - binding: [create schema if not exists duarte_dbt] with input=[None], processed=[{}]
2022-08-29 13:49:11,163 - MainThread cursor.py:715 - execute() - INFO - query: [create schema if not exists duarte_dbt]
2022-08-29 13:49:11,163 - MainThread connection.py:1302 - _next_sequence_counter() - DEBUG - sequence counter: 1
2022-08-29 13:49:11,163 - MainThread cursor.py:460 - _execute_helper() - DEBUG - Request id: a2b6056b-66fb-4b0a-9c52-f12222c0914b
2022-08-29 13:49:11,164 - MainThread cursor.py:462 - _execute_helper() - DEBUG - running query [create schema if not exists duarte_dbt]
2022-08-29 13:49:11,164 - MainThread cursor.py:471 - _execute_helper() - DEBUG - is_file_transfer: False
2022-08-29 13:49:11,164 - MainThread connection.py:972 - cmd_query() - DEBUG - _cmd_query
2022-08-29 13:49:11,165 - MainThread connection.py:995 - cmd_query() - DEBUG - sql=[create schema if not exists duarte_dbt], sequence_id=[1], is_file_transfer=[False]
2022-08-29 13:49:11,165 - MainThread network.py:1147 - _use_requests_session() - DEBUG - Session status for SessionPool 'ui76830.west-europe.azure.snowflakecomputing.com', SessionPool 1/1 active sessions
2022-08-29 13:49:11,165 - MainThread network.py:827 - _request_exec_wrapper() - DEBUG - remaining request timeout: None, retry cnt: 1
2022-08-29 13:49:11,165 - MainThread network.py:808 - add_request_guid() - DEBUG - Request guid: 5a19e096-b7eb-45f8-ab07-575142eb65d2
2022-08-29 13:49:11,165 - MainThread network.py:1006 - _request_exec() - DEBUG - socket timeout: 60
2022-08-29 13:49:11,308 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://ui76830.west-europe.azure.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=a2b6056b-66fb-4b0a-9c52-f12222c0914b&request_guid=5a19e096-b7eb-45f8-ab07-575142eb65d2 HTTP/1.1" 200 417
2022-08-29 13:49:11,309 - MainThread network.py:1032 - _request_exec() - DEBUG - SUCCESS
2022-08-29 13:49:11,309 - MainThread network.py:1152 - _use_requests_session() - DEBUG - Session status for SessionPool 'ui76830.west-europe.azure.snowflakecomputing.com', SessionPool 0/1 active sessions
2022-08-29 13:49:11,310 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = 090105, after post request
2022-08-29 13:49:11,310 - MainThread network.py:739 - _post_request() - DEBUG - Query id: 01a69ca1-0101-683b-0001-09be0d2440ee
2022-08-29 13:49:11,310 - MainThread cursor.py:737 - execute() - DEBUG - sfqid: 01a69ca1-0101-683b-0001-09be0d2440ee
2022-08-29 13:49:11,310 - MainThread cursor.py:739 - execute() - INFO - query execution done
2022-08-29 13:49:11,310 - MainThread cursor.py:789 - execute() - DEBUG - {'data': {'internalError': False, 'errorCode': '090105', 'age': 0, 'sqlState': '22000', 'queryId': '01a69ca1-0101-683b-0001-09be0d2440ee', 'line': 1, 'pos': 28, 'type': 'COMPILATION'}, 'code': '090105', 'message': "Cannot perform CREATE SCHEMA. This session does not have a current database. Call 'USE DATABASE', or use a qualified name.", 'success': False, 'headers': None}
2022-08-29 13:49:11,313 - MainThread connection.py:557 - close() - INFO - closed
2022-08-29 13:49:11,313 - MainThread telemetry.py:151 - close() - DEBUG - Closing telemetry client.
2022-08-29 13:49:11,314 - MainThread telemetry.py:116 - send_batch() - DEBUG - Sending 1 logs to telemetry. Data is {'logs': [{'message': {'DriverType': 'PythonConnector', 'DriverVersion': '2.7.12', 'QueryID': '01a69ca1-0101-683b-0001-09be0d2440ee', 'SQLState': '22000', 'reason': '090105 (22000)', 'ErrorNumber': '90105', 'Stacktrace': (False, '  File "snowflake/connector/cursor.py", line 804, in execute\n  File "snowflake/connector/errors.py", line 276, in errorhandler_wrapper\n  File "snowflake/connector/errors.py", line 331, in hand_to_other_handler\n  File "snowflake/connector/errors.py", line 210, in default_errorhandler\n', None), 'type': 'client_sql_exception', 'source': 'PythonConnector', 'Exception': 'ProgrammingError'}, 'timestamp': '1661777351313'}]}.
2022-08-29 13:49:11,315 - MainThread network.py:1147 - _use_requests_session() - DEBUG - Session status for SessionPool 'ui76830.west-europe.azure.snowflakecomputing.com', SessionPool 1/1 active sessions
2022-08-29 13:49:11,315 - MainThread network.py:827 - _request_exec_wrapper() - DEBUG - remaining request timeout: 5, retry cnt: 1
2022-08-29 13:49:11,316 - MainThread network.py:808 - add_request_guid() - DEBUG - Request guid: 10b8001a-39a7-4d98-bb78-3a3eab73c3ba
2022-08-29 13:49:11,316 - MainThread network.py:1006 - _request_exec() - DEBUG - socket timeout: 60
2022-08-29 13:49:11,378 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://ui76830.west-europe.azure.snowflakecomputing.com:443 "POST /telemetry/send?request_guid=10b8001a-39a7-4d98-bb78-3a3eab73c3ba HTTP/1.1" 200 86
2022-08-29 13:49:11,379 - MainThread network.py:1032 - _request_exec() - DEBUG - SUCCESS
2022-08-29 13:49:11,379 - MainThread network.py:1152 - _use_requests_session() - DEBUG - Session status for SessionPool 'ui76830.west-europe.azure.snowflakecomputing.com', SessionPool 0/1 active sessions
2022-08-29 13:49:11,379 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2022-08-29 13:49:11,379 - MainThread telemetry.py:140 - send_batch() - DEBUG - Successfully uploading metrics to telemetry.
2022-08-29 13:49:11,379 - MainThread connection.py:560 - close() - INFO - No async queries seem to be running, deleting session
2022-08-29 13:49:11,380 - MainThread network.py:1147 - _use_requests_session() - DEBUG - Session status for SessionPool 'ui76830.west-europe.azure.snowflakecomputing.com', SessionPool 1/1 active sessions
2022-08-29 13:49:11,380 - MainThread network.py:827 - _request_exec_wrapper() - DEBUG - remaining request timeout: 5, retry cnt: 1
2022-08-29 13:49:11,380 - MainThread network.py:808 - add_request_guid() - DEBUG - Request guid: 6c6d4bc0-3829-4bff-afea-8be3e8b069b0
2022-08-29 13:49:11,380 - MainThread network.py:1006 - _request_exec() - DEBUG - socket timeout: 60
2022-08-29 13:49:11,533 - MainThread connectionpool.py:456 - _make_request() - DEBUG - https://ui76830.west-europe.azure.snowflakecomputing.com:443 "POST /session?delete=true&request_guid=6c6d4bc0-3829-4bff-afea-8be3e8b069b0 HTTP/1.1" 200 76
2022-08-29 13:49:11,533 - MainThread network.py:1032 - _request_exec() - DEBUG - SUCCESS
2022-08-29 13:49:11,534 - MainThread network.py:1152 - _use_requests_session() - DEBUG - Session status for SessionPool 'ui76830.west-europe.azure.snowflakecomputing.com', SessionPool 0/1 active sessions
2022-08-29 13:49:11,534 - MainThread network.py:715 - _post_request() - DEBUG - ret[code] = None, after post request
2022-08-29 13:49:11,536 - MainThread connection.py:571 - close() - DEBUG - Session is closed
Traceback (most recent call last):
  File "/Users/duarte/Documents/data/pdbt/test.py", line 41, in <module>
    cursor.execute("create schema if not exists duarte_dbt")
  File "/Users/duarte/Documents/data/pdbt/snowflake/lib/python3.10/site-packages/snowflake/connector/cursor.py", line 804, in execute
    Error.errorhandler_wrapper(self.connection, self, error_class, errvalue)
  File "/Users/duarte/Documents/data/pdbt/snowflake/lib/python3.10/site-packages/snowflake/connector/errors.py", line 276, in errorhandler_wrapper
    handed_over = Error.hand_to_other_handler(
  File "/Users/duarte/Documents/data/pdbt/snowflake/lib/python3.10/site-packages/snowflake/connector/errors.py", line 331, in hand_to_other_handler
    cursor.errorhandler(connection, cursor, error_class, error_value)
  File "/Users/duarte/Documents/data/pdbt/snowflake/lib/python3.10/site-packages/snowflake/connector/errors.py", line 210, in default_errorhandler
    raise error_class(
snowflake.connector.errors.ProgrammingError: 090105 (22000): 01a69ca1-0101-683b-0001-09be0d2440ee: Cannot perform CREATE SCHEMA. This session does not have a current database. Call 'USE DATABASE', or use a qualified name.

Note: I've removed logs from auth.py.

jmg-duarte avatar Aug 29 '22 12:08 jmg-duarte

This seems to be a permissions issue, as I tried with a different connection string and it worked.

Thought, if that is the case, then the connector should fail on connect and not after with the "wrong" error.

jmg-duarte avatar Aug 29 '22 13:08 jmg-duarte

To clean up and re-prioritize bugs and feature requests we are closing all issues older than 6 months as of March 1, 2023. If there are any issues or feature requests that you would like us to address, please re-create them. For urgent issues, opening a support case with this link Snowflake Community is the fastest way to get a response

github-actions[bot] avatar Mar 10 '23 01:03 github-actions[bot]