<?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: Delta Live Tables not inferring table schema properly. in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/delta-live-tables-not-inferring-table-schema-properly/m-p/32471#M23665</link>
    <description>&lt;P&gt;I was able to get around this by specifying the table schema in the table decorator. &lt;/P&gt;</description>
    <pubDate>Tue, 06 Sep 2022 08:44:58 GMT</pubDate>
    <dc:creator>BenLambert</dc:creator>
    <dc:date>2022-09-06T08:44:58Z</dc:date>
    <item>
      <title>Delta Live Tables not inferring table schema properly.</title>
      <link>https://community.databricks.com/t5/data-engineering/delta-live-tables-not-inferring-table-schema-properly/m-p/32470#M23664</link>
      <description>&lt;P&gt;I have a delta live tables pipeline that is loading and transforming data. Currently I am having a problem that the schema inferred by DLT does not match the actual schema of the table. The table is generated via a groupby.pivot operation as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; gb = (
        df.groupBy(['unique_trip_id', 'signal', 'value'])
        .count()
    )
    
    gb = (
         gb.groupBy(['unique_trip_id','value'])
        .pivot("signal")
        .sum("count")
        .fillna(0)
    )&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get the following error message:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;org.apache.spark.sql.AnalysisException: A schema mismatch detected when writing to the Delta table (Table ID: fdecc1fa-fadd-4779-bc43-d93d87c9cc9e).&lt;/P&gt;&lt;P&gt;To enable schema migration using DataFrameWriter or DataStreamWriter, please set:&lt;/P&gt;&lt;P&gt;'.option("mergeSchema", "true")'.&lt;/P&gt;&lt;P&gt;For other operations, set the session configuration&lt;/P&gt;&lt;P&gt;spark.databricks.delta.schema.autoMerge.enabled to "true". See the documentation&lt;/P&gt;&lt;P&gt;specific to the operation for details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is how can I set this option in my notebook for delta live tables? Or am I doing something wrong that is causing the schema inference to fail?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 07:48:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/delta-live-tables-not-inferring-table-schema-properly/m-p/32470#M23664</guid>
      <dc:creator>BenLambert</dc:creator>
      <dc:date>2022-09-06T07:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Delta Live Tables not inferring table schema properly.</title>
      <link>https://community.databricks.com/t5/data-engineering/delta-live-tables-not-inferring-table-schema-properly/m-p/32471#M23665</link>
      <description>&lt;P&gt;I was able to get around this by specifying the table schema in the table decorator. &lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 08:44:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/delta-live-tables-not-inferring-table-schema-properly/m-p/32471#M23665</guid>
      <dc:creator>BenLambert</dc:creator>
      <dc:date>2022-09-06T08:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Delta Live Tables not inferring table schema properly.</title>
      <link>https://community.databricks.com/t5/data-engineering/delta-live-tables-not-inferring-table-schema-properly/m-p/32472#M23666</link>
      <description>&lt;P&gt;thank you for your reply. I will mark your response as best.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 23:08:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/delta-live-tables-not-inferring-table-schema-properly/m-p/32472#M23666</guid>
      <dc:creator>jose_gonzalez</dc:creator>
      <dc:date>2022-09-09T23:08:50Z</dc:date>
    </item>
  </channel>
</rss>

