Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Has anyone else run into an error using geometric functions in SQL Database in Fabric? Are thses functions not yet available in Fabric SQL DB? The STGeomFromText (geometry Data Type) article indicates the function should be available (the Applies to tag includes SQL Database in Microsoft Fabric).
The following statement (from the linked article) runs in Fabric Warehouse without error, but when run in SQL DB in Fabric, it gives the error below.
Statement:
Solved! Go to Solution.
When I created the ticket on Friday, it didn't run in the SQL Database or SQL Analytics Endpoint, but it did work in Fabric Warehouse (I tried that statement in all). I will close this out as solved now that it is working in SQL Database.
@MLingo - I just tried this code in my SQL database in Fabric and it does work. Can you please try again and let me know if you still having the issue? Please do share which region is your tenant in.
thanks
Sukhwant
For what it's worth... I'm converting PostgreSQL query to Fabric and I have two ways to solve the problem I'm working on
In US West region the query runs fine against the SQL Database but not against its SQL Analytics Endpoint.
I just tried that line again and it still doesn't work. My tenant is in East US.
I still get the same error...
Could not load file or assembly 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
@MLingo - Can you please create a support case? Feel free to drop the support case number here and I will keep an eye on it.
Thanks
Sukhwant
I opened case 2604090010000730.
Below is a more through comparison of the geometric function in SQL Database, SQL Analytics Endpoint, and Fabric Warehouse (all US East Region). The script below contains comments and results for statements run in the three different tools...
/******** All Queries Run in US East Region ********/
--Warehouse: Query below runs and returns expected restult
--SQL Database: Query below runs and returns expected restult
--SQL Analytics Endpoint: Query Error - Could not load file or assembly 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
select geometry::STGeomFromText('LINESTRING (100 100, 20 180, 180 180)', 0)
--Fabric Warehouse: Query runs and returns expected restult (US East)
--SQL Database: Query runs and returns expected restult (US East)
--SQL Analytits Enpoint: Query runs and retuns expected result (US East)
with cte as (
select 1 as [LineNo], geometry::STGeomFromText('LINESTRING (100 0, 200 0)', 0) as [Line1_Geom]
union all select 1 as [LineNo], geometry::STGeomFromText('LINESTRING (150 0, 250 0)', 0) as [Line1_Geom]
union all select 2 as [LineNo], geometry::STGeomFromText('LINESTRING (300 0, 450 0)', 0) as [Line1_Geom]
union all select 2 as [LineNo], geometry::STGeomFromText('LINESTRING (3000 0, 6500 0)', 0) as [Line1_Geom]
union all select 2 as [LineNo], geometry::STGeomFromText('LINESTRING (2000 0, 5000 0)', 0) as [Line1_Geom]
)
select [LineNo]
,geometry::UnionAggregate([Line1_Geom]).STLength()
,count(*)
from cte
group by [LineNo]
--Save sample data in WKT format to SQL Datbase and Warehouse
--SQL Database: Save WKT to table
--Warehouse: Save WKT to table
with cte as (
select 1 as [LineNo], 'LINESTRING (100 0, 200 0)' as [Line1_WKT]
union all select 1 as [LineNo], 'LINESTRING (150 0, 250 0)' as [Line1_WKT]
union all select 2 as [LineNo], 'LINESTRING (300 0, 450 0)' as [Line1_WKT]
union all select 2 as [LineNo], 'LINESTRING (3000 0, 6500 0)' as [Line1_WKT]
union all select 2 as [LineNo], 'LINESTRING (2000 0, 5000 0)' as [Line1_WKT]
)
select [LineNo], [Line1_WKT]
into dbo.testline1
from cte
--Confirm data in table
select * from dbo.testline1
--Warehouse: Error 8676, Level 16, State 21, Line 1 - Invalid Plan (US East)
--SQL Database: Query runs and returns expected restult (US East)
--SQL Analytics Endpoint: Error 8676, Level 16, State 21, Line 1 - Invalid Plan (US East)
with cte as (
select t.[LineNo]
,geometry::STGeomFromText(t.[Line1_WKT], 0) as [Line1_Geom]
from dbo.testline1 t
)
select cte.[LineNo]
,geometry::UnionAggregate(cte.[Line1_Geom]).STLength()
,count(*)
from cte
group by [LineNo]
@MLingo - In your first message above you mentioned that geometry data type is not working in SQL endpoint but in your new message you are mentioning it's working. Your issue is in SQL analytics endpoint. Geometry data type is not supported in the SQL analytics endpoint at this point.
When I created the ticket on Friday, it didn't run in the SQL Database or SQL Analytics Endpoint, but it did work in Fabric Warehouse (I tried that statement in all). I will close this out as solved now that it is working in SQL Database.
Hi @MLingo ,
The behavior you are experiencing is expected with Microsoft Fabric SQL Database. Spatial and geometric functions, such as STGeomFromText, rely on Microsoft.SqlServer.Types components, which are not currently available in the Fabric SQL Database environment. Consequently, queries using these functions will succeed in Fabric Warehouse but encounter assembly loading errors in SQL Database.
While documentation may indicate SQL Database in Fabric as applicable, feature support is not yet consistent across all Fabric platforms. Currently, spatial data types like geometry and their associated methods are supported only in Fabric Warehouse, not in SQL Database.
Your query is correct; the limitation is due to the platform. If spatial operations are required for your workload, it is recommended to run these queries in Fabric Warehouse or handle spatial processing outside SQL Database until support becomes available in a future update.
Thank you.
Hi @sukkaur ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Thank you.
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.