<?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: Dataflow Gen2 Mashup Error: Loading Data into Lakehouse in Dataflow</title>
    <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/4790529#M5347</link>
    <description>&lt;P&gt;Of course type DateTime is not the same as type "date".&amp;nbsp; You need to explicitly convert type "datetime" to type "date", which will drop the time component of type "datetime".&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FYI type "time" does not exist in lakehouses.&amp;nbsp; But you can still store time information by using the lakehouse type "timestamp", which will store date and time info. In DFgen2 the equivalent type is called "datetime".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if your lakehouse column is of type Date, but also needs to hold time information, then you need to change the column type to "timestamp".&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is just an example on what I am doing with type mapping when using a Copy data activity in a pipeline.&amp;nbsp; This shows you the destination type of a lakehouse that I use as a sink.&amp;nbsp; As you can see, the sink, or lakehouse destination type is set to "timestamp" to store an incoming SQL Server data of type "datetime2".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if a pipeline is not an option, you will have to drop down to a PySpark Notebook and run some code to effect a type change on your lakehouse column, like so:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;from delta.tables import DeltaTable
from pyspark.sql.functions import col
from pyspark.sql.types import TimestampType

# 1. Specify your table
catalog_table = "your_catalog.your_schema.your_table"  # e.g. "LH_name.raw_events"

# 2. Load the Delta table as a DataFrame
df = spark.table(catalog_table)

# 3. Cast the column from Date to Timestamp
df_converted = df.withColumn(
    "your_date_column",
    col("your_date_column").cast(TimestampType())
)

# 4. Overwrite the existing table with the new schema
df_converted.write.format("delta") \
    .mode("overwrite") \
    .option("overwriteSchema", "true") \
    .saveAsTable(catalog_table)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="813" data-end="841"&gt;&lt;STRONG data-start="813" data-end="839"&gt;Best practices&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL data-start="842" data-end="1569"&gt;
&lt;LI data-start="842" data-end="951"&gt;
&lt;P data-start="844" data-end="951"&gt;&lt;STRONG data-start="844" data-end="865"&gt;Backup / dev test&lt;/STRONG&gt;: Try this first on a development copy of your table to validate downstream queries.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="952" data-end="1307"&gt;
&lt;P data-start="954" data-end="1097"&gt;&lt;STRONG data-start="954" data-end="968"&gt;Partitions&lt;/STRONG&gt;: If your table is partitioned, include those same partition columns in your rewrite to avoid full-table shuffles. For example:&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI-CODE lang="markup"&gt;df_converted.write \
    .format("delta") \
    .mode("overwrite") \
    .option("overwriteSchema", "true") \
    .partitionBy("year", "month") \
    .saveAsTable(catalog_table)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL data-start="842" data-end="1569"&gt;
&lt;LI data-start="1308" data-end="1569"&gt;
&lt;P data-start="1310" data-end="1428"&gt;&lt;STRONG data-start="1310" data-end="1335"&gt;Zero-downtime pattern&lt;/STRONG&gt;: If you need to avoid interrupting readers, write to a &lt;STRONG data-start="1391" data-end="1410"&gt;temporary table&lt;/STRONG&gt;, then swap names:&lt;/P&gt;
&lt;OL data-start="1431" data-end="1569"&gt;
&lt;LI data-start="1431" data-end="1459"&gt;
&lt;P data-start="1434" data-end="1459"&gt;Write to &lt;CODE data-start="1443" data-end="1459"&gt;your_table_tmp&lt;/CODE&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="1462" data-end="1501"&gt;
&lt;P data-start="1465" data-end="1501"&gt;&lt;CODE data-start="1465" data-end="1501"&gt;spark.sql("DROP TABLE your_table")&lt;/CODE&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="1504" data-end="1569"&gt;
&lt;P data-start="1507" data-end="1569"&gt;&lt;CODE data-start="1507" data-end="1569"&gt;spark.sql("ALTER TABLE your_table_tmp RENAME TO your_table")&lt;/CODE&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P data-start="1571" data-end="1684" data-is-last-node="" data-is-only-node=""&gt;That’s all you need to recast a date column to a full timestamp/datetime in Fabric’s Delta Lakehouse via PySpark.&lt;/P&gt;
&lt;P data-start="1571" data-end="1684" data-is-last-node="" data-is-only-node=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="1571" data-end="1684" data-is-last-node="" data-is-only-node=""&gt;Hope this helps.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Aug 2025 16:56:03 GMT</pubDate>
    <dc:creator>Element115</dc:creator>
    <dc:date>2025-08-07T16:56:03Z</dc:date>
    <item>
      <title>Dataflow Gen2 Mashup Error: Loading Data into Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3742870#M2289</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently doing this fabric tutorial on youtube (&lt;A href="https://www.youtube.com/watch?v=HLVkIsZvgzE" target="_blank" rel="noopener"&gt;https://www.youtube.com/watch?v=HLVkIsZvgzE&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;Uploading the parquet files into the Lakehouse was no problem. Then one needs to convert them into tables. With some of the files this is no problem however others have spaces in the column names which cause an error and cannot be convertet directly into a tables. For this the video shows a method how one can use dataflow Gen2 to convert the column names.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After setting up the dataflow Gen2 and publishing it as shown in the video on 23:00 min I get the following error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Data_Store_1 parquet_WriteToDataDestination: Mashup Exception Data Format Error Couldn't refresh the entity because of an issue with the mashup document MashupException.Error: DataFormat.Error: Error in replacing table's content with new data in a version: #{0}., InnerException: We can't insert values of type '#{0}' into column '#{1}' because it expects values of type '#{2}'., Underlying error: We can't insert values of type 'DateTime' into column 'Open_Date' because it expects values of type 'Date'. Details: Reason = DataFormat.Error;Message = We can't insert values of type 'DateTime' into column 'Open_Date' because it expects values of type 'Date'.;Message.Format = We can't insert values of type '#{0}' into column '#{1}' because it expects values of type '#{2}'.;Message.Parameters = {"DateTime", "Open_Date", "Date"};Microsoft.Data.Mashup.Error.Context = User&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the youtube tutorial this error does not show up, so does anyone know how I can fix this??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 11:57:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3742870#M2289</guid>
      <dc:creator>Janica123</dc:creator>
      <dc:date>2024-03-05T11:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Dataflow Gen2 Mashup Error: Loading Data into Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3744387#M2294</link>
      <description>&lt;P&gt;Can you go back to the Data Destination settings and show a screenshot of the column and data types mappings that show in there for the table?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 00:00:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3744387#M2294</guid>
      <dc:creator>miguel</dc:creator>
      <dc:date>2024-03-06T00:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Dataflow Gen2 Mashup Error: Loading Data into Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3746931#M2316</link>
      <description>&lt;P&gt;To which table does this&amp;nbsp;&lt;EM&gt;column 'Open_Date'&lt;/EM&gt; belong?&amp;nbsp; Have you tried changing its type from 'datetime' to 'date' using the Editor GUI?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 19:15:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3746931#M2316</guid>
      <dc:creator>Element115</dc:creator>
      <dc:date>2024-03-06T19:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Dataflow Gen2 Mashup Error: Loading Data into Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3747397#M2317</link>
      <description>&lt;P&gt;I haven't done the tutorial but did get a similar error when trying to extract from a table even though source and target tables had the same type. The dataset import appears to sometimes guess the wrong type so you have to manually override what it says - in your case, change the datatype of the "Open_Date" column&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 01:29:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3747397#M2317</guid>
      <dc:creator>Kryt0n</dc:creator>
      <dc:date>2024-03-07T01:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dataflow Gen2 Mashup Error: Loading Data into Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3749083#M2322</link>
      <description>&lt;P&gt;Thanks for your reply, I already tried to overriede the Date-Type manually in the Dataflow but it didn't change anything...&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 14:50:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3749083#M2322</guid>
      <dc:creator>Janica123</dc:creator>
      <dc:date>2024-03-07T14:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dataflow Gen2 Mashup Error: Loading Data into Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3749103#M2323</link>
      <description>&lt;P&gt;Thanks for your reply!&amp;nbsp;&lt;BR /&gt;Here a screenshot of the&amp;nbsp;&lt;SPAN&gt;column and data types mappings for the table&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Remark: The columns in my source originally have spaces. In the &lt;SPAN&gt;Data Destination&amp;nbsp;&lt;/SPAN&gt;settings Fabric automatically suggest me to fix this, since they are not allowed in destination. Thats reason for the information on the top&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 15:00:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3749103#M2323</guid>
      <dc:creator>Janica123</dc:creator>
      <dc:date>2024-03-07T15:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: Dataflow Gen2 Mashup Error: Loading Data into Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3777014#M2520</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="355505" data-lia-user-login="Janica123" class="lia-mention lia-mention-user"&gt;Janica123&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for using Microsoft Fabric Community.&lt;/P&gt;
&lt;P&gt;Apologize for the inconvenience that you are facing here and the delay in response from my end.&lt;/P&gt;
&lt;P&gt;Please reach out to our support team to gain deeper insights and explore potential solutions,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;If its a bug, we will definitely would like to know and properly address it. I&lt;/SPAN&gt;t's highly recommended that you reach out to our support team. Their expertise will be invaluable in suggesting the most appropriate approach.&lt;/P&gt;
&lt;P&gt;Please go ahead and raise a support ticket to reach our support team:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.fabric.microsoft.com/support" target="_blank" rel="noopener nofollow noreferrer"&gt;https://support.fabric.microsoft.com/support&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;After creating a Support ticket please provide the ticket number as it would help us to track for more information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 04:40:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3777014#M2520</guid>
      <dc:creator>v-cboorla-msft</dc:creator>
      <dc:date>2024-03-20T04:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dataflow Gen2 Mashup Error: Loading Data into Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3779930#M2524</link>
      <description>&lt;P&gt;go to the workspace list view, find the dataflow, click the 3 dots and get the ".json" file for the dataflow. In there you can check the Mashup script and see if there's any reference made to a datetime - that could be causing the issue.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 15:24:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3779930#M2524</guid>
      <dc:creator>miguel</dc:creator>
      <dc:date>2024-03-20T15:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: Dataflow Gen2 Mashup Error: Loading Data into Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3780178#M2525</link>
      <description>&lt;P&gt;This is strange.. I remember having the same issue once and I fixed it by opening the Advanced Editor and adding&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;{&lt;SPAN&gt;"DATE"&lt;SPAN&gt;, &lt;SPAN&gt;type &lt;SPAN&gt;date&lt;SPAN&gt;}&amp;nbsp; to the params list of function&amp;nbsp;&lt;SPAN&gt;Table.TransformColumnTypes() like so:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  #"Changed column type"  = Table.TransformColumnTypes(
                                                        dbo_RWS_15M, 
                                                        {
                                                          {"DATE", type date},
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 16:56:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3780178#M2525</guid>
      <dc:creator>Element115</dc:creator>
      <dc:date>2024-03-20T16:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: Dataflow Gen2 Mashup Error: Loading Data into Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3781429#M2527</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="355505" data-lia-user-login="Janica123" class="lia-mention lia-mention-user"&gt;Janica123&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. In case if you have any resolution please do share that same with the community as it can be helpful to others.&lt;BR /&gt;Otherwise, will respond back with the more details and we will try to help.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 05:56:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3781429#M2527</guid>
      <dc:creator>v-cboorla-msft</dc:creator>
      <dc:date>2024-03-21T05:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Dataflow Gen2 Mashup Error: Loading Data into Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3782518#M2529</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="355505" data-lia-user-login="Janica123" class="lia-mention lia-mention-user"&gt;Janica123&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you please try disabling staging for the query which has the data destination (based on you initial comment it should be&amp;nbsp;&lt;EM&gt;Data Store_1 parquet)&amp;nbsp;&lt;/EM&gt;and then re-publish your dataflow?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a reminder, you can disable staging by right-clicking on the query, and unchecking the "Enable staging" menu item.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Alessandro&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 11:17:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/3782518#M2529</guid>
      <dc:creator>Alven</dc:creator>
      <dc:date>2024-03-21T11:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dataflow Gen2 Mashup Error: Loading Data into Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/4789905#M5344</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have same issue please help to resolve the issue&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Datatype is same in both place lakehouse Table and Gen2 data flow&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;We can't insert values of type 'DateTime' into column 'Date' because it expects values of type 'Date&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;what should i do in that case&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Aug 2025 09:38:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/4789905#M5344</guid>
      <dc:creator>Shikha_Solanki</dc:creator>
      <dc:date>2025-08-07T09:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Dataflow Gen2 Mashup Error: Loading Data into Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/4790183#M5346</link>
      <description>&lt;P&gt;If the source query is staged, try disable staging as I suggested in my comment of&amp;nbsp;&lt;SPAN&gt;03-21-2024.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Aug 2025 12:16:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/4790183#M5346</guid>
      <dc:creator>Alven</dc:creator>
      <dc:date>2025-08-07T12:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dataflow Gen2 Mashup Error: Loading Data into Lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/4790529#M5347</link>
      <description>&lt;P&gt;Of course type DateTime is not the same as type "date".&amp;nbsp; You need to explicitly convert type "datetime" to type "date", which will drop the time component of type "datetime".&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FYI type "time" does not exist in lakehouses.&amp;nbsp; But you can still store time information by using the lakehouse type "timestamp", which will store date and time info. In DFgen2 the equivalent type is called "datetime".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if your lakehouse column is of type Date, but also needs to hold time information, then you need to change the column type to "timestamp".&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is just an example on what I am doing with type mapping when using a Copy data activity in a pipeline.&amp;nbsp; This shows you the destination type of a lakehouse that I use as a sink.&amp;nbsp; As you can see, the sink, or lakehouse destination type is set to "timestamp" to store an incoming SQL Server data of type "datetime2".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if a pipeline is not an option, you will have to drop down to a PySpark Notebook and run some code to effect a type change on your lakehouse column, like so:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;from delta.tables import DeltaTable
from pyspark.sql.functions import col
from pyspark.sql.types import TimestampType

# 1. Specify your table
catalog_table = "your_catalog.your_schema.your_table"  # e.g. "LH_name.raw_events"

# 2. Load the Delta table as a DataFrame
df = spark.table(catalog_table)

# 3. Cast the column from Date to Timestamp
df_converted = df.withColumn(
    "your_date_column",
    col("your_date_column").cast(TimestampType())
)

# 4. Overwrite the existing table with the new schema
df_converted.write.format("delta") \
    .mode("overwrite") \
    .option("overwriteSchema", "true") \
    .saveAsTable(catalog_table)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="813" data-end="841"&gt;&lt;STRONG data-start="813" data-end="839"&gt;Best practices&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL data-start="842" data-end="1569"&gt;
&lt;LI data-start="842" data-end="951"&gt;
&lt;P data-start="844" data-end="951"&gt;&lt;STRONG data-start="844" data-end="865"&gt;Backup / dev test&lt;/STRONG&gt;: Try this first on a development copy of your table to validate downstream queries.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="952" data-end="1307"&gt;
&lt;P data-start="954" data-end="1097"&gt;&lt;STRONG data-start="954" data-end="968"&gt;Partitions&lt;/STRONG&gt;: If your table is partitioned, include those same partition columns in your rewrite to avoid full-table shuffles. For example:&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI-CODE lang="markup"&gt;df_converted.write \
    .format("delta") \
    .mode("overwrite") \
    .option("overwriteSchema", "true") \
    .partitionBy("year", "month") \
    .saveAsTable(catalog_table)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL data-start="842" data-end="1569"&gt;
&lt;LI data-start="1308" data-end="1569"&gt;
&lt;P data-start="1310" data-end="1428"&gt;&lt;STRONG data-start="1310" data-end="1335"&gt;Zero-downtime pattern&lt;/STRONG&gt;: If you need to avoid interrupting readers, write to a &lt;STRONG data-start="1391" data-end="1410"&gt;temporary table&lt;/STRONG&gt;, then swap names:&lt;/P&gt;
&lt;OL data-start="1431" data-end="1569"&gt;
&lt;LI data-start="1431" data-end="1459"&gt;
&lt;P data-start="1434" data-end="1459"&gt;Write to &lt;CODE data-start="1443" data-end="1459"&gt;your_table_tmp&lt;/CODE&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="1462" data-end="1501"&gt;
&lt;P data-start="1465" data-end="1501"&gt;&lt;CODE data-start="1465" data-end="1501"&gt;spark.sql("DROP TABLE your_table")&lt;/CODE&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="1504" data-end="1569"&gt;
&lt;P data-start="1507" data-end="1569"&gt;&lt;CODE data-start="1507" data-end="1569"&gt;spark.sql("ALTER TABLE your_table_tmp RENAME TO your_table")&lt;/CODE&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P data-start="1571" data-end="1684" data-is-last-node="" data-is-only-node=""&gt;That’s all you need to recast a date column to a full timestamp/datetime in Fabric’s Delta Lakehouse via PySpark.&lt;/P&gt;
&lt;P data-start="1571" data-end="1684" data-is-last-node="" data-is-only-node=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="1571" data-end="1684" data-is-last-node="" data-is-only-node=""&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Aug 2025 16:56:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Dataflow/Dataflow-Gen2-Mashup-Error-Loading-Data-into-Lakehouse/m-p/4790529#M5347</guid>
      <dc:creator>Element115</dc:creator>
      <dc:date>2025-08-07T16:56:03Z</dc:date>
    </item>
  </channel>
</rss>

