When Hologres internal table data is updated and needs to be processed by an external engine, you can use Data Lake Formation (DLF) to write the data directly to Object Storage Service (OSS) through a foreign table, then query it from engines such as E-MapReduce (EMR).
Prerequisites
Before you begin, make sure you have:
DLF activated with the environment configured
A Hologres foreign table that can read data from OSS
For setup instructions, see the Procedures section of "Use DLF to read data from and write data to OSS."
Export data to OSS
Supported export formats: ORC, Parquet, CSV, SequenceFile, Hudi, and Paimon.
Step 1: Write data back to OSS
Run the following SQL statement to insert data from a Hologres internal table into OSS through the foreign table:
INSERT INTO <foreign_table_name>(<col_name>,......) SELECT <col_name>,...... FROM <holo_table_name>;| Parameter | Description |
|---|---|
foreign_table_name | The name of the foreign table |
holo_table_name | The name of the Hologres internal table |
col_name | The name of a column |
Step 2: Query the written data
After the data is written back to OSS, run the following SQL statement in the Hive or Spark engine of EMR to query the written data:
SELECT * FROM <foreign_table_name> WHERE <col_name> = value;If a success message is returned, Hologres has written the data back to OSS and EMR can read it.