Help Center > > Developer Guide> Data Import> Import Methods

Import Methods

Updated at: Sep 17, 2021 GMT+08:00

GaussDB(DWS) provides flexible methods for importing data. You can import data from different sources to GaussDB(DWS). The features of each method are listed in Table 1. You can select a method as required. You are advised to use GaussDB(DWS) with Data Replication Service (DRS), Cloud Data Migration (CDM), Data Ingestion Service (DIS), and Data Lake Factory (DLF). DRS is used for real-time data synchronization, CDM is used for batch data migration, DIS is used for stream data ingestion, and DLF orchestrates and schedules the entire ETL process and provides a visualized development environment.

Figure 1 Import methods

Table 1 Import methods

Import Method

Supported Data Source/Database

Description

Advantage

Importing Data from OBS in Parallel

TEXT, CSV, ORC, and CarbonData data file formats

You can import data in TEXT, CSV, ORC, or CarbonData format from OBS to GaussDB(DWS) for query, and can remotely read data from OBS.

It is recommended for GaussDB(DWS).

This method features high performance and flexible scale-out.

Using GDS to Import Data from a Remote Server

TEXT and CSV data file formats

You can use the GDS tool provided by GaussDB(DWS) to import data from the remote server to GaussDB(DWS) in parallel. Multiple DNs are used for the import. This method is efficient and applicable to importing a large amount of data to the database.

Importing Data from MRS to a Cluster

  • Hive
  • Spark

You can configure a GaussDB(DWS) cluster to connect to an MRS cluster, and read data from the HDFS of MRS to GaussDB(DWS).

This method features high performance and flexible scale-out.

Using DRS to Import Data to GaussDB(DWS)

  • MySQL
  • DDM
  • PostgreSQL (OBT)
  • Oracle (OBT)
  • GaussDB(for openGauss) distributed (OBT)

The real-time data synchronization of the DRS allows you to copy data from a data source to GaussDB(DWS) to implement real-time data flow of key services. This method focuses on the synchronous import of tables and data.

This method supports data import from abundant data sources and is easy-to-operate.

Using CDM to Migrate Data to GaussDB(DWS)

  • MySQL
  • PostgreSQL
  • Microsoft SQL Server
  • Oracle
  • IBM Db2
  • SAP HANA
  • GaussDB(DWS)
  • Hive

CDM can migrate various types of data in batches between homogeneous and heterogeneous data sources. CDM migrates data to GaussDB(DWS) using the COPY statement or the GDS parallel import method.

This method supports data import from abundant data sources and is easy-to-operate.

Importing Stream Data from DIS to GaussDB(DWS)

Stream data

You can periodically import stream data from DIS to the database of a GaussDB(DWS) cluster. Data is temporarily stored on OBS before being imported to GaussDB(DWS) and will be deleted after it is dumped to GaussDB(DWS).

Data is imported in a quasi-real-time manner.

Third-party ETL tool

Databases, NoSQL, file systems, and big data platforms

For details, see the documents of the third-party ETL tool.

GaussDB(DWS) provides the DSC tool to migrate Teradata/Oracle scripts to GaussDB(DWS).

Using DSC to Migrate SQL Scripts

This method supports abundant data sources and provides powerful data conversion through OBS.

Importing Data from One GaussDB(DWS) Cluster to Another

-

Data communication between two GaussDB(DWS) clusters is supported. You can use foreign tables to access and import data across GaussDB(DWS) clusters.

This method is applicable to data synchronization between multiple GaussDB(DWS) clusters.

Running the INSERT Statement to Insert Data

-

If you use an SQL client tool or JDBC/ODBC driver to connect to the GaussDB(DWS) database, you can run the INSERT statement to insert one or more rows of data or to insert data from a specified table.

INSERT is the simplest method for data write. It is applicable to scenarios with small data volume and low concurrency.

Running the COPY FROM STDIN Statement to Import Data

Other files or databases

When you use Java to develop applications, the CopyManager interface of the JDBC driver is invoked to write data from files or other databases to GaussDB(DWS).

Data is directly written from other databases to GaussDB(DWS). Service data does not need to be stored in files.

Using a gsql Meta-Command to Import Data

Local files

Unlike the SQL COPY statement, the \copy command can be used to read data from or write data to only local files on a gsql client.

This method is easy-to-operate and suitable for importing a small amount of data to the database.

Using gs_restore to Import Data

SQL, TMP, and TAR file formats

During database migration, you can use the gs_restore tool to import the file exported using the gs_dump tool to a GaussDB(DWS) cluster. In this way, metadata, such as table definitions and database object definitions, is imported. Definitions of the following data need to be imported:

  • All database objects
  • Single database object
  • Single schema
  • Single table

This method is applicable to metadata migration.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel