<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unable to create a partitioned table on s3 data in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/unable-to-create-a-partitioned-table-on-s3-data/m-p/23174#M15964</link>
    <description>&lt;P&gt;@John Constantine​&amp;nbsp;, In CREATE TABLE, you need to specify fields:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CREATE TABLE IF NOT EXISTS demo_table
    (column_a STRING,
    number INT)
USING DELTA PARTITIONED BY
     (column_a)
LOCATION 
   {s3_location};&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;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.&lt;/P&gt;</description>
    <pubDate>Mon, 11 Apr 2022 20:10:21 GMT</pubDate>
    <dc:creator>Hubert-Dudek</dc:creator>
    <dc:date>2022-04-11T20:10:21Z</dc:date>
    <item>
      <title>Unable to create a partitioned table on s3 data</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-create-a-partitioned-table-on-s3-data/m-p/23173#M15963</link>
      <description>&lt;P&gt;I write data to s3 like &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data.write.format("delta").mode("append").option("mergeSchema", "true").save(s3_location)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and create a partitioned table like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CREATE TABLE IF NOT EXISTS demo_table
USING DELTA
PARTITIONED BY (column_a)
LOCATION {s3_location};&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which throws an error&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Error in SQL statement: AnalysisException: It is not allowed to specify partitioning when the table schema is not defined.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there a different way to write to s3 location so that I can solve this issue&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 05:56:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-create-a-partitioned-table-on-s3-data/m-p/23173#M15963</guid>
      <dc:creator>Constantine</dc:creator>
      <dc:date>2022-04-11T05:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to create a partitioned table on s3 data</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-create-a-partitioned-table-on-s3-data/m-p/23174#M15964</link>
      <description>&lt;P&gt;@John Constantine​&amp;nbsp;, In CREATE TABLE, you need to specify fields:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CREATE TABLE IF NOT EXISTS demo_table
    (column_a STRING,
    number INT)
USING DELTA PARTITIONED BY
     (column_a)
LOCATION 
   {s3_location};&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 20:10:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-create-a-partitioned-table-on-s3-data/m-p/23174#M15964</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-04-11T20:10:21Z</dc:date>
    </item>
  </channel>
</rss>

