I'm trying to use "Copy Into" to bulk load data into Synapse from a CSV file.
Here is the command I used.
COPY INTO dbo.[StageProducts2]
FROM 'https://<<mystorageaccount>>.blob.core.windows.net/data-files/Instacart/products.csv'
WITH (
FILE_TYPE='CSV',
CREDENTIAL=(IDENTITY= 'Storage Account Key', SECRET='<<my storage account key>>'),
FIRSTROW=2,
FIELDQUOTE = '"',
FIELDTERMINATOR=',',
MAXERRORS = 100,
ERRORFILE = '/errorsfolder'
)
And I'm getting the following error.
Cannot bulk load because the file "https://<<mystorageaccount>>.blob.core.windows.net/data-files/errorsfolder/_rejectedrows/20201015_112602/QID988_1.Row.Txt" could not be opened. Operating system error code 5(Access is denied.).
Cannot bulk load because the file "https://<<mystorageaccount>>.blob.core.windows.net/data-files/errorsfolder/_rejectedrows/20201015_112602/QID988_1.Error.Txt" could not be opened. Operating system error code 5(Access is denied.).
I'm using the storage account key which should have full permissions to the storage account. And I'm logged in using db admin account from SQL Mgt. Studio. So I'm not sure why this error is occurring.
Here is some sample data.
product_id,product_name,aisle_id,department_id
25,Salted Caramel Lean Protein & Fiber Bar,3,19
26,Fancy Feast Trout Feast Flaked Wet Cat Food,41,8
27,Complete Spring Water Foaming Antibacterial Hand Wash,127,11
28,Wheat Chex Cereal,121,14
29,Fresh Cut Golden Sweet No Salt Added Whole Kernel Corn,81,15
30,"Three Cheese Ziti, Marinara with Meatballs",38,1
105,"Easy Grab 9\""x13\"" Oblong Glass Bakeware",10,17
I have also tried passing in errorfile_credential parameter and get the same error still.
COPY INTO dbo.[StageProducts2]
FROM 'https://<<mystorageaccount>>.blob.core.windows.net/data-files/Instacart/products.csv'
WITH (
FILE_TYPE='CSV',
CREDENTIAL=(IDENTITY= 'Storage Account Key', SECRET='<<my storage account key>>'),
FIRSTROW=2,
FIELDQUOTE = '"',
FIELDTERMINATOR=',',
MAXERRORS = 100,
ERRORFILE = 'https://<<mystorageaccount>>.blob.core.windows.net/data-files/Instacart/errorsfolder',
ERRORFILE_CREDENTIAL=(IDENTITY= 'Storage Account Key', SECRET='<<my storage account key>>')
)
I originally wanted to use Polybase but because of limitation with handling escape characters, I'm trying to use Copy Into as an alternative. See link for more info on this. @HarithaMaddi-MSFT
Appreciate the help. Thank you.