Skip to main content

Azure Storage

VeloDB Cloud supports importing files from Azure Storage (Azure Blob Storage). This document describes two typical import methods. You can choose the appropriate option based on data volume and real-time requirements.

Before you begin​

Use a running warehouse and a warehouse SQL user with the privileges required by the selected method. Run SQL in SQL Editor or a connected SQL client. Create or select a database before running unqualified table statements. Replace sample paths and credentials with your own values. Use a new load label for each independent job. Treat the two method walkthroughs as alternatives, or use a fresh table when running both.

The warehouse must be able to reach the storage endpoint and read the objects. A successful connection from your computer does not establish warehouse connectivity. Check storage firewall rules, credentials, and any cross-region transfer charges.

For supported object storage sources, Data Integration provides a guided import workflow. Check its source and deployment availability before choosing the wizard. The SQL examples below use S3 Load or a table-valued function (TVF), with method-specific options. See Load Overview for how these paths relate.

Method selection​

The following table compares the core differences between the two import methods, helping you choose quickly:

Import methodExecution modeApplicable scenarioReference document
S3 LoadAsynchronousLarge-scale data import, background scheduling requiredBroker Load Manual
TVF (table-valued function)SynchronousAd hoc queries, small-batch data import, quick verification

Prerequisites​

Before importing data from Azure Storage using either method, confirm the following configurations:

  • HTTPS transport: Azure Storage requires HTTPS transport by default (corresponding to the storage account configuration Secure transfer required: Enabled). Use an HTTPS endpoint. Warehouse host configuration is managed by the service.
  • Region can be omitted: When using the Azure provider, the s3.region parameter can be omitted.
  • Access credentials: Use the storage account name as s3.access_key and an account access key as s3.secret_key. These are Azure account credentials, not an AWS access key pair.
  • Endpoint format: Use an Endpoint address in the form of https://<storage-account>.blob.core.windows.net.

Caution:

Use provider=AZURE to select the Azure Blob adapter. The S3-style parameter names do not mean Azure Blob exposes a native S3 endpoint. If connectivity still fails with the correct HTTPS endpoint and credentials, contact VeloDB Cloud support.

Method 1: import using S3 Load (asynchronous)​

S3 Load is an asynchronous batch import method, suitable for importing large-scale data from Azure Storage into your warehouse. The complete steps are as follows.

Step 1: prepare data​

Create a CSV file s3load_example.csv on Azure Storage with the following content:

1,Emily,25
2,Benjamin,35
3,Olivia,28
4,Alexander,60
5,Ava,17
6,William,69
7,Sophia,32
8,James,64
9,Emma,37
10,Liam,64

Step 2: create a table in your warehouse​

CREATE TABLE test_s3load(
user_id BIGINT NOT NULL COMMENT "user id",
name VARCHAR(20) COMMENT "name",
age INT COMMENT "age"
)
DUPLICATE KEY(user_id)
DISTRIBUTED BY HASH(user_id) BUCKETS 10;

Step 3: import data using S3 Load​

Run the following SQL to submit an S3 Load task:

LOAD LABEL s3_load_2022_04_01
(
DATA INFILE("s3://your_container_name/s3load_example.csv")
INTO TABLE test_s3load
COLUMNS TERMINATED BY ","
FORMAT AS "CSV"
(user_id, name, age)
)
WITH S3
(
"provider" = "AZURE",
"s3.endpoint" = "https://<storage-account>.blob.core.windows.net",
"s3.region" = "westus3",
"s3.access_key" = "<storage-account>",
"s3.secret_key" = "<storage-account-key>"
)
PROPERTIES
(
"timeout" = "3600"
);

Key parameter descriptions:

ParameterDescription
providerMust be set to AZURE to identify the object storage provider
s3.endpointAzure Blob service address, in the format https://<storage-account>.blob.core.windows.net
s3.regionCan be omitted in Azure scenarios
s3.access_keyAzure storage account name
s3.secret_keyAzure storage account access key
timeoutImport task timeout (in seconds)

Step 4: verify the imported data​

Wait for the asynchronous job to reach FINISHED before querying the target table. If it is CANCELLED, inspect the error before retrying.

SHOW LOAD WHERE Label = 's3_load_2022_04_01';
SELECT * FROM test_s3load;

Expected result:

