<?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: UUID JSON export from Mongo DB in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/UUID-JSON-export-from-Mongo-DB/m-p/3322536#M336</link>
    <description>&lt;P&gt;Would you mind filling a support case for this? We'll need engineering to track this one down. Thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jul 2023 05:55:38 GMT</pubDate>
    <dc:creator>GraceGu</dc:creator>
    <dc:date>2023-07-10T05:55:38Z</dc:date>
    <item>
      <title>UUID JSON export from Mongo DB</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/UUID-JSON-export-from-Mongo-DB/m-p/3302177#M289</link>
      <description>&lt;P&gt;We are exporting JSON Files from a Mongo DB with the Data Factory. The UUID in the MongoDB is represented like this&amp;nbsp;"5aa399c0-2701-401e-8e83-26b5ce82abc7". In the exported JSON File whe geht the following values:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    "_id": {
        "$binary": "wJmjWgEnHkCOgya1zoKrxw==",
        "$type": "03"
    },&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas how I can get the representation as a GUID in the export file instead the "ugly" binary value?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already tried modifying the connection string to the MongoDB but nothing worked. And there is no setting to configure the driver used by the data factory to read the values.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 10:35:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/UUID-JSON-export-from-Mongo-DB/m-p/3302177#M289</guid>
      <dc:creator>Andy_S</dc:creator>
      <dc:date>2023-06-26T10:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: UUID JSON export from Mongo DB</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/UUID-JSON-export-from-Mongo-DB/m-p/3322536#M336</link>
      <description>&lt;P&gt;Would you mind filling a support case for this? We'll need engineering to track this one down. Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 05:55:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/UUID-JSON-export-from-Mongo-DB/m-p/3322536#M336</guid>
      <dc:creator>GraceGu</dc:creator>
      <dc:date>2023-07-10T05:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: UUID JSON export from Mongo DB</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/UUID-JSON-export-from-Mongo-DB/m-p/3831215#M2574</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I faced the same problem. any solutions?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2024 14:24:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/UUID-JSON-export-from-Mongo-DB/m-p/3831215#M2574</guid>
      <dc:creator>Marusyk</dc:creator>
      <dc:date>2024-04-11T14:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: UUID JSON export from Mongo DB</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/UUID-JSON-export-from-Mongo-DB/m-p/3832620#M2593</link>
      <description>&lt;P&gt;The 'ugly' string is base64 encoded.&lt;BR /&gt;We get the MongoDB file with a copy task from the and write it to a blob storage. Afterwards we import it with databricks and decode the base64.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The function we use:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def base64ToGUID(b64str):
    try:
      s = bitstring.BitArray(bytes=base64.b64decode(b64str)).hex
      def rev2(s_):
        def chunks(n):
          for i in range(0, len(s_), n):
              yield s_[i:i+n]
        return "".join(list(chunks(2))[::-1])
      return "-".join([rev2(s[:8]),rev2(s[8:][:4]),rev2(s[12:][:4]),s[16:][:4],s[20:]])
    except:
      return None&lt;/LI-CODE&gt;&lt;P&gt;We read the JSON to a spark dataframe, convert it to a pandas dataframe and apply the decoding:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Create pandas dataframe
df_pandas = df_spark.toPandas()

#iterate over rows to decode the columns
for index, row in df_pandas.iterrows():
   row["row_name_1"] = base64ToGUID(row["row_name_1"])
   row["row_name_2"] = base64ToGUID(row["row_name_2"])
   row["row_name_n"] = base64ToGUID(row["row_name_n"])&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 05:37:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/UUID-JSON-export-from-Mongo-DB/m-p/3832620#M2593</guid>
      <dc:creator>Andy_S</dc:creator>
      <dc:date>2024-04-12T05:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: UUID JSON export from Mongo DB</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/UUID-JSON-export-from-Mongo-DB/m-p/3833270#M2598</link>
      <description>&lt;P&gt;Thanks for your reply. I'm looking for another way because we don't use spark.&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="475409" data-lia-user-login="GraceGu" class="lia-mention lia-mention-user"&gt;GraceGu&lt;/a&gt;&amp;nbsp;could you suggest anything? Can I use Power Query (Dataflow Gen2 in Fabric) or transform it in Data Pipeline before/after Copy?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 09:14:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/UUID-JSON-export-from-Mongo-DB/m-p/3833270#M2598</guid>
      <dc:creator>Marusyk</dc:creator>
      <dc:date>2024-04-12T09:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: UUID JSON export from Mongo DB</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/UUID-JSON-export-from-Mongo-DB/m-p/3839049#M2646</link>
      <description>&lt;P&gt;Alternative solutions can be found here:&amp;nbsp;&lt;A href="http://%20https://community.fabric.microsoft.com/t5/Data-Pipelines/Convert-UUID-from-MongoDb-to-UNIQUEIDENTIFIER/m-p/3833331" target="_self"&gt;&lt;SPAN class=""&gt;Convert UUID from MongoDb to UNIQUEIDENTIFIER&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 19:38:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/UUID-JSON-export-from-Mongo-DB/m-p/3839049#M2646</guid>
      <dc:creator>Marusyk</dc:creator>
      <dc:date>2024-04-15T19:38:41Z</dc:date>
    </item>
  </channel>
</rss>

