<?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: Parameterising a Json to SQL DW Mappingundefined in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Parameterising-a-Json-to-SQL-DW-Mappingundefined/m-p/4234977#M4515</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/76077"&gt;@DebbieE&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found a blog about dynamic mapping in Azure Data Factory. You may try if the solution can be adjusted to be applied to the data pipeline in Fabric. It might be helpful.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://sqlkover.com/dynamically-map-json-to-sql-in-azure-data-factory/" target="_blank" rel="noopener"&gt;Dynamically Map JSON to SQL in Azure Data Factory | Under the kover of business intelligence (sqlkover.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Jing&lt;BR /&gt;Community Support Team&lt;/P&gt;</description>
    <pubDate>Wed, 09 Oct 2024 09:16:30 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-10-09T09:16:30Z</dc:date>
    <item>
      <title>Parameterising a Json to SQL DW Mappingundefined</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Parameterising-a-Json-to-SQL-DW-Mappingundefined/m-p/4233464#M4492</link>
      <description>&lt;P&gt;I have JSON files in a folder.&lt;/P&gt;&lt;P&gt;I am delta loading them into a SQL Data Warehouse dependant upon if they have been processed or now.&lt;/P&gt;&lt;P&gt;At the start I have a lookup that triggers a Stored Procedure&amp;nbsp;usp_GET_PIPELINE_PARAMETERS which gets 1 row out or PIPELINE_PARAMETERS table based on the PipelineName&lt;/P&gt;&lt;P&gt;So I have sqlTable sqlSchema container, sourceFolder, file etc. And it picks the correct parametes to add to my pipeline. E.g.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;@&lt;/SPAN&gt;&lt;SPAN&gt;activity(&lt;/SPAN&gt;&lt;SPAN&gt;'LookupGetParameters'&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;output&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;firstRow&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;rootFolder into my Get Metadata activity&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;this all works well untill we get to the mapping.&amp;nbsp; i have to have a mapping because of the slight complexity of the schema. It has multiple ids for example within different arrays. in and out is also in multiple times within different arrays. So you have to create a mapping.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I added a mapping&amp;nbsp; parameter and copied the working mapping from the original files JSON. But its not working. This is in SQL&amp;nbsp; (Example, I have changed the names)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'{"type": "TabularTranslator", "mappings":&lt;BR /&gt;[{ "source": { "path": "[''id'']" }, "sink": { "name": "coach_id", "type": "String" } },&lt;BR /&gt;{ "source": { "path": "[''load'']" }, "sink": { "name": "coach_load", "type": "Int32" } },&lt;BR /&gt;{ "source": { "path": "[''staff''][''roletype'']" }, "sink": { "name": "staff_roletype", "type": "Int32" } },&lt;BR /&gt;{ "source": { "path": "[''staff''][''departments'']" }, "sink": { "name": "staff_departments", "type": "Int32" } },&lt;BR /&gt;{ "source": { "path": "[''staffleaving''][''roletype'']" }, "sink": { "name": "staffleaving_roletype", "type": "Int32" } },&lt;BR /&gt;{ "source": { "path": "[''staffleaving''][''departments'']" }, "sink": { "name": "staffleaving_departments", "type": "Int32" } },&lt;BR /&gt;{ "source": { "path": "$[''created'']" }, "sink": { "name": "created", "type": "DateTime" } },&lt;BR /&gt;{ "source": { "path": "$[''#calibrated'']" }, "sink": { "name": "calibrated", "type": "String" } },&lt;BR /&gt;{ "source": { "path": "$[''meta''][''headcode'']" }, "sink": { "name": "headcode", "type": "String" } },&lt;BR /&gt;{ "source": { "path": "$[''meta''][''station''][''id'']" }, "sink": { "name": "station_id", "type": "String" } },&lt;BR /&gt;{ "source": { "path": "$[''meta''][''station''][''lon'']" }, "sink": { "name": "lon", "type": "Single" } },&lt;BR /&gt;{ "source": { "path": "$[''meta''][''station''][''lat'']" }, "sink": { "name": "lat", "type": "Single" } },&lt;BR /&gt;{ "source": { "path": "$[''counts''][''load'']" }, "sink": { "name": "count_load", "type": "Int32" } },&lt;BR /&gt;{ "source": { "path": "$[''counts''][''staff'']" }, "sink": { "name": "staff", "type": "Int32" } },&lt;BR /&gt;{ "source": { "path": "$[''counts''][''staffleaving'']" }, "sink": { "name": "staffleaving", "type": "Int32" } },&lt;BR /&gt;{ "source": { "path": "$[''staff_id'']" }, "sink": { "name": "staff_id", "type": "String" } },&lt;BR /&gt;{ "source": { "path": "$[''ImportDate'']" }, "sink": { "name": "ImportDate", "type": "DateTime" } },&lt;BR /&gt;{ "source": { "path": "$[''FileName'']" }, "sink": { "name": "FileName" } } ],&lt;BR /&gt;"collectionReference": "$[''departments'']", "mapComplexValuesToString": true } } }'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;And in the copy data activity I have mapping:&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;@&lt;/SPAN&gt;&lt;SPAN&gt;activity(&lt;/SPAN&gt;&lt;SPAN&gt;'LookupGetParameters'&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;output&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;firstRow&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;mapping&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I have this going into a set variable so I can see the output and it matches the SQL (Obviously '' is now ')&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I run the pipeline and I just get the meta data in my end SQL Table. No data. So 2 files are in the load and I get 2 rows with no data.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I am really struggling with creating a way of parameterising the mapping. Can anyone help on this?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;When I look at the output of the Set Variable it contains lots of \. E.g.&amp;nbsp;[{\"source\":{\"path\":\"['id']\"},\"sink\": So I think that is what causing the issue. But I have tried doing the following&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;@&lt;/SPAN&gt;&lt;SPAN&gt;string(json(activity(&lt;/SPAN&gt;&lt;SPAN&gt;'LookupGetParameters'&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;output&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;firstRow&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;mapping&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;@&lt;/SPAN&gt;&lt;SPAN&gt;replace(string(json(activity(&lt;/SPAN&gt;&lt;SPAN&gt;'LookupGetParameters'&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;output&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;firstRow&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;mapping&lt;/SPAN&gt;&lt;SPAN&gt;)),&lt;/SPAN&gt;&lt;SPAN&gt;'/'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;''&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But this hasnt seemed to work either.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 08 Oct 2024 11:58:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Parameterising-a-Json-to-SQL-DW-Mappingundefined/m-p/4233464#M4492</guid>
      <dc:creator>DebbieE</dc:creator>
      <dc:date>2024-10-08T11:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Parameterising a Json to SQL DW Mappingundefined</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Parameterising-a-Json-to-SQL-DW-Mappingundefined/m-p/4234977#M4515</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/76077"&gt;@DebbieE&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found a blog about dynamic mapping in Azure Data Factory. You may try if the solution can be adjusted to be applied to the data pipeline in Fabric. It might be helpful.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://sqlkover.com/dynamically-map-json-to-sql-in-azure-data-factory/" target="_blank" rel="noopener"&gt;Dynamically Map JSON to SQL in Azure Data Factory | Under the kover of business intelligence (sqlkover.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Jing&lt;BR /&gt;Community Support Team&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 09:16:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Parameterising-a-Json-to-SQL-DW-Mappingundefined/m-p/4234977#M4515</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-09T09:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Parameterising a Json to SQL DW Mappingundefined</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Parameterising-a-Json-to-SQL-DW-Mappingundefined/m-p/4234979#M4516</link>
      <description>&lt;P&gt;All sorted quite quickly thanks. i just needed this in the copy activity in mapping&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;@&lt;/SPAN&gt;&lt;SPAN&gt;json(activity(&lt;/SPAN&gt;&lt;SPAN&gt;'LookupGetParameters'&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;output&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;firstRow&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;mapping&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I had to wrap the json around it to make it work properly as part of the code&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 09 Oct 2024 09:18:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Parameterising-a-Json-to-SQL-DW-Mappingundefined/m-p/4234979#M4516</guid>
      <dc:creator>DebbieE</dc:creator>
      <dc:date>2024-10-09T09:18:00Z</dc:date>
    </item>
  </channel>
</rss>

