<?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: API Dataflow query returns error when publishing trying to publish to the Lakehouse in Activator</title>
    <link>https://community.fabric.microsoft.com/t5/Activator/API-Dataflow-query-returns-error-when-publishing-trying-to/m-p/3399958#M64</link>
    <description>&lt;P&gt;H Mark - you probably meant to post this in&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/Data-Factory-preview-Community/ct-p/datafactory" target="_blank"&gt;Data Factory (preview) Community - Microsoft Fabric Community&lt;/A&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Aug 2023 21:55:33 GMT</pubDate>
    <dc:creator>WillT</dc:creator>
    <dc:date>2023-08-25T21:55:33Z</dc:date>
    <item>
      <title>API Dataflow query returns error when publishing trying to publish to the Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Activator/API-Dataflow-query-returns-error-when-publishing-trying-to/m-p/3390867#M62</link>
      <description>&lt;P&gt;I am using dataflows gen2 to publish from an API to the Lakehouse (delta table). My first query pulls 50 records into the DF preview, then posts successfully to the Lakehouse.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I modify the M code to iterate over multiple API pages (pages &amp;lt;= 1), I get the exact table and schema in my DF preview, however when I attempt to publish what appears to be the exact same 50 records, I get an error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see both versions of the query attached. I've masked the API URL. Everything else is the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are both versions of M code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;**** This version completes the table in Dataflows, and allows me to post as Delta in my Lakehouse&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;Source = Json.Document(Web.Contents("&lt;A href="http://192.000.00.18:20002/api/CUSTOMERS.PBI" target="_blank"&gt;http://192.000.00.18:20002/api/CUSTOMERS.PBI&lt;/A&gt;")),&lt;BR /&gt;#"Converted to table" = Table.FromRecords({Source}),&lt;BR /&gt;#"Expanded customers" = Table.ExpandListColumn(#"Converted to table", "customers"),&lt;BR /&gt;#"Expanded customers1" = Table.ExpandRecordColumn(#"Expanded customers", "customers", {"id", "date_entered", "name", "full_name", "phone", "customer_type", "customer_type_desc", "email", "terrritory", "rank", "sales_rep", "sales_rep_name", "vendor_nbr", "credit_limit", "cat_tax", "tax_nbr", "shop_name", "billing_address"}, {"customers.id", "customers.date_entered", "customers.name", "customers.full_name", "customers.phone", "customers.customer_type", "customers.customer_type_desc", "customers.email", "customers.terrritory", "customers.rank", "customers.sales_rep", "customers.sales_rep_name", "customers.vendor_nbr", "customers.credit_limit", "customers.cat_tax", "customers.tax_nbr", "customers.shop_name", "customers.billing_address"}),&lt;BR /&gt;#"Expanded customers.billing_address" = Table.ExpandListColumn(#"Expanded customers1", "customers.billing_address"),&lt;BR /&gt;#"Expanded customers.billing_address1" = Table.ExpandRecordColumn(#"Expanded customers.billing_address", "customers.billing_address", {"id", "company_id", "address1", "address2", "city", "province", "zip"}, {"customers.billing_address.id", "customers.billing_address.company_id", "customers.billing_address.address1", "customers.billing_address.address2", "customers.billing_address.city", "customers.billing_address.province", "customers.billing_address.zip"}),&lt;BR /&gt;#"Changed column type" = Table.TransformColumnTypes(#"Expanded customers.billing_address1", {&lt;BR /&gt;{"customers.id", Int64.Type},&lt;BR /&gt;{"customers.date_entered", type date},&lt;BR /&gt;{"customers.name", type text},&lt;BR /&gt;{"customers.full_name", type text},&lt;BR /&gt;{"customers.phone", Int64.Type},&lt;BR /&gt;{"customers.customer_type", type text},&lt;BR /&gt;{"customers.customer_type_desc", type text},&lt;BR /&gt;{"customers.email", type text},&lt;BR /&gt;{"customers.terrritory", Int64.Type},&lt;BR /&gt;{"customers.rank", type text},&lt;BR /&gt;{"customers.sales_rep", Int64.Type},&lt;BR /&gt;{"customers.sales_rep_name", type text},&lt;BR /&gt;{"customers.vendor_nbr", type text},&lt;BR /&gt;{"customers.credit_limit", Int64.Type},&lt;BR /&gt;{"customers.cat_tax", type text},&lt;BR /&gt;{"customers.tax_nbr", type text},&lt;BR /&gt;{"customers.shop_name", type text},&lt;BR /&gt;{"customers.billing_address.id", Int64.Type},&lt;BR /&gt;{"customers.billing_address.company_id", type text},&lt;BR /&gt;{"customers.billing_address.address1", type text},&lt;BR /&gt;{"customers.billing_address.address2", type text},&lt;BR /&gt;{"customers.billing_address.city", type text},&lt;BR /&gt;{"customers.billing_address.province", type text},&lt;BR /&gt;{"customers.billing_address.zip", type text},&lt;BR /&gt;{"status", type text},&lt;BR /&gt;{"statusmsg", type text}&lt;BR /&gt;})&lt;BR /&gt;in&lt;BR /&gt;#"Changed column type"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//----------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;**** This version completes the table in Dataflows, but ERRORS when trying to post to my Lakehouse&lt;/FONT&gt;&lt;BR /&gt;Dataflow ID: 4c893113-92f1-411f-835a-68eb7801be47&lt;BR /&gt;Session ID: d4fc34fa-7e6b-9edf-3c01-ea927ed87749&lt;BR /&gt;Root activity ID: e28dab67-5c68-46ae-a659-20be76b3a0e4&lt;BR /&gt;Time: 2023-08-21T18:23:35.257Z&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*let&lt;BR /&gt;// Define the base URL&lt;BR /&gt;baseUrl = "&lt;A href="http://192.000.00.18:20002/api/CUSTOMERS.PBI" target="_blank"&gt;http://192.000.00.18:20002/api/CUSTOMERS.PBI&lt;/A&gt;",&lt;/P&gt;&lt;P&gt;// ****** Function to get data from a specific pages *******&lt;/P&gt;&lt;P&gt;GetDataFromPage = (page) =&amp;gt;&lt;BR /&gt;let&lt;BR /&gt;// Append page number to the URL&lt;BR /&gt;url = baseUrl &amp;amp; "?page=" &amp;amp; Text.From(page),&lt;BR /&gt;Source = Json.Document(Web.Contents(url)),&lt;BR /&gt;ConvertedTable = Table.FromRecords({Source})&lt;BR /&gt;&lt;BR /&gt;in&lt;BR /&gt;ConvertedTable,&lt;/P&gt;&lt;P&gt;// ******* END NESTED FUNCTION ***********************&lt;BR /&gt;&lt;BR /&gt;// "PAGES" Define the number of pages available (adjust as needed)&lt;BR /&gt;maxPages = 1,&lt;BR /&gt;&lt;BR /&gt;// Create a list that holds the data from all pages&lt;BR /&gt;allData = List.Generate(&lt;BR /&gt;() =&amp;gt; [page = 1, data = GetDataFromPage(1)],&lt;BR /&gt;each [page] &amp;lt;= maxPages,&lt;BR /&gt;each [page = [page] + 1, data = GetDataFromPage([page])],&lt;BR /&gt;each [data]&lt;BR /&gt;),&lt;BR /&gt;&lt;BR /&gt;// Combine all the data from different pages&lt;BR /&gt;combinedData = Table.Combine(allData),&lt;BR /&gt;&lt;BR /&gt;// Expand customers&lt;BR /&gt;#"Expanded customers" = Table.ExpandListColumn(combinedData, "customers"),&lt;/P&gt;&lt;P&gt;#"Expanded customers1" = Table.ExpandRecordColumn(#"Expanded customers", "customers", {"id", "date_entered", "name", "full_name", "phone", "customer_type", "customer_type_desc", "email", "terrritory", "rank", "sales_rep", "sales_rep_name", "vendor_nbr", "credit_limit", "cat_tax", "tax_nbr", "shop_name", "billing_address"}, {"customers.id", "customers.date_entered", "customers.name", "customers.full_name", "customers.phone", "customers.customer_type", "customers.customer_type_desc", "customers.email", "customers.terrritory", "customers.rank", "customers.sales_rep", "customers.sales_rep_name", "customers.vendor_nbr", "customers.credit_limit", "customers.cat_tax", "customers.tax_nbr", "customers.shop_name", "customers.billing_address"}),&lt;BR /&gt;#"Expanded customers.billing_address" = Table.ExpandListColumn(#"Expanded customers1", "customers.billing_address"),&lt;BR /&gt;#"Expanded customers.billing_address1" = Table.ExpandRecordColumn(#"Expanded customers.billing_address", "customers.billing_address", {"id", "company_id", "address1", "address2", "city", "province", "zip"}, {"customers.billing_address.id", "customers.billing_address.company_id", "customers.billing_address.address1", "customers.billing_address.address2", "customers.billing_address.city", "customers.billing_address.province", "customers.billing_address.zip"}),&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// Change column schema&lt;BR /&gt;#"Changed column type" = Table.TransformColumnTypes(#"Expanded customers.billing_address1", {&lt;BR /&gt;{"customers.id", Int64.Type},&lt;BR /&gt;{"customers.date_entered", type date},&lt;BR /&gt;{"customers.name", type text},&lt;BR /&gt;{"customers.full_name", type text},&lt;BR /&gt;{"customers.phone", Int64.Type},&lt;BR /&gt;{"customers.customer_type", type text},&lt;BR /&gt;{"customers.customer_type_desc", type text},&lt;BR /&gt;{"customers.email", type text},&lt;BR /&gt;{"customers.terrritory", Int64.Type},&lt;BR /&gt;{"customers.rank", type text},&lt;BR /&gt;{"customers.sales_rep", Int64.Type},&lt;BR /&gt;{"customers.sales_rep_name", type text},&lt;BR /&gt;{"customers.vendor_nbr", type text},&lt;BR /&gt;{"customers.credit_limit", Int64.Type},&lt;BR /&gt;{"customers.cat_tax", type text},&lt;BR /&gt;{"customers.tax_nbr", type text},&lt;BR /&gt;{"customers.shop_name", type text},&lt;BR /&gt;{"customers.billing_address.id", type text},&lt;BR /&gt;{"customers.billing_address.company_id", type text},&lt;BR /&gt;{"customers.billing_address.address1", type text},&lt;BR /&gt;{"customers.billing_address.address2", type text},&lt;BR /&gt;{"customers.billing_address.city", type text},&lt;BR /&gt;{"customers.billing_address.province", type text},&lt;BR /&gt;{"customers.billing_address.zip", type text},&lt;BR /&gt;{"status", type text},&lt;BR /&gt;{"statusmsg", type text}&lt;BR /&gt;})&lt;BR /&gt;&lt;BR /&gt;in&lt;BR /&gt;#"Changed column type"*/&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 18:51:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Activator/API-Dataflow-query-returns-error-when-publishing-trying-to/m-p/3390867#M62</guid>
      <dc:creator>mwaltercpa</dc:creator>
      <dc:date>2023-08-21T18:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: API Dataflow query returns error when publishing trying to publish to the Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Activator/API-Dataflow-query-returns-error-when-publishing-trying-to/m-p/3399958#M64</link>
      <description>&lt;P&gt;H Mark - you probably meant to post this in&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/Data-Factory-preview-Community/ct-p/datafactory" target="_blank"&gt;Data Factory (preview) Community - Microsoft Fabric Community&lt;/A&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2023 21:55:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Activator/API-Dataflow-query-returns-error-when-publishing-trying-to/m-p/3399958#M64</guid>
      <dc:creator>WillT</dc:creator>
      <dc:date>2023-08-25T21:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: API Dataflow query returns error when publishing trying to publish to the Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Activator/API-Dataflow-query-returns-error-when-publishing-trying-to/m-p/3411850#M70</link>
      <description>&lt;P&gt;Thanks Will!&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2023 04:51:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Activator/API-Dataflow-query-returns-error-when-publishing-trying-to/m-p/3411850#M70</guid>
      <dc:creator>mwaltercpa</dc:creator>
      <dc:date>2023-09-02T04:51:52Z</dc:date>
    </item>
  </channel>
</rss>

