Skip to main content
VeloDB Cloud 26.x is based on Apache Doris 4.x. See Version Mapping.

Load Data from Google Cloud Storage

VeloDB Cloud supports importing files from Google Cloud Storage by accessing Google Cloud Storage buckets through the S3-compatible protocol. This document describes two import methods and their complete operating procedures.

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.

Choose a method​

VeloDB Cloud provides two methods for importing files from Google Cloud Storage. Choose one based on data volume and timeliness requirements:

Import MethodExecution ModeApplicable ScenarioReference
S3 LoadAsynchronousLarge-batch data imports, long-running jobsBroker Load Manual
S3 TVF (table function)SynchronousSmall-batch data imports, ad hoc queries, quick validationThis document

Recommendations:

  • For larger data volumes or jobs that need to run in the background, use S3 Load.
  • For immediate results or use with INSERT INTO ... SELECT, use S3 TVF.

Prerequisites​

Prepare the following information before importing:

  • Google Cloud Storage bucket name (your_bucket_name).
  • For the examples below, prepare a Google Cloud Storage HMAC access ID and secret, with permission to read the bucket and objects.
  • Google Cloud Storage endpoint and region (for example, storage.googleapis.com and us-west2).
  • A running VeloDB Cloud warehouse with network access to the storage endpoint.

Method 1: import with S3 Load (asynchronous)​

S3 Load is suitable for asynchronous imports of large data volumes. For detailed parameters and advanced usage, see the Broker Load Manual.

Step 1: prepare the data​

Create a CSV file s3load_example.csv and upload it to Google Cloud Storage. The file contents are:

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 the data with S3 Load​

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" = "GCP",
"s3.endpoint" = "https://storage.googleapis.com",
"s3.region" = "us-west2",
"s3.access_key" = "<your-ak>",
"s3.secret_key" = "<your-sk>"
)
PROPERTIES
(
"timeout" = "3600"
);

Key parameters:

ParameterDescription
providerObject storage provider. For Google Cloud Storage, this is fixed at GCP
s3.endpointGoogle Cloud Storage S3-compatible access endpoint
s3.regionRegion where the Google Cloud Storage bucket is located
s3.access_keyGoogle Cloud Storage access key ID
s3.secret_keyGoogle Cloud Storage secret access key
timeoutImport 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 with TVF (synchronous)​

The S3 table function (TVF) is suitable for synchronous imports and ad hoc queries, and works directly with INSERT INTO ... SELECT.

Step 1: prepare the data​

Create a CSV file s3load_example.csv and upload it to Google Cloud Storage. The file contents are:

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 the data with TVF​

INSERT INTO test_s3load
SELECT * FROM S3
(
"uri" = "s3://your_bucket_name/s3load_example.csv",
"format" = "csv",
"provider" = "GCP",
"s3.endpoint" = "https://storage.googleapis.com",
"s3.region" = "us-west2",
"s3.access_key" = "<your-ak>",
"s3.secret_key" = "<your-sk>",
"column_separator" = ",",
"csv_schema" = "user_id:int;name:string;age:int"
);

Key parameters:

ParameterDescription
uriS3 URI of the file in object storage
formatFile format, such as csv, parquet, or orc
providerObject storage provider. For Google Cloud Storage, this is fixed at GCP
s3.endpointGoogle Cloud Storage S3-compatible access endpoint
s3.regionRegion where the Google Cloud Storage bucket is located
s3.access_keyGoogle Cloud Storage access key ID
s3.secret_keyGoogle Cloud Storage secret access key
column_separatorColumn separator
csv_schemaCSV column definitions, 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: What value should the provider parameter use?

When importing from Google Cloud Storage, provider must be set to GCP so that VeloDB Cloud accesses Google Cloud Storage through its S3-compatible protocol.

Q2: How do I choose between S3 Load and S3 TVF?

  • For large data volumes that need to run asynchronously in the background, choose S3 Load.
  • For small data volumes that need immediate results or that work alongside SQL queries, choose S3 TVF.

Q3: How do I obtain the Access Key and Secret Key for Google Cloud Storage?

You can create and manage HMAC keys (Access Key / Secret Key) for S3-compatible access on the Cloud Storage > Settings > Interoperability page in the Google Cloud Console.

Q4: How do I determine the Endpoint and Region?

The examples use the Google Cloud Storage XML API endpoint https://storage.googleapis.com. Set the region to your bucket location, and verify whether your network policy requires a regional endpoint. An endpoint name should not be inferred from the region alone.

Q5: What should I do if the import fails with a timeout?

Increase the timeout parameter in PROPERTIES (in seconds). The examples use 3600 seconds. This is an example value, not a warehouse default. For very large files or slow networks, extend it as needed.

Passwordless IAM authentication​

VeloDB Core 26.1.3 adds passwordless Google Cloud IAM authentication for S3 Load from Google Cloud Storage. The HMAC examples above remain an alternative. Passwordless authentication depends on the warehouse service identity and its permissions. Confirm the supported identity setup with VeloDB Cloud support rather than placing credential files on managed hosts. For a TVF query, use the authentication parameters supported by that TVF.