You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
os.environ['MAX_CON_RETRY_ATTEMPTS'] ='0'importsnowflake.connector# Establish a connection to Snowflakectx=snowflake.connector.connect(
account=SNOWFLAKE_ACCOUNT,
user=SNOWFLAKE_USER,
password=SNOWFLAKE_PASS,
warehouse='WH',
proxy_host=PROXY_HOST, # proxy setproxy_port=PROXY_PORT, # proxy setdatabase='DB',
schema='SCHEMA',
role='ROLE',
protocol='https',
login_timeout=10
)
# Note result size needs to be large enough to trigger connection Azure Blob Storage (XXXXXXX.blob.core.windows.net)query="""select * from table"""cur=ctx.cursor()
cur.execute(query)
results=cur.fetchall()
What did you expect to see?
Result should have been returned. This works fine for small queries, but large queries trigger Azure Blob connection that fails. These queries are being executed behind a corporate firewall. It appears that the proxies are not being passed to urllib3 when the Azure blob connection is being made. In addition, the connection keeps retrying, causing the whole process to hang. I've tried extensively to at least be able to raise an exception and halt retries, but have been unsuccessful with this as well. I expect to be able to execute "Large" snowflake queries behind a firewall (without setting proxy in the OS env) when the proxy variables are passed to the snowflake connector. In addition, I expect some capability to halt or limit retries when proxy is not set / passed.
Error:
packages/snowflake/connector/vendored/urllib3/connection.py", line 179, in _new_conn raise ConnectTimeoutError( snowflake.connector.vendored.urllib3.exceptions.ConnectTimeoutError: (<snowflake.connector.vendored.urllib3.connection.HTTPSConnection object at>, 'Connection to XXXXXXX.blob.core.windows.net timed out. (connect timeout=7)')
Can you set logging to DEBUG and collect the logs?
connector/vendored/urllib3/connectionpool.py:1019 Starting new HTTPS connection (10): XXXXXXX.blob.core.windows.net:443
DEBUG [2024-12-20 10:05:47,652] retry snowflake/connector/vendored/urllib3/util/retry.py:594 Incremented Retry for (url='/results/XXXXXXX=gzip'): Retry(total=0, connect=None, read=None, redirect=None, status=None)
WARNING [2024-12-20 10:05:47,652] connectionpool snowflake/connector/vendored/urllib3/connectionpool.py:824 Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<snowflake.connector.vendored.urllib3.connection.HTTPSConnection object at XXXXXXX>, 'Connection to XXXXXXX.blob.core.windows.net timed out. (connect timeout=7)')': /results/XXXXXXX=gzip
DEBUG [2024-12-20 10:05:47,652] connectionpool snowflake/connector/vendored/urllib3/connectionpool.py:1019 Starting new HTTPS connection (10): XXXXXXX.blob.core.windows.net:443
DEBUG [2024-12-20 10:05:58,837] network snowflake/connector/network.py:1226 Session status for SessionPool 'None', SessionPool 3/4 active sessions
ERROR [2024-12-20 10:05:58,837] result_batch snowflake/connector/result_batch.py:362 Failed to fetch the large result set batch XXXXXXX for the 5 th time, backing off for 14s for the reason: 'HTTPSConnectionPool(host='XXXXXXX.blob.core.windows.net', port=443): Max retries exceeded with url: /results/XXXXXXX =gzip (Caused by ConnectTimeoutError(<snowflake.connector.vendored.urllib3.connection.HTTPSConnection object at XXXXXXX >, 'Connection to XXXXXXX.blob.core.windows.net timed out. (connect timeout=7)'))'
The text was updated successfully, but these errors were encountered:
It looks like these proxy parameters (proxy_host, proxy_port) are no longer supported, which explains why they don't work. Was there a reason they were removed? I'm not seeing any possible workarounds for my use-case with the current version of this package.
Can you please try that and see how it works for you ?
You can also set those envvars exclusively for the Python process if you don't want to export them globally: HTTPS_PROXY=http://my.pro.xy 8080 python myscript.py
or inside the program itself should also work
Python version
3.12.3
Operating system and processor architecture
Ubuntu 24.04
Installed packages
What did you do?
What did you expect to see?
Result should have been returned. This works fine for small queries, but large queries trigger Azure Blob connection that fails. These queries are being executed behind a corporate firewall. It appears that the proxies are not being passed to urllib3 when the Azure blob connection is being made. In addition, the connection keeps retrying, causing the whole process to hang. I've tried extensively to at least be able to raise an exception and halt retries, but have been unsuccessful with this as well. I expect to be able to execute "Large" snowflake queries behind a firewall (without setting proxy in the OS env) when the proxy variables are passed to the snowflake connector. In addition, I expect some capability to halt or limit retries when proxy is not set / passed.
Error:
packages/snowflake/connector/vendored/urllib3/connection.py", line 179, in _new_conn raise ConnectTimeoutError( snowflake.connector.vendored.urllib3.exceptions.ConnectTimeoutError: (<snowflake.connector.vendored.urllib3.connection.HTTPSConnection object at>, 'Connection to XXXXXXX.blob.core.windows.net timed out. (connect timeout=7)')
Can you set logging to DEBUG and collect the logs?
The text was updated successfully, but these errors were encountered: