snowflake data copy error to blob

BACHU MAHESWARA REDDY 0 Reputation points
2023-04-29T09:35:20.6933333+00:00

Hi Team,

I am trying copy tables from snowflake to blob storage and staging alslo blob storage. while copying getting error as below

ErrorCode=UserErrorInvalidCopyBehaviorBlobNameNotAllowedWithPreserveOrFlattenHierarchy,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Cannot adopt copy behavior PreserveHierarchy when copying from folder to a single file.,Source=Microsoft.DataTransfer.ClientLibrary,'

can you please suggest me. why the error was occurred and how to resolve the issue.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,954 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Boris Von Dahle 3,126 Reputation points
    2023-04-29T14:28:08.05+00:00

    Hello,

    The error you are encountering is because you are trying to copy data from a folder in Snowflake to a single file in Blob Storage, while preserving the folder hierarchy. This is not allowed.

    You can copy the data to separate files in Blob Storage instead of a single file. You can use a wildcard (*) in the target blob name to dynamically generate the file names based on the source file names :

    copy into @my_blob_stage/my_container/foldername/*.csv

    If you really need to copy the data to a single file in Blob Storage, you will need to flatten the folder hierarchy by concatenating the data from all source files. This will require additional processing in Snowflake before copying the data.

    If this answer helped please mark it as accepted so others can find this topic.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.