Which data type is equivalent to SQL Server Money to synpase delta lake table ?

heta desai 247 Reputation points
2022-08-11T18:45:54.943+00:00

I am pulling table from SQL server where few columns are Money data type. default size of Money data type is (19,4). Target is Delta table. In Delta table I've used DECIMAL(19,4) data type. I am doing this using Synapse pipeline and dataflow. But It throws an error while writing to Delta table Decimal column.

Here is the error:

AnalysisException: Failed to merge fields 'rate' and 'rate'. Failed to merge decimal types with incompatible precision 19 and 10 & scale 4 and 0"

I am using metadata driven approach where there is MEtadata table in Azure sql server in which list of table to pull data from source is inserted. pipeline reads those metadata and loads data into target delta lake from source SQL server.

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,562 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,925 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. HimanshuSinha-msft 19,386 Reputation points Microsoft Employee
    2022-08-13T00:59:57.823+00:00

    Hello @Anonymous ,
    Thanks for the question and using MS Q&A platform.

    As we understand the ask here is to get rid of the error , please do let us know if its not accurate.
    I am assuming that on the creation of the delta tyable side you have selected the MERGE opertation , let me know if that correct ? I did tried to repro the issue as it worked fine for me , to me its due to the fact its realted to the date which is in the rate column . As you mentioned that you have a metadata table and I am assuming the you have the SELECT query or the column name against the table name . I suggest that you add a cast function in the metadata and try agian . It should work .

    Something like .

    select SomeMoney,CAST(SomeMoney as decimal(19,2)) from MoneyTypeTest

    Please do let me if you have any queries.
    Thanks
    Himanshu


    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
      • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators