Syntax
- Connection string
- Storage account URL
- Named collection
Credentials are embedded in the connection string, so no separate
account_name/account_key is needed:Arguments
Named Collections
Arguments can also be passed using named collections. In this case the following keys are supported:Named collection key names differ from positional function argument names:
container (not container_name) and blob_path (not blobpath).Returned value
A table with the specified structure for reading or writing data in the specified file.Examples
Reading with storage_account_url form
Reading with connection_string form
Writing with partitions
Virtual Columns
_path— Path to the file. Type:LowCardinality(String)._file— Name of the file. Type:LowCardinality(String)._size— Size of the file in bytes. Type:Nullable(UInt64). If the file size is unknown, the value isNULL._time— Last modified time of the file. Type:Nullable(DateTime). If the time is unknown, the value isNULL.
Partitioned Write
Partition Strategy
Supported for INSERT queries only.WILDCARD (default): Replaces the {_partition_id} wildcard in the file path with the actual partition key.
HIVE implements hive style partitioning for reads & writes. It generates files using the following format: <prefix>/<key1=val1/key2=val2...>/<snowflakeid>.<toLower(file_format)>.
Example of HIVE partition strategy
use_hive_partitioning setting
This is a hint for ClickHouse to parse hive style partitioned files upon reading time. It has no effect on writing. For symmetrical reads and writes, use thepartition_strategy argument.
When setting use_hive_partitioning is set to 1, ClickHouse will detect Hive-style partitioning in the path (/name=value/) and will allow to use partition columns as virtual columns in the query. These virtual columns will have the same names as in the partitioned path.
Example
Use virtual column, created with Hive-style partitioning
Using Shared Access Signatures (SAS)
A Shared Access Signature (SAS) is a URI that grants restricted access to an Azure Storage container or file. Use it to provide time-limited access to storage account resources without sharing your storage account key. More details here. TheazureBlobStorage function supports Shared Access Signatures (SAS).
A Blob SAS token contains all the information needed to authenticate the request, including the target blob, permissions, and validity period. To construct a blob URL, append the SAS token to the blob service endpoint. For example, if the endpoint is https://clickhousedocstest.blob.core.windows.net/, the request becomes: