How to Load data from Azure SQL to Delta Table (WorkspaceDB) in lake database using Data Flow Activity in Meta Data Driven Synapse Pipeline ?

Vedant Desai 631 Reputation points
2022-07-21T10:54:58.283+00:00

Error: {"message":"Job failed due to reason: at Sink 'MetaSink': org.apache.spark.sql.AnalysisException: The column number of the existing table default.phaseone(struct<>) doesn't match the data schema(struct<Id:int,Name:string>);. Details:org.apache.spark.sql.AnalysisException: The column number of the existing table default.phaseone(struct<>) doesn't match the data schema(struct<Id:int,Name:string>);\n\tat org.apache.spark.sql.execution.datasources.PreprocessTableCreation$$anonfun$apply$2.applyOrElse(rules.scala:131)\n\tat org.apache.spark.sql.execution.datasources.PreprocessTableCreation$$anonfun$apply$2.applyOrElse(rules.scala:76)\n\tat org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper$$anonfun$resolveOperatorsDown$1$$anonfun$2.apply(AnalysisHelper.scala:108)\n\tat org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper$$anonfun$resolveOperatorsDown$1$$anonfun$2.apply(AnalysisHelper.scala:108)\n\tat org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:69)\n\tat org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper$$anonfun$resolveOperatorsDown$1.apply(AnalysisHelper.scala:107)\n\tat org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper$$anonfun$resolveOperatorsDown$1.apply(AnalysisHelper.scala:106)\n\tat org.ap","failureType":"UserError","target":"DataFlow_SourceToLanding","errorCode":"DFExecutorUserError"}

I am mentioning my steps which I have performed :

Step1: got metadata using lookup activity
Step2: Passed the values in for each loop for ne by one table execution

222950-1.png

Step3: Created parameters for metadata in dataflow

223133-2.png

Step4: Passed the table name and columns in dataflow source activity via Inline Query

223076-3.png
223104-4.png

Step5: Then use the Delta Table from WorkspaceDb(Lake Database) In Sink Activity

223040-5.png

There is Two Same Columns in Azure SQL Source and Delta Lake Table
Source Table : (Id int , Name varchar(20) )
Destination Table : (Id INT , Name STRING )

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,348 questions
Azure Data Explorer
Azure Data Explorer
An Azure data analytics service for real-time analysis on large volumes of data streaming from sources including applications, websites, and internet of things devices.
483 questions
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,395 questions
Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
1,938 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,601 questions
0 comments No comments
{count} votes

Accepted answer
  1. AnnuKumari-MSFT 31,061 Reputation points Microsoft Employee
    2022-07-21T17:14:03.387+00:00

    Hi @Vedant Desai ,
    Welcome to Microsoft Q&A platform and thanks for posting your question .
    As I understand the issue it seems you are trying to load data from Az SQL table to Delta table using mapping dataflow. However, it seems to be throwing error saying column number doesn't match between source and sink. Please let me know if my understanding is incorrect.

    Since , the whole pipeline architecture is dynamic to copy multiple tables in your case, I understand you can't import source schema , However, you can consider opting for Merge schema option in sink settings.

    223274-image.png

    When merge schema option is enabled, any columns that are present in the previous stream but not in the Delta table are automatically added on to the end of the schema.

    Please let us know how it goes.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful