Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
Steps to Reproduce:
Observations:
Solved! Go to Solution.
Hi @JPTADIVADA ,
Thank you for checking again. Since the full load works but the incremental load keeps failing, even after excluding the Geometry column and handling NULLs, it’s possible this is due to the Copy Job incremental feature not working reliably when the source is a view.
CDC is set up on the base table, and using a view can lead to schema or type mismatches during incremental merges, causing casting issues like the one you’re experiencing.
For a more stable solution, you could try
1. Create a new table in SQL Server with only the needed columns (excluding Geometry)
2. Enable CDC on this new table & Use this table as the source for incremental load
This should help avoid spatial type and view-related schema issues during CDC processing.
Please try this approach hopefully it helps resolve the issue. If you’re still facing any problems after trying it, please let us know and we’ll be happy to assist further.
Hi @JPTADIVADA ,
Everything looks good now. If you're still experiencing any issues or need any further details or clarification, please feel free to let us know.
Thanks.
Hi @JPTADIVADA ,
If you get a chance, please review the responses shared by @deborshi_nag & @Ben-Dev . They have correctly pointed out the key points, so kindly check and let us know if you need any additional details.
Thank you all for your valuable support @Ben-Dev , @deborshi_nag .
Regards,
Yugandhar.
Hello @deborshi_nag & @Ben-Dev Thanks for your response. We are talking here about Geometry column not Geography column. We have created a view on top of the CDC table excluding the Geometry columns. tested the full load and it was successful but incremental load failed with the error "ErrorCode=FailedToUpsertDataIntoDeltaTable,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Hit an error when upsert data to table in Lakehouse. Error message: Unable to cast object of type 'System.DBNull' to type 'System.String'.,Source=Microsoft.DataTransfer.Connectors.LakehouseTableConnector,''Type=System.InvalidCastException,Message=Unable to cast object of type 'System.DBNull' to type 'System.String'.,Source=Microsoft.DataTransfer.Connectors.LakehouseTableConnector,'"
Can you all still advice.
BR
JP
Hi @JPTADIVADA ,
This error typically occurs when the incremental load receives NULL values for a column, and the upsert step attempts to process them as strings. Since the full load completes successfully but the incremental load does not, it might be due to the way NULLs are handled in the view during CDC.
Could you try addressing or replacing NULL values in the view for text or string columns and then test the incremental load again?
Thanks.
Failing again at incremental load.
Hi @JPTADIVADA ,
Thank you for checking again. Since the full load works but the incremental load keeps failing, even after excluding the Geometry column and handling NULLs, it’s possible this is due to the Copy Job incremental feature not working reliably when the source is a view.
CDC is set up on the base table, and using a view can lead to schema or type mismatches during incremental merges, causing casting issues like the one you’re experiencing.
For a more stable solution, you could try
1. Create a new table in SQL Server with only the needed columns (excluding Geometry)
2. Enable CDC on this new table & Use this table as the source for incremental load
This should help avoid spatial type and view-related schema issues during CDC processing.
Please try this approach hopefully it helps resolve the issue. If you’re still facing any problems after trying it, please let us know and we’ll be happy to assist further.
Hello @JPTADIVADA
Fabric Lakehouse tables (underlying Delta Lake) don't support Geography types, so it needs a conversion before or during ingestion.
It is quite possible that during full-load the geographic values may be serialised automatically by the source connector or copied without merge/upsert logic, hence it succeeds, but incremental fails!
You can change the Geography column into Latitude and Longitudes i.e. into numeric columns.
The geography data is not being ingested.
even so.
The full load does not bring any geography data into the Fabric table.
The incremental load does not bring any geography data into the Fabric table.
CDC-based incremental copy: If your source database has CDC enabled, Copy job automatically captures and replicates inserts, updates, and deletes to the destination, applying the exact changes.
Change data capture (CDC) in Copy Job - Microsoft Fabric | Microsoft Learn
I just ended up making an ETL process to get around this.
You're right, if you can pick the specific columns, it should not error out if the selected columns are valid. It's just lazy error checking, or updating it is in a backlog somewhere.
I had an idea of trying to make a view of the table to incrementally copy. I don't know if that would work. I have not tried it.
Maybe another possible way is to replicate the table with specific columns on SQL Server to a secondary table, and then incrementally load that secondary table. I don't know if it will work, just an idea I had to test out.
creating a SQL view will work.
> creating a SQL view will work.
Well, the original poster is trying to do incremental loads using Copy Job's CDC-aware functionality. While a view could be used to exclude the troublesome column, wouldn't using the view from the Copy Job cause Copy Job's CDC-based incremental load behavior to be disabled (i.e. not supported)?
On the databse side, tables can be CDC-enabled. However, I don't believe CDC behaviors are "inherited" by a view that is based on a CDC-enabled table. Wouldn't the view be seen by Copy Job as just an ordinary view, not someting CDC-enabled?
What do we know?
Delta Lake supports only primitive types (string, int, double, binary, etc.)
SQL CLR types like geography have no equivalent Delta logical type
Fabric cannot auto‑convert them
So you must convert before ingestion.
Since onelake doesn't support this, our options are described in this article.
geography (Transact-SQL) - SQL Server | Microsoft Learn
My preference would be to store the data using WKT representation.
https://learn.microsoft.com/en-us/sql/t-sql/spatial-geometry/stastext-geometry-data-type?view=sql-se...
The question says they are not bringing the geography data to Fabric.
> So you must convert before ingestion.
But the column isn't being ingested. 🙂
In the repo steps given, the geography column is not mapped for ingestion by Copy Job:
> Set/edit the job’s column mappings for the table, ensuring that the “Geo” column is not mapped but the other two columns are mapped.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 15 | |
| 7 | |
| 5 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 27 | |
| 17 | |
| 15 | |
| 13 | |
| 11 |