snowflake data copy error to blob

BACHU MAHESWARA REDDY 0 Reputation points

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.
8,513 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Boris Von Dahle 2,661 Reputation points


    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.