04-10-2022 10:56 PM
I write data to s3 like
data.write.format("delta").mode("append").option("mergeSchema", "true").save(s3_location)
and create a partitioned table like
CREATE TABLE IF NOT EXISTS demo_table
USING DELTA
PARTITIONED BY (column_a)
LOCATION {s3_location};
which throws an error
Error in SQL statement: AnalysisException: It is not allowed to specify partitioning when the table schema is not defined.
Is there a different way to write to s3 location so that I can solve this issue
04-11-2022 01:10 PM
@John Constantine , In CREATE TABLE, you need to specify fields:
CREATE TABLE IF NOT EXISTS demo_table
(column_a STRING,
number INT)
USING DELTA PARTITIONED BY
(column_a)
LOCATION
{s3_location};
and when you save data before creating a table, it should include a partition. I think it better first register the table and then write to it.
04-11-2022 01:10 PM
@John Constantine , In CREATE TABLE, you need to specify fields:
CREATE TABLE IF NOT EXISTS demo_table
(column_a STRING,
number INT)
USING DELTA PARTITIONED BY
(column_a)
LOCATION
{s3_location};
and when you save data before creating a table, it should include a partition. I think it better first register the table and then write to it.
04-13-2022 03:01 AM
Hi @John Constantine , Did the above suggestions provided by @Hubert Dudek help your case?
Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections.
Click here to register and join today!
Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.