{tocify} $title={Table of Contents}
Problem Statement
The requirement is to load data in SQL with two conditions to fulfill
1. If table doesn't already exist then create it and then load data in it
2. And every time before loading data, the already existing data in the table has to be removed/cleaned.
Solution
There is a feature Auto Create Table available in CopyData activity (if your destination(sink) is database) which helps you to create the table automatically if it doesn't exist already.
And you have option to execute script before copying the data, for that you need to provide the query against Pre-copy script. As the requirement is to clean the table before loading data, following Truncate query is used
I created a pipeline and clicked on validate and No errors were found.
Error/Issue
Why it happened
ErrorCode=SqlOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A database operation failed with the following error: 'Cannot find the object "Customer_Parquet" because it does not exist or you do not have permissions.',Source=,''Type=System.Data.SqlClient.SqlException,Message=Cannot find the object "Customer_Parquet" because it does not exist or you do not have permissions.,Source=.Net SqlClient Data Provider,SqlErrorNumber=4701,Class=16,ErrorCode=-2146232060,State=1,Errors=[{Class=16,Number=4701,State=1,Message=Cannot find the object "Customer_Parquet" because it does not exist or you do not have permissions.,},],'
The error message is pointing to couple of possible reasons
1. Not enough permission
2. The table does not exist
For first possible reason checked the user permission (the one used in Linked service) - all was good and also Test connection on linked service was successful.
The second reason was true here, there was no table.
But, we have selected Auto create table option so did it not worked?
No it didn't reached to that step, the error was thrown by the step before it, which we selected by using Pre-copy script option. Where we are truncating the table.
As this was the first run, thus there was no Table and when truncate query was executed the object(Table) was not found.
What to do
Knowledge Sharing is Caring !!!!!!
Learn More about some more Azure Data Factory errors
- Cannot find the object "xxx" because it does not exist or you do not have permissions.
- The function 'length' expects its parameter to be an array or a string. The provided value is of type 'Object'.
- ErrorCode=UserErrorInvalidColumnMappingColumnCountMismatch,Message=The column count in column mappings is more than the count in source/sink table.
- ErrorCode=UserErrorInvalidColumnMappingColumnNotFound,Column 'xxx' specified in column mapping cannot be found in source data.
- The path 'xxx' specified in the add operation already exists. Please specify a new path
- Cannot create Sql Source. Error: The value of the property 'Value' is invalid for the stored procedure parameter 'XXX'
- Cannot connect to SQL Database:'XXX' . Verify that the instance name is correct
- Cannot open server 'xxx' requested by the login. Client with IP address 'x.x.x.x' is not allowed to access the server
- Operation on target Copy data failed: Failure happened on 'Source' side
Hello, still table have 0 row showing
ReplyDelete