<?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: Groupby Pivot in Materialized View in Data &amp; Schema Discussions</title>
    <link>https://community.incorta.com/t5/data-schema-discussions/groupby-pivot-in-materialized-view/m-p/4423#M347</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have had this problem when new values are added in the source data. The key for me was to force Incorta to think the script was different so it discovers the new "columns". I add a # on an empty line and it's enough to be different and pull in the new fields. The next time it happens I take the # out of the script for the next "change". Keep going back and forth each time the underlying data changes.&lt;/P&gt;&lt;P&gt;Ryan&lt;/P&gt;</description>
    <pubDate>Wed, 07 Jun 2023 21:38:48 GMT</pubDate>
    <dc:creator>rsather</dc:creator>
    <dc:date>2023-06-07T21:38:48Z</dc:date>
    <item>
      <title>Groupby Pivot in Materialized View</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/groupby-pivot-in-materialized-view/m-p/3820#M284</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a materialized view with pyspark where I change the shape of a dataframe using a groupby and pivot function to create many new columns&amp;nbsp; out of a pre existing column.&lt;/P&gt;&lt;P&gt;Like so:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;result = df.groupby("ItemId").pivot("Question").agg(first("Answer", ignorenulls = True))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;My code successfully validates, however when I attempt to load it, I run into the following error message:&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;-&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;INC_03020207: The result definition mismatches the current table definition. Columns [INCORTA LISTS THE COLUMN NAME VALUES I AM ATTEMPTING TO ADD HERE]&amp;nbsp;are missing(-)/extra(+). Please re-run table discovery&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;How can I overwrite / update the table definition to perform my transformation?&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 24 Feb 2023 19:51:36 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/groupby-pivot-in-materialized-view/m-p/3820#M284</guid>
      <dc:creator>mkrieger</dc:creator>
      <dc:date>2023-02-24T19:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Groupby Pivot in Materialized View</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/groupby-pivot-in-materialized-view/m-p/4423#M347</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have had this problem when new values are added in the source data. The key for me was to force Incorta to think the script was different so it discovers the new "columns". I add a # on an empty line and it's enough to be different and pull in the new fields. The next time it happens I take the # out of the script for the next "change". Keep going back and forth each time the underlying data changes.&lt;/P&gt;&lt;P&gt;Ryan&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 21:38:48 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/groupby-pivot-in-materialized-view/m-p/4423#M347</guid>
      <dc:creator>rsather</dc:creator>
      <dc:date>2023-06-07T21:38:48Z</dc:date>
    </item>
  </channel>
</rss>

