CREATE EXTERNAL TABLE AS SELECT failing for Azure Blob Storage

20 Views Asked by At

I am attempting to export query results from Azure Synapse to Azure Blob Storage

CREATE EXTERNAL DATA SOURCE MyDataSource WITH (
LOCATION='wasb://[email protected]/', 
CREDENTIAL=MyCredential
)

CREATE EXTERNAL FILE FORMAT MyFormat WITH (
    FORMAT_TYPE=DELIMITEDTEXT, 
    FORMAT_OPTIONS (STRING_DELIMITER='"', FIELD_TERMINATOR=',', ENCODING='UTF8'),
    DATA_COMPRESSION='org.apache.hadoop.io.compress.GzipCodec'
)

CREATE EXTERNAL TABLE MyTable WITH (
   LOCATION='/tmp',
   DATA_SOURCE = MyDataSource,
   FILE_FORMAT = MyFormat
) AS SELECT * FROM mytable

But this gives the error

Msg 105005, Level 16, State 1, Line 49
CREATE EXTERNAL TABLE AS SELECT statement failed as the path name 'wasb://[email protected]/tmp' could not be used for export. Please ensure that the specified path is a directory which exists or can be created, and that files can be created in that directory.

I am sure the credentials are correct, as I've seen a different error when they are incorrect.

Everything I can check seems correct. The storage account is

  • Locally-redundant storage (LRS)
  • Storage (general purpose v1)

The container rpdm10-azuredw-upload exists. Within the container, a blob named tmp/ exists, which should represent the pseudo-folder tmp (although it doesn't seem to matter what path I put for LOCATION).

1

There are 1 best solutions below

0
Wheezil On

Well, the answer is simple yet obscure. As noted in this post

abfss is the URI scheme used for ADLS Gen2 while wasbs is the URI scheme used for Blob Storage

It sure would be nice if the error were more like "Invalid URI scheme".