【发布时间】:2021-11-13 12:07:43
【问题描述】:
我在 Redshift 上有一个表,我想使用 pyspark 数据框向其中插入一些数据。
redshift 表有架构:
CREATE TABLE admin.audit_of_all_tables
(
wh_table_name varchar,
wh_schema_name varchar,
wh_population_method integer,
wh_audit_date timestamp without time,
wh_percent_change numeric(15,5),
wh_s3_path varchar
)
DISTSTYLE AUTO;
在我的数据框中,我只想保留前 4 列的值并将该数据框的数据写入此表。
我的数据框是这样的:
现在,我想在 Redshift 上对我的表执行 df.write.format,但我需要以某种方式指定我只想将数据插入前四列并且不为最后两列传递任何值(保持它们为空默认)。
知道如何使用dataframe.write.format(或任何方法)来指定它。
感谢阅读。
【问题讨论】:
标签: python dataframe pyspark apache-spark-sql amazon-redshift