Import data from a foreign table to a Hologres internal table using SQL statements to move OSS-mapped data into native Hologres storage, enabling faster queries with better user experience.
Prerequisites
Before you begin, make sure you have:
-
A data lake created in DLF with environment configuration complete
-
A Hologres foreign table that maps to data in OSS
For setup instructions, see the Procedures section of "Use DLF to read data from and write data to OSS".
How it works
Importing data from a foreign table into an internal table stores it natively in Hologres, so you can directly query the data with better user experience.
The import process has three steps:
-
Create an internal table with the same schema as the foreign table.
-
Use
INSERT INTO ... SELECTto load the data. -
Query the internal table to verify the import.
Import data from a foreign table
Step 1: Create an internal table
The internal table must match the schema of the foreign table — same column names and compatible data types. For supported data types, see Data types.
CREATE TABLE IF NOT EXISTS holo_dlf_oss_test(
uuid int,
name string,
price double);
Step 2: Import data from the foreign table
Use INSERT INTO ... SELECT to load data from the foreign table (dlf_oss_test) into the internal table.
INSERT INTO holo_dlf_oss_test SELECT uuid, name, price FROM dlf_oss_test;
Step 3: Verify the import
After the import completes, query the internal table to confirm the data loaded correctly.
SELECT * FROM holo_dlf_oss_test;
The query returns the rows imported from OSS.