mysql> select * from test_s3load;
+---------+-----------+------+
| user_id | name | age |
+---------+-----------+------+
| 5 | Ava | 17 |
| 10 | Liam | 64 |
| 7 | Sophia | 32 |
| 9 | Emma | 37 |
| 1 | Emily | 25 |
| 4 | Alexander | 60 |
| 2 | Benjamin | 35 |
| 3 | Olivia | 28 |
| 6 | William | 69 |
| 8 | James | 64 |
+---------+-----------+------+
10 rows in set (0.04 sec)

Method 2: import using TVF (synchronous)​

TVF (table-valued function) is a synchronous import method that can read and write data within a single SQL statement, suitable for small-batch data or ad hoc scenarios.

Step 1: prepare data​

Create a CSV file s3load_example.csv on Azure Storage with the following content:

1,Emily,25
2,Benjamin,35
3,Olivia,28
4,Alexander,60
5,Ava,17
6,William,69
7,Sophia,32
8,James,64
9,Emma,37
10,Liam,64

Step 2: create a table in your warehouse​

CREATE TABLE test_s3load(
user_id BIGINT NOT NULL COMMENT "user id",
name VARCHAR(20) COMMENT "name",
age INT COMMENT "age"
)
DUPLICATE KEY(user_id)
DISTRIBUTED BY HASH(user_id) BUCKETS 10;

Step 3: import data using TVF​

Import data directly via INSERT INTO ... SELECT FROM S3(...):

INSERT INTO test_s3load
SELECT * FROM S3
(
"uri" = "s3://your_container_name/s3load_example.csv",
"format" = "csv",
"provider" = "AZURE",
"s3.endpoint" = "https://<storage-account>.blob.core.windows.net",
"s3.region" = "westus3",
"s3.access_key" = "<storage-account>",
"s3.secret_key" = "<storage-account-key>",
"column_separator" = ",",
"csv_schema" = "user_id:int;name:string;age:int"
);

Key parameter descriptions:

ParameterDescription
uriObject path on Azure Storage, in the format s3://<container>/<object>
formatFile format, such as csv, parquet, orc, etc.
providerMust be set to AZURE
s3.endpointAzure Blob service address
s3.regionCan be omitted in Azure scenarios
s3.access_key / s3.secret_keyAccount name (s3.access_key) and account key (s3.secret_key)
column_separatorColumn separator (applicable to CSV)
csv_schemaCSV column definition, in the format column_name:type;column_name:type

Step 4: verify the imported data​

SELECT * FROM test_s3load;

Expected result:

mysql> select * from test_s3load;
+---------+-----------+------+
| user_id | name | age |
+---------+-----------+------+
| 5 | Ava | 17 |
| 10 | Liam | 64 |
| 7 | Sophia | 32 |
| 9 | Emma | 37 |
| 1 | Emily | 25 |
| 4 | Alexander | 60 |
| 2 | Benjamin | 35 |
| 3 | Olivia | 28 |
| 6 | William | 69 |
| 8 | James | 64 |
+---------+-----------+------+
10 rows in set (0.04 sec)

FAQ​

Q1: How should you choose between S3 Load and TVF?​

  • S3 Load: Executes asynchronously, suitable for large-batch data, scenarios that require tracking import status by Label, or scheduling as periodic tasks.
  • TVF: Executes synchronously, suitable for small-batch data, ad hoc queries, quick verification of file content, or scenarios that require transforming data in SELECT before writing.

Q2: Why does an error or connection failure occur when accessing Azure storage?​

Confirm the following:

  1. The warehouse can reach the storage account endpoint through its firewall and network policies.
  2. When the Azure Storage account has Secure transfer required enabled, HTTPS must be used.
  3. The format of s3.endpoint is correct: https://<storage-account>.blob.core.windows.net, including https://.
  4. The account name and account key are valid, and the target container and blob path are correct.

Q3: Is s3.region required?​

No. In Azure scenarios, s3.region can be omitted. If specified, it does not affect the import process.

Q4: What format should the uri use?​

Whether for DATA INFILE in S3 Load or uri in TVF, use the form s3://<container_name>/<object_path> to access objects on Azure Storage.

Troubleshooting​

SymptomPossible causeSolution
Import task reports a connection errorEndpoint, firewall, or network configuration is incorrectVerify the HTTPS endpoint and storage network policies. Contact VeloDB Cloud support for service-managed configuration
Permission or authentication failure reportedIncorrect account name/key or inaccessible containerCheck the account name and account key, the target container, and storage network policies
Endpoint cannot be resolvedEndpoint is misspelled or DNS is unreachableUse https://<storage-account>.blob.core.windows.net with https://
Import task times outLarge data volume or slow networkIncrease the timeout value in PROPERTIES

See also​