%3CLINGO-SUB%20id%3D%22lingo-sub-1479676%22%20slang%3D%22en-US%22%3EEasily%20load%20complex%20data%20types%20with%20Azure%20Synapse%20Analytics%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1479676%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20COPY%20statement%20provides%20the%20most%20flexible%20data%20ingestion%20experience%20for%20data%20engineers.%20In%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fsynapse-analytics%2Fsql-data-warehouse%2Frelease-notes-10-0-10106-0%23may-2020%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Elatest%20release%20of%20Azure%20Synapse%20Analytics%3C%2FA%3E%2C%20we%20have%20enhanced%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fsql%2Ft-sql%2Fstatements%2Fcopy-into-transact-sql%3Fview%3Dazure-sqldw-latest%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ECOPY%20command%3C%2FA%3E%20for%20Synapse%20SQL%20by%20enabling%20you%20to%20directly%20load%20complex%20data%20types%20from%20Parquet%20files%20such%20as%20Maps%20and%20Lists%20into%20string%20columns%20without%20using%20other%20tools%20to%20pre-process%20the%20data.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20addition%2C%20the%20command%26nbsp%3Bis%20even%20simpler%20supporting%20auto-schema%20and%20compression%20detection%20when%20loading%20Parquet%20files.%20The%20command%20will%20automatically%20detect%20the%20Parquet%20file%20schema%20and%20create%20the%20table%20prior%20to%20the%20load.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESimply%20run%20the%20following%20statements%20to%20immediately%20ingest%20the%20following%20parquet%20files%20with%20complex%20data%20types.%20As%20you%20can%20see%2C%20you%20no%20longer%20need%20to%20pre-create%20any%20SQL%20tables%20or%20inspect%20the%20schema%20of%20the%20Parquet%20files%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3E--Load%20the%20map%20data%20type%0ACOPY%20INTO%20%5Bdbo%5D.%5Bcomplextypes_map%5D%20FROM%20'https%3A%2F%2Floadingsamples.blob.core.windows.net%2Fcomplextypes%2FmapExample.parquet'%0AWITH%20(%0A%20%20%20%20%20FILE_TYPE%20%3D%20'PARQUET'%0A)%3B%0A%0ASELECT%20*%20from%20%5Bcomplextypes_map%5D%3B%0A%0A--Load%20the%20struct%20data%20type%0ACOPY%20INTO%20%5Bdbo%5D.%5Bcomplextypes_struct%5D%20FROM%20'https%3A%2F%2Floadingsamples.blob.core.windows.net%2Fcomplextypes%2FstructExample.parquet'%0AWITH%20(%0A%20%20%20%20%20FILE_TYPE%20%3D%20'PARQUET'%0A)%3B%0A%0ASELECT%20*%20from%20%5Bcomplextypes_struct%5D%3B%0A%0A--Load%20the%20array%20data%20type%0ACOPY%20INTO%20%5Bdbo%5D.%5Bcomplextypes_array%5D%20FROM%20'https%3A%2F%2Floadingsamples.blob.core.windows.net%2Fcomplextypes%2FjustSimpleArray.parquet'%0AWITH%20(%0A%20%20%20%20%20FILE_TYPE%20%3D%20'PARQUET'%0A)%3B%0A%0ASELECT%20*%20from%20%5Bcomplextypes_array%5D%3B%0A%0A--Clean%20up%20the%20SQL%20tables%0ADROP%20table%20%5Bcomplextypes_map%5D%3B%0ADROP%20table%20%5Bcomplextypes_array%5D%3B%0ADROP%20table%20%5Bcomplextypes_struct%5D%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20capability%20is%20currently%20in%20preview.%20Reach%20out%20to%20the%20following%20email%20distribution%20list%20to%20get%20this%20feature%20enabled%3A%20%3CA%20href%3D%22mailto%3Asqldwcopypreview%40service.microsoft.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Esqldwcopypreview%40service.microsoft.com%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EVisit%20the%20following%20documentation%20for%20comprehensive%20examples%20and%20quickstarts%20using%20the%20COPY%20statement%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E-ERR%3AREF-NOT-FOUND-Quickstart%3A%20Bulk%20load%20data%20using%20the%20COPY%20statement%3C%2FLI%3E%0A%3CLI%3E-ERR%3AREF-NOT-FOUND-Quickstart%3A%20Examples%20using%20the%20COPY%20statement%20and%20its%20supported%20authentication%20methods%3C%2FLI%3E%0A%3CLI%3E-ERR%3AREF-NOT-FOUND-Quickstart%3A%20Creating%20the%20COPY%20statement%20using%20the%20rich%20Synapse%20Studio%20UI%20(Workspace%20preview)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1479676%22%20slang%3D%22en-US%22%3E%3CP%3EQuickly%20and%20easily%20load%20complex%20parquet%20data%20types%20with%20auto-schema%20detection!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22kevin_ngo_0-1592769331200.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F199940i25482404B09E2BB6%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22kevin_ngo_0-1592769331200.png%22%20alt%3D%22kevin_ngo_0-1592769331200.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1479676%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESynapse%20Pipelines%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESynapse%20SQL%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

The COPY statement provides the most flexible data ingestion experience for data engineers. In the latest release of Azure Synapse Analytics, we have enhanced the COPY command for Synapse SQL by enabling you to directly load complex data types from Parquet files such as Maps and Lists into string columns without using other tools to pre-process the data.

 

In addition, the command is even simpler supporting auto-schema and compression detection when loading Parquet files. The command will automatically detect the Parquet file schema and create the table prior to the load. 

 

Simply run the following statements to immediately ingest the following parquet files with complex data types. As you can see, you no longer need to pre-create any SQL tables or inspect the schema of the Parquet files:

 

--Load the map data type
COPY INTO [dbo].[complextypes_map] FROM 'https://loadingsamples.blob.core.windows.net/complextypes/mapExample.parquet'
WITH (
     FILE_TYPE = 'PARQUET'
);

SELECT * from [complextypes_map];

--Load the struct data type
COPY INTO [dbo].[complextypes_struct] FROM 'https://loadingsamples.blob.core.windows.net/complextypes/structExample.parquet'
WITH (
     FILE_TYPE = 'PARQUET'
);

SELECT * from [complextypes_struct];

--Load the array data type
COPY INTO [dbo].[complextypes_array] FROM 'https://loadingsamples.blob.core.windows.net/complextypes/justSimpleArray.parquet'
WITH (
     FILE_TYPE = 'PARQUET'
);

SELECT * from [complextypes_array];

--Clean up the SQL tables
DROP table [complextypes_map];
DROP table [complextypes_array];
DROP table [complextypes_struct];

 

This capability is currently in preview. Reach out to the following email distribution list to get this feature enabled: sqldwcopypreview@service.microsoft.com.

 

Visit the following documentation for comprehensive examples and quickstarts using the COPY statement: