write_pandas snowflake connector function is not able to operate on table(WRITE_PANDAS雪花连接器函数无法在表上操作)
问题描述
我正在使用一个python脚本,该脚本旨在处理一些数据,如果不存在则创建表,并在插入刷新的数据集之前截断该表。我使用的角色具有USAGE、READ、WRITE、CREATE TABLE权限,以及如下设置的STAGE权限:
grant usage, read, write on future stages in schema <schema> to role <role>
我通过雪花连接器在Python中使用write_pandas函数。文档说明此函数使用PUT和COPY INTO命令:
To write the data to the table, the function saves the data to Parquet files, uses the PUT command to upload these files to a temporary stage, and uses the COPY INTO <table> command to copy the data from the files to the table. You can use some of the function parameters to control how the PUT and COPY INTO <table> statements are executed.
我仍然收到错误消息,即我无法对架构进行操作,并且我不确定还需要添加什么。是否有人拥有运行WRITE_PANDAS命令所需的权限列表?
推荐答案
write_pandas()
不会自动创建表。如果事先不存在该表,则需要您自己创建该表。对于您每次运行write_pandas()
,它只会将数据帧追加到您指定的表中。
另一方面,如果您使用df.to_sql(..., method=pd_writer)
将 pandas 数据帧写入雪花,它会自动为您创建表,如果表已经存在,您可以使用to_sql()
中的if_exists
指定不同的行为-追加、替换或失败。
这篇关于WRITE_PANDAS雪花连接器函数无法在表上操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:WRITE_PANDAS雪花连接器函数无法在表上操作


- pytorch 中的自适应池是如何工作的? 2022-07-12
- python-m http.server 443--使用SSL? 2022-01-01
- 如何在 Python 的元组列表中对每个元组中的第一个值求和? 2022-01-01
- python check_output 失败,退出状态为 1,但 Popen 适用于相同的命令 2022-01-01
- 沿轴计算直方图 2022-01-01
- 如何在 python3 中将 OrderedDict 转换为常规字典 2022-01-01
- 如何将一个类的函数分成多个文件? 2022-01-01
- padding='same' 转换为 PyTorch padding=# 2022-01-01
- 分析异常:路径不存在:dbfs:/databricks/python/lib/python3.7/site-packages/sampleFolder/data; 2022-01-01
- 使用Heroku上托管的Selenium登录Instagram时,找不到元素';用户名'; 2022-01-01