Skip to main content

Load Data from MinIO

MinIO is an S3-compatible object storage. VeloDB Cloud provides two methods for importing files from MinIO. Choose between them based on data volume and timeliness requirements:

Import methodExecution modeApplicable scenarioDocumentation reference
S3 LoadAsynchronousLarge-batch data import; tasks that need to run in the backgroundBroker Load Manual
TVF (table-valued function)SynchronousSmall-batch, ad hoc query imports; works with INSERT INTO ... SELECTExamples in this document

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.

Prerequisites​

Before importing MinIO data using either method, confirm the following conditions:

  • A VeloDB Cloud warehouse is deployed and can access the MinIO service normally.
  • You have obtained the MinIO endpoint, region, access key, and secret key.
  • The CSV/Parquet files to be imported have been uploaded to a MinIO bucket.

Note:

When using S3 Load or TVF to import MinIO data, note the following two points:

  • Endpoint protocol prefix: Use an endpoint reachable from the warehouse, such as "s3.endpoint" = "https://<storage-host>:<port>". If your service intentionally uses HTTP, specify http:// explicitly.
  • Path access style: The S3 SDK uses virtual-hosted style by default, but some MinIO deployments require path style. If yours does, add "use_path_style" = "true" to force path style.

Method 1: import using S3 Load (asynchronous)​

S3 Load is suitable for importing files from MinIO into your warehouse as an asynchronous task. For detailed steps, refer to the Broker Load Manual.

Step 1: prepare the data​

Create a CSV file s3load_example.csv and upload it to MinIO 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​

Execute the following SQL to submit an S3 Load task:

LOAD LABEL s3_load_2022_04_01
(
DATA INFILE("s3://your_bucket_name/s3load_example.csv")
INTO TABLE test_s3load
COLUMNS TERMINATED BY ","
FORMAT AS "CSV"
(user_id, name, age)
)
WITH S3
(
"provider" = "S3",
"s3.endpoint" = "https://<storage-host>:<port>",
"s3.region" = "us-east-1",
"s3.access_key" = "<access-key>",
"s3.secret_key" = "<secret-key>",
"use_path_style" = "true"
)
PROPERTIES
(
"timeout" = "3600"
);

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';

Run a query to verify whether the data has been imported successfully:

SELECT * FROM test_s3load;

Expected output:

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)​

The TVF (table-valued function) method reads MinIO files as a virtual table through the S3() function, and combined with INSERT INTO ... SELECT it completes the import synchronously. It is suitable for small-batch or ad hoc scenarios.

Step 1: prepare the data​

Create a CSV file s3load_example.csv and upload it to MinIO 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​

Execute the following SQL to import the data synchronously:

INSERT INTO test_s3load
SELECT * FROM S3
(
"uri" = "s3://your_bucket_name/s3load_example.csv",
"format" = "csv",
"provider" = "S3",
"s3.endpoint" = "https://<storage-host>:<port>",
"s3.region" = "us-east-1",
"s3.access_key" = "<access-key>",
"s3.secret_key" = "<secret-key>",
"column_separator" = ",",
"csv_schema" = "user_id:int;name:string;age:int",
"use_path_style" = "true"
);

Step 4: verify the imported data​

Run a query to verify whether the data has been imported successfully:

SELECT * FROM test_s3load;

Expected output:

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)

Key parameters​

The following parameters must be configured correctly for both S3 Load and TVF:

ParameterDescriptionExample value
providerObject storage provider. Set to S3 when using MinIO.S3
s3.endpointMinIO service address. The http:// prefix is required when TLS is not enabled.https://<storage-host>:<port>
s3.regionThe region where MinIO is deployed. Use the region configured for your deployment.us-east-1
s3.access_keyMinIO access key ID.<access-key>
s3.secret_keyMinIO access key secret.<secret-key>
use_path_styleWhether to use path-style access. Set to true if your deployment requires path-style access.true

FAQ​

Q1: How do I choose between S3 Load and TVF?​

  • S3 Load: Executes asynchronously. Suitable for large-batch data imports. After submission, VeloDB Cloud schedules and runs the task in the background, and you can query the task status with SHOW LOAD.
  • TVF: Executes synchronously. Suitable for small-batch, ad hoc analysis, or scenarios combined with INSERT INTO ... SELECT pipelines. Returns results immediately.

Confirm whether the endpoint has the correct protocol prefix:

  • TLS not enabled: Must include http://, such as http://<storage-host>:<port>.
  • TLS enabled: Use the https:// prefix.

Q3: What should I do if access reports a bucket parsing error or 404?​

If your deployment uses path-style addressing and cannot resolve a virtual-hosted bucket address, add the following to the import parameters. Also verify the bucket name, endpoint, and permissions:

"use_path_style" = "true"

Q4: Are other formats such as Parquet/ORC supported?​

Yes. Replace FORMAT AS "CSV" (or "format" = "csv" in TVF) with parquet, orc, or other corresponding formats. For details, see the Broker Load Manual.