我是雪花的新手,并尝试使用python连接到数据库,但是在执行代码时出现此错误“ snowflake.connector.errors.ProgrammingError:251005:用户为空”
import snowflake.connector
ctx = snowflake.connector.connect(
username = 'xxx',
password = 'xxxx',
account = 'xxxx'
)
cs = ctx.cursor()
try:
cs.execute(''' some query''')
one_row = cs.fetchone()
print(one_row[0])
finally:
cs.close()
ctx.close()
答案 0 :(得分:3)
您应该使用“ user”参数代替“ username”。这是示例:
con = snowflake.connector.connect(
user='XXXX',
password='XXXX',
account='XXXX'
)
请检查:https://docs.snowflake.com/en/user-guide/python-connector-example.html#setting-session-parameters