Closed thondeboer closed 1 year ago
Probably related to this is that cursor.fetchmany() only returns ONE line, instead of the expected cursor.arraysize.
It returns one line when used like an iterator:
for lines in cur.fetchmany():
logging.warning(f'Getting the GRE_GWAS data in batches of {MAXLINES}. Got {len(lines)} lines')
len(lines) == [THE NUMBER OF COLUMNS] != [THE cursor.arraysize]
It DOES seem to work when used like this
cur.execute(q)
lines = cur.fetchmany()
len(lines) == cursor.arraysize
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
Please answer these questions before submitting your issue. Thanks!
What version of Python are you using (
python --version
)? Python 3.7.6What operating system and processor architecture are you using (
python -c 'import platform; print(platform.platform())'
)? Linux-4.19.102+-x86_64-with-Ubuntu-18.04-bionicWhat are the component versions in the environment (
pip freeze
)?What did you do? If possible, provide a recipe for reproducing the error. A complete runnable program is good.
for df in cur.fetch_pandas_batches(): logging.warning(f'Getting the GRE_GWAS data in batches of {MAXLINES}. Got {df.shape[0]} lines')
18Sep2020 19:50:04-WARNING Getting the GRE_GWAS data in batches of 10. Got 10 lines 18Sep2020 19:50:04-WARNING Getting the GRE_GWAS data in batches of 10. Got 10 lines . . . 18Sep2020 19:50:04-WARNING Getting the GRE_GWAS data in batches of 10. Got 10 lines
18Sep2020 19:58:57-INFO Snowflake Connector for Python Version: 2.3.2, Python Version: 3.7.6, Platform: Linux-4.19.102+-x86_64-with-debian-buster-sid 18Sep2020 19:58:57-DEBUG connect 18Sep2020 19:58:57-DEBUG __config 18Sep2020 19:58:57-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. 18Sep2020 19:58:57-DEBUG use_numpy: False 18Sep2020 19:58:57-DEBUG REST API object was created: bs10304.eu-central-1.snowflakecomputing.com:443 18Sep2020 19:58:57-DEBUG authenticate 18Sep2020 19:58:57-DEBUG assertion content: ** 18Sep2020 19:58:57-DEBUG account=bs10304, user=deerfield_db1, database="DEERFIELD_DB1", schema="PUBLIC", warehouse=DEERFIELD_TEST, role=deerfield_db1, request_id=90482f53-c0b4-40ab-a784-114020d9177a 18Sep2020 19:58:57-DEBUG body['data']: {'CLIENT_APP_ID': 'PythonConnector', 'CLIENT_APP_VERSION': '2.3.2', 'SVN_REVISION': None, 'ACCOUNT_NAME': 'bs10304', 'LOGIN_NAME': 'deerfield_db1', 'CLIENT_ENVIRONMENT': {'APPLICATION': 'PythonConnector', 'OS': 'Linux', 'OS_VERSION': 'Linux-4.19.102+-x86_64-with-debian-buster-sid', 'PYTHON_VERSION': '3.7.6', 'PYTHON_RUNTIME': 'CPython', 'PYTHON_COMPILER': 'GCC 7.5.0', 'OCSP_MODE': 'FAIL_OPEN', 'TRACING': 10, 'LOGIN_TIMEOUT': 120, 'NETWORK_TIMEOUT': None, 'CLIENT_STORE_TEMPORARY_CREDENTIAL': None}, 'SESSION_PARAMETERS': {'CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY': 900, 'CLIENT_PREFETCH_THREADS': 4}} 18Sep2020 19:58:57-DEBUG Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None) 18Sep2020 19:58:57-DEBUG Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None) 18Sep2020 19:58:57-DEBUG Active requests sessions: 1, idle: 0 18Sep2020 19:58:57-DEBUG remaining request timeout: 120, retry cnt: 1 18Sep2020 19:58:57-DEBUG socket timeout: 60 18Sep2020 19:58:57-DEBUG Starting new HTTPS connection (1): bs10304.eu-central-1.snowflakecomputing.com:443 18Sep2020 19:58:58-DEBUG OCSP Mode: FAIL_OPEN, OCSP response cache file name: None 18Sep2020 19:58:58-DEBUG ocsp_response_cache_uri: file:///data/.cache/snowflake/ocsp_response_cache.json 18Sep2020 19:58:58-DEBUG OCSP_VALIDATION_CACHE size: 140 18Sep2020 19:58:58-DEBUG OCSP response cache server is enabled: http://ocsp.snowflakecomputing.com/ocsp_response_cache.json 18Sep2020 19:58:58-DEBUG OCSP dynamic cache server RETRY URL: None 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-06-11 20:40:26+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-06-11 20:40:26+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-06-11 20:44:21+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-06-11 20:44:21+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 16:58:09+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 16:58:09+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:13:33+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:13:33+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:08:26+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:08:26+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:03:51+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:03:51+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 16:58:09+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 16:58:09+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:03:51+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:03:51+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:03:51+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:03:51+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:13:33+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:13:33+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:08:26+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:08:26+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:13:33+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:13:33+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-12-14 07:00:00+00:00 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-12-14 07:00:00+00:00 18Sep2020 19:58:58-DEBUG Read OCSP response cache file: /data/.cache/snowflake/ocsp_response_cache.json, count=140 18Sep2020 19:58:58-DEBUG validating certificate: bs10304.eu-central-1.snowflakecomputing.com 18Sep2020 19:58:58-DEBUG # of certificates: 4 18Sep2020 19:58:58-DEBUG subject: OrderedDict([('common_name', '.eu-central-1.snowflakecomputing.com')]), issuer: OrderedDict([('country_name', 'US'), ('organization_name', 'Amazon'), ('organizational_unit_name', 'Server CA 1B'), ('common_name', 'Amazon')]) 18Sep2020 19:58:58-DEBUG subject: OrderedDict([('country_name', 'US'), ('organization_name', 'Amazon'), ('organizational_unit_name', 'Server CA 1B'), ('common_name', 'Amazon')]), issuer: OrderedDict([('country_name', 'US'), ('organization_name', 'Amazon'), ('common_name', 'Amazon Root CA 1')]) 18Sep2020 19:58:58-DEBUG subject: OrderedDict([('country_name', 'US'), ('organization_name', 'Amazon'), ('common_name', 'Amazon Root CA 1')]), issuer: OrderedDict([('country_name', 'US'), ('state_or_province_name', 'Arizona'), ('locality_name', 'Scottsdale'), ('organization_name', 'Starfield Technologies, Inc.'), ('common_name', 'Starfield Services Root Certificate Authority - G2')]) 18Sep2020 19:58:58-DEBUG subject: OrderedDict([('country_name', 'US'), ('state_or_province_name', 'Arizona'), ('locality_name', 'Scottsdale'), ('organization_name', 'Starfield Technologies, Inc.'), ('common_name', 'Starfield Services Root Certificate Authority - G2')]), issuer: OrderedDict([('country_name', 'US'), ('organization_name', 'Starfield Technologies, Inc.'), ('organizational_unit_name', 'Starfield Class 2 Certification Authority')]) 18Sep2020 19:58:58-DEBUG not found issuer_der: OrderedDict([('country_name', 'US'), ('organization_name', 'Starfield Technologies, Inc.'), ('organizational_unit_name', 'Starfield Class 2 Certification Authority')]) 18Sep2020 19:58:58-DEBUG hit cache for subject: OrderedDict([('common_name', '.eu-central-1.snowflakecomputing.com')]) 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-06-11 20:40:26+00:00 18Sep2020 19:58:58-DEBUG hit cache for subject: OrderedDict([('country_name', 'US'), ('organization_name', 'Amazon'), ('organizational_unit_name', 'Server CA 1B'), ('common_name', 'Amazon')]) 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-06-11 20:44:21+00:00 18Sep2020 19:58:58-DEBUG hit cache for subject: OrderedDict([('country_name', 'US'), ('organization_name', 'Amazon'), ('common_name', 'Amazon Root CA 1')]) 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-12-14 07:00:00+00:00 18Sep2020 19:58:58-DEBUG hit cache for subject: OrderedDict([('country_name', 'US'), ('state_or_province_name', 'Arizona'), ('locality_name', 'Scottsdale'), ('organization_name', 'Starfield Technologies, Inc.'), ('common_name', 'Starfield Services Root Certificate Authority - G2')]) 18Sep2020 19:58:58-DEBUG hit cache for subject: OrderedDict([('common_name', '.eu-central-1.snowflakecomputing.com')]) 18Sep2020 19:58:58-DEBUG using OCSP response cache 18Sep2020 19:58:58-DEBUG Certificate is NOT attached in Basic OCSP Response. Using issuer's certificate 18Sep2020 19:58:58-DEBUG Verifying the OCSP response is signed by the issuer. 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-06-11 20:40:26+00:00 18Sep2020 19:58:58-DEBUG hit cache for subject: OrderedDict([('country_name', 'US'), ('organization_name', 'Amazon'), ('organizational_unit_name', 'Server CA 1B'), ('common_name', 'Amazon')]) 18Sep2020 19:58:58-DEBUG using OCSP response cache 18Sep2020 19:58:58-DEBUG Certificate is attached in Basic OCSP Response 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer 18Sep2020 19:58:58-DEBUG Valid Not After: 2023-06-11 20:40:26+00:00 18Sep2020 19:58:58-DEBUG Verifying the OCSP response is signed by the issuer. 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-06-11 20:44:21+00:00 18Sep2020 19:58:58-DEBUG hit cache for subject: OrderedDict([('country_name', 'US'), ('organization_name', 'Amazon'), ('common_name', 'Amazon Root CA 1')]) 18Sep2020 19:58:58-DEBUG using OCSP response cache 18Sep2020 19:58:58-DEBUG Certificate is attached in Basic OCSP Response 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer 18Sep2020 19:58:58-DEBUG Valid Not After: 2023-06-11 20:44:21+00:00 18Sep2020 19:58:58-DEBUG Verifying the OCSP response is signed by the issuer. 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-12-14 07:00:00+00:00 18Sep2020 19:58:58-DEBUG hit cache for subject: OrderedDict([('country_name', 'US'), ('state_or_province_name', 'Arizona'), ('locality_name', 'Scottsdale'), ('organization_name', 'Starfield Technologies, Inc.'), ('common_name', 'Starfield Services Root Certificate Authority - G2')]) 18Sep2020 19:58:58-DEBUG using OCSP response cache 18Sep2020 19:58:58-DEBUG Certificate is attached in Basic OCSP Response 18Sep2020 19:58:58-DEBUG Verifying the attached certificate is signed by the issuer 18Sep2020 19:58:58-DEBUG Valid Not After: 2021-12-14 07:00:00+00:00 18Sep2020 19:58:58-DEBUG Verifying the OCSP response is signed by the issuer. 18Sep2020 19:58:58-DEBUG writing OCSP response cache file 18Sep2020 19:58:58-DEBUG encoding OCSP response cache to JSON 18Sep2020 19:58:58-DEBUG ok 18Sep2020 19:58:59-DEBUG https://bs10304.eu-central-1.snowflakecomputing.com:443 "POST /session/v1/login-request?request_id=90482f53-c0b4-40ab-a784-114020d9177a&databaseName=%22DEERFIELD_DB1%22&schemaName=%22PUBLIC%22&warehouse=DEERFIELD_TEST&roleName=deerfield_db1&request_guid=79719509-a693-4643-a52c-eb257bf458ac HTTP/1.1" 200 1373 18Sep2020 19:58:59-DEBUG SUCCESS 18Sep2020 19:58:59-DEBUG Active requests sessions: 0, idle: 1 18Sep2020 19:58:59-DEBUG ret[code] = None, after post request 18Sep2020 19:58:59-DEBUG completed authentication 18Sep2020 19:58:59-DEBUG token = 18Sep2020 19:58:59-DEBUG master_token = ** 18Sep2020 19:58:59-DEBUG id_token = NULL 18Sep2020 19:58:59-DEBUG no ID token is given when try to store temporary credential 18Sep2020 19:58:59-DEBUG cursor 18Sep2020 19:58:59-DEBUG executing SQL/command 18Sep2020 19:58:59-DEBUG binding: [SELECT FROM "DEERFIELD_DB1"."PUBLIC"."GRE_GWAS" LIMIT 1000] with input=[None], processed=[{}] 18Sep2020 19:58:59-INFO query: [SELECT FROM "DEERFIELD_DB1"."PUBLIC"."GRE_GWAS" LIMIT 1000] 18Sep2020 19:58:59-DEBUG sequence counter: 1 18Sep2020 19:58:59-DEBUG running query [SELECT FROM "DEERFIELD_DB1"."PUBLIC"."GRE_GWAS" LIMIT 1000] 18Sep2020 19:58:59-DEBUG is_file_transfer: False 18Sep2020 19:58:59-DEBUG _cmd_query 18Sep2020 19:58:59-DEBUG sql=[SELECT FROM "DEERFIELD_DB1"."PUBLIC"."GRE_GWAS" LIMIT 1000], sequence_id=[1], is_file_transfer=[None] 18Sep2020 19:58:59-DEBUG Active requests sessions: 1, idle: 0 18Sep2020 19:58:59-DEBUG remaining request timeout: None, retry cnt: 1 18Sep2020 19:58:59-DEBUG socket timeout: 60 18Sep2020 19:58:59-DEBUG https://bs10304.eu-central-1.snowflakecomputing.com:443 "POST /queries/v1/query-request?requestId=ed6ff317-f56e-48ad-8a6c-586ba40a80bd&request_guid=a0e6217b-7164-45bc-940d-1f70dc7f3abc HTTP/1.1" 200 None 18Sep2020 19:58:59-DEBUG SUCCESS 18Sep2020 19:58:59-DEBUG Active requests sessions: 0, idle: 1 18Sep2020 19:58:59-DEBUG ret[code] = None, after post request 18Sep2020 19:58:59-DEBUG sfqid: 0197048e-0091-7755-0000-3149006242ca 18Sep2020 19:58:59-INFO query execution done 18Sep2020 19:58:59-DEBUG SUCCESS 18Sep2020 19:58:59-DEBUG PUT OR GET: None 18Sep2020 19:58:59-DEBUG Query result format: arrow 18Sep2020 19:58:59-DEBUG Batches read: 1 18Sep2020 19:58:59-DEBUG Arrow BatchSize: 1 18Sep2020 19:58:59-DEBUG Init table iterator successfully, current chunk index: 0,chunk count: 0 18Sep2020 19:58:59-WARNING Getting the GRE_GWAS data in batches of 10. Got 1000 lines 18Sep2020 19:58:59-INFO fetching data into pandas dataframe done