Forum Discussion
Fabric Eventstream: TypeConversionError when writing nested JSON to Lakehouse Delta table
Hi moboyal1,
Thanks for the clarification.
From the current behavior, Eventstream Lakehouse destinations expect a relatively consistent schema while writing to Delta tables. Because of that, fully dynamic nested JSON payloads (especially where fields can change between null, objects, or arrays) may result in TypeConversionError.
If the requirement is to preserve the payload exactly as received from Event Hubs, one possible approach would be to first store the raw JSON as-is and then handle parsing/schema evolution downstream using Spark notebooks or other processing options where schema handling is more flexible.
At this time, there does not seem to be an option to completely disable schema enforcement for Lakehouse destinations in Eventstream.
Sharing a few related documents which may help clarify the current behavior and supported patterns:
Lakehouse and Delta Tables - Microsoft Fabric | Microsoft Learn
Microsoft Fabric Eventstreams Overview - Microsoft Fabric | Microsoft Learn
Add a lakehouse destination to an eventstream - Microsoft Fabric | Microsoft Learn
Hope this helps if you have any queries we are happy to assist you further.
Regards,
Community Support Team.
5 Replies
- deborshi_nagSuper User
Hello moboyal1
Your eventstream creates a delta table based on the schema of the first record. If the first record contains a null value, it likely treats the field as a String, and later records with objects or arrays can cause a TypeConversion error.
1. Does `schemaMode: "None"` disable type conversion at the destination, or just at the source?
Schema enforcement applies when writing data into a lakehouse destination table.
Add a lakehouse destination to an eventstream - Microsoft Fabric | Microsoft Learn
2. How should events be handled when a field varies between `null` and a nested object?
Consider flattening fields using the Manage Fields transformation.
Microsoft Fabric Eventstreams Overview - Microsoft Fabric | Microsoft Learn
3. Is it possible to disable schema enforcement on the Lakehouse destination?
Schema enforcement cannot be disabled.
4. Does using a cross-workspace destination affect this issue? Eventstream is in Workspace 1 and Lakehouse in Workspace 2.
Cross-workspace destination is not an issue in your case.
5. What is the best approach for ingesting deeply nested JSON (3-4 levels, including arrays) into a Lakehouse through Eventstream?
Consider using an Eventhouse as a destination, where you can configure schemas for the Eventhouse destination.
Add an Eventhouse destination to an eventstream - Microsoft Fabric | Microsoft Learn
- moboyal1Microsoft Employee
How it will handle ever-evolving schema?
I don't want to write data to Eventhouse. I want to read from EventHubs in the same format upstream pushes it and then load it into Lakehouse in same format- v-hjannapuCommunity Support
Hi moboyal1,
Thanks for the clarification.
From the current behavior, Eventstream Lakehouse destinations expect a relatively consistent schema while writing to Delta tables. Because of that, fully dynamic nested JSON payloads (especially where fields can change between null, objects, or arrays) may result in TypeConversionError.
If the requirement is to preserve the payload exactly as received from Event Hubs, one possible approach would be to first store the raw JSON as-is and then handle parsing/schema evolution downstream using Spark notebooks or other processing options where schema handling is more flexible.
At this time, there does not seem to be an option to completely disable schema enforcement for Lakehouse destinations in Eventstream.
Sharing a few related documents which may help clarify the current behavior and supported patterns:
Lakehouse and Delta Tables - Microsoft Fabric | Microsoft Learn
Microsoft Fabric Eventstreams Overview - Microsoft Fabric | Microsoft Learn
Add a lakehouse destination to an eventstream - Microsoft Fabric | Microsoft Learn
Hope this helps if you have any queries we are happy to assist you further.
Regards,
Community Support Team.