簡體   English   中英

在 Python 中運行雪花查詢

[英]Running Snowflake query in Python

我正在處理一個場景,我必須在數據庫是雪花的 Python 中執行一些類似 ETL 的操作。 I am new to Python and after installing the pip for the Python and Snowflake connector, I am trying to run a simple code for doing a select * from a table. 我添加了來自各種來源的代碼片段,以了解該過程是如何工作的。 我收到以下錯誤,不幸的是無法在網上找到任何確鑿的信息。

錯誤:

OperationalError:250003:未能獲得響應。 絞刑? method: post, url: https://nq13914.southeast-asia.snowflakecomputing.com:443/session/v1/login-request?request_id=7325eb5e-eec6-4ec9-976a-6dbd00852fc3&databaseName=util_db&schemaName=public&warehouse=compute_wh&request_guid=4674d312- 5cfd-4944-a8db-7dda073b7b44

代碼:

import snowflake.connector as sf
import pandas


ctx = sf.connect (
    user = 'floatinginthecloud89',
    password = '',
    account = 'nq13914.southeast-asia',
    warehouse = 'compute_wh',
    database = 'util_db',
    schema = 'public'
)
print("Got the context object")

cs = ctx.cursor()
print("Got the cursor object")


try:
    cs.execute("select * from util_db.public.qwerty1;")
    df = cs.fetch_pandas_all()
    df.info()
    print("__________")
    print(df.to_string())
finally:
    cs.close()     
ctx.close()     

您的代碼適用於我自己的 Snowflake 帳戶。 似乎您的雪花帳戶(或您公司正在使用的帳戶)錯誤或應用了某些 網絡策略

使用您的瀏覽器,您應該能夠從 go 到https://nq13914.southeast-asia.snowflakecomputing.com/console/login#/並看到登錄屏幕。 在您的情況下,您不能(我也不能)所以nq13914.southeast-asia要么錯誤,要么被阻止。

我能夠運行腳本。 在面臨的問題中,安裝的軟件包由於版本而導致問題。 於是卸載重裝。 在它工作之前必須這樣做幾次。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM