Python 蟒蛇雪管摄食
我正在尝试使用pythonsdk使用snowpipe将数据摄取到snowflake中。如果我运行一个简单的copy命令,数据加载会很好,但是在使用python脚本时,甚至不会检测到文件。 下面是代码片段:Python 蟒蛇雪管摄食,python,amazon-web-services,snowflake-cloud-data-platform,Python,Amazon Web Services,Snowflake Cloud Data Platform,我正在尝试使用pythonsdk使用snowpipe将数据摄取到snowflake中。如果我运行一个简单的copy命令,数据加载会很好,但是在使用python脚本时,甚至不会检测到文件。 下面是代码片段: private_key_text = private_key_obj.private_bytes(Encoding.PEM, PrivateFormat.PKCS8, NoEncryption()).decode('utf-8') file_list=['order_items.csv']
private_key_text = private_key_obj.private_bytes(Encoding.PEM, PrivateFormat.PKCS8, NoEncryption()).decode('utf-8')
file_list=['order_items.csv']
ingest_manager = SimpleIngestManager(account='#####',
host='####.####.snowflakecomputing.com',
user='####',
pipe='SALES_DB.SALES_DWH.ORDER_ITEMS_PIPE',
private_key=private_key_text)
staged_file_list = []
for file_name in file_list:
staged_file_list.append(StagedFile(file_name, None))
try:
resp = ingest_manager.ingest_files(staged_file_list)
except HTTPError as e:
logger.error(e)
exit(1)
history_resp = ingest_manager.get_history()
print(history_resp)
上述代码的输出如下,文件列表始终显示为空,活动文件计数始终为0,即使csv文件订单项目。csv确实存在于存储桶中:
{'pipe': 'SALES_DB.SALES_DWH.ORDER_ITEMS_PIPE',
'completeResult': True,
'nextBeginMark': '6_-1',
'files': [],
'statistics': {'activeFilesCount': 0}}
此外,如果手动执行下面的复制命令,则可以正常工作,并将数据加载到表中:
copy into order_items
from @s3_sales_order_items_stage
on_error = CONTINUE;
任何建议都会有帮助,因为我已经尝试了python脚本的所有功能,但无法接收文件。身份验证和加密密钥已得到处理