OperationalError:250003:无法获取响应。挂吗方法:发布

时间:2019-12-24 16:12:15

标签: python snowflake-data-warehouse

我正在尝试使用我的登录凭据连接到雪花。我正在使用以下代码:

snowflake.connector.connect(
    user="<my_user_name>",
    password="<my_password>",
    account="<my_account_name_with_region_and_cloud>"
    )

当我尝试运行以上代码时,出现以下错误:

OperationalError:250003:无法获取响应。挂吗方法:发布,网址:https://hm53485.us-east-2.aws.snowflakecomputing.com:443/session/v1/login-request?request_id=fcfdd77a-11ff-4956-9ed8-bcc332c5989a&databaseName=S3_DB&schemaName=PUBLIC&warehouse=COMPUTE_WH&request_guid=b9fdb5c9-81cb-4ecb-8d20-abef44249bbf

我确定我所有的包裹都是最新的。我正在使用python 3.6.4和最新的snowflare_connector_python。

我目前在aws的 us-east-2 位置。

有人可以帮我这个忙吗??

2 个答案:

答案 0 :(得分:0)

我正在使用sqlalchemy,您可以通过pip安装它:

pip install SQLAlchemy

https://docs.snowflake.net/manuals/user-guide/sqlalchemy.html

这是我笔记本开头的内容:

import snowflake.connector
import pandas as pd
from sqlalchemy import create_engine
from snowflake.sqlalchemy import URL

url = URL(
    account = 'xxxxxxxx.east-us-2.azure',
    user = 'xxxxxxxx',
    password = 'xxxxxxxx',
    database = 'xxxxxxxx',
    schema = 'xxxxxxxx',
    warehouse = 'xxxxxxxx',
    role='xxxxxxxx'
)

engine = create_engine(url)
connection = engine.connect()

query = '''
    select 1 AS VAL;
'''

df = pd.read_sql(query, connection)

df

答案 1 :(得分:0)

Just Give your account name in the account .We dont need the region and full URL.
Please check below .

----------------------------------------------------------------------
import snowflake.connector


PASSWORD = '*******'
USER = '<USERNAME>'
ACCOUNT = 'SFCSUPPORT'
WAREHOUSE = '<WHNAME>'
DATABASE = '<DBNAME>'
SCHEMA = 'PUBLIC'

print("Connecting...")
# -- (> ------------------- SECTION=connect_to_snowflake --------------------
con = snowflake.connector.connect(
  user=USER,
  password=PASSWORD,
  account=ACCOUNT,
  warehouse=WAREHOUSE,
  database=DATABASE,
  schema=SCHEMA
)


con.cursor().execute("USE WAREHOUSE " + WAREHOUSE)
con.cursor().execute("USE DATABASE " + DATABASE)
#con.cursor().execute("USE SCHEMA INFORMATION_SCHEMA")


try:
    result = con.cursor().execute("Select * from <TABLE>")
    result_list = result.fetchall()
    print(result_list)

finally:
    con.cursor().close()
con.cursor().close()