External Databases
The SQLoader is a CLI program that enables you to load data into SQreamDB from other databases.
SQLoader supports Oracle and Postgresql.
Before You Begin
It is essential that you have the following:
Java 17
SQLoader configuration files
SQLoader.jar file
Getting the SQLoader Configuration and JAR Files
Download the
.tar
file using the following command:
curl -O https://sq-ftp-public.s3.amazonaws.com/sqloader-7.0.tar
Extract the
.tar
file using the following command:
tar -xf sqloader-7.0.tar.gz
A folder named sqloader
with the following files is created:
File |
Description |
---|---|
|
Maps Postgresql and Oracle data types into SQreamDB data types during ingestion |
|
Used for defining a connection string and may also be used to reconfigure data loading |
|
A list of reserved words which cannot be used as table and/or column names |
|
The SQLoader package file |
Connection String
The sqload-jdbc.properties
file contains a connection string that must be configured to enable data loading into SQreamDB.
Configuring SQLoader Connection
Open the
sqload-jdbc.properties
file.Configure the following parameters for:
Either Postgresql, Oracle, or SQreamDB connection strings
Optionally, Oracle or SQreamDB catalogs (recommended)
Parameter |
Description |
---|---|
|
The host and IP address number |
|
The name of the database from which data is loaded |
|
Username of a role to use for connection |
|
Specifies the password of the selected role |
|
Specifies SSL for this connection |
Loading Data into SQreamDB Tables
Run the
sqloader.jar
file using the following CLI command:
java -jar sqloader.jar
You may load the entire data of a source table using the following CLI command:
java -jar sqloader.jar -table source_table_name
You may customize the data load either by using each of the following parameters within a CLI command or by configuring the
properties
file:
CLI Parameter |
State |
Default |
Description |
---|---|---|---|
|
Optional |
|
The number of records to be inserted into SQreamDB at once. Please note that the configured batch size may impact chunk sizes. |
|
Optional |
|
If |
|
Optional |
|
Check CDC chain between tracking table and source table |
|
Optional |
|
The number of records read at once from the source database |
|
Optional |
None |
The name of the file that contains all column names. Columns must be separated using |
|
Optional |
All columns |
The name or names of columns to be loaded into SQreamDB (“col1,col2, …”) |
|
Optional |
|
Defines the configuration file you wish to use |
|
Optional |
|
Defines whether or not table rows will be counted before being loaded into SQreamDB |
|
Optional |
|
Defines whether or not loading using Change Data Capture (CDC) includes deleted rows |
|
Optional |
|
Defines whether or not a new target table in SQreamDB is created. If |
|
Optional |
|
The number of records to be read at once from source database. |
|
Optional |
|
Defines whether or not only records with SQL conditions are loaded |
|
Optional |
None |
Displays the help menu and exits |
|
Optional |
|
Limits the number of rows to be loaded |
|
Optional |
|
Add an additional |
|
Optional |
|
Defines whether or not SQLoader will check source table is locked before the loading starts |
|
Optional |
|
Defines whether or not SQLoader will lock target table before the loading starts |
|
Optional |
|
Defines the path of log directory created when loading data. If no value is specified, a |
|
Optional |
None |
Defines the partition to load data from if table is partitioned |
|
Optional |
|
Defines whether or not SQLoader will get row IDs from Oracle tables |
|
Optional |
|
Defines the source database name. It does not modify the database connection string but impacts the storage and retrieval of data within catalog tables. |
|
Optional |
None |
Column name for split (required for multi-thread loads) |
|
Mandatory |
None |
Source table name to load data from |
|
Optional |
Source table name |
Target table name to load data into |
|
Optional |
None |
Target database name to load data into |
|
Optional |
|
Number of threads to be used during loading |
|
Optional |
|
Truncate target table before loading |
|
Optional |
|
Defines a loading type that affects the table that is created in SQreamDB. Options are |
|
Optional |
|
Defines whether or not SQLoader uses |
|
Optional |
|
Defines whether or not SQLoader uses partitions in |
Using the type
Parameter
Using the type
parameter you may define a loading type that affects the table that is created in SQreamDB.
Loading Type |
Parameter Option |
Description |
---|---|---|
Full Table |
|
The entire data of the source table is loaded into SQreamDB |
Change Data Capture (CDC) |
|
Only changes made to the source table data since last load will be loaded into SQreamDB. Changes include transactions of |
Incremental |
|
Only changes made to the source table data since last load will be loaded into SQreamDB. Changes include transactions of |
Data Type Mapping
The SQLoader automatically maps data types used in Postgresql and Oracle tables that are loaded into SQreamDB.
Postgresql Type |
SQreamDB Type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Oracle Type |
SQreamDB Type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CLI Examples
Loading data into a CDC table using the type
and limit
parameters:
java -jar sqloader.jar -table source_table_name -type cdc -limit 100
Loading data into a table using your own configuration file (this will override the default configuration file):
java -jar sqloader.jar -config path/to/your/config/file
Loading data into a table using a custom configuration file:
java -jar -config MyConfigFile.properties -table source_table_name -type cdc -target target_table_name -drop true -lock_check false
Loading data into a table using a the filter
parameter:
java -jar sqloader.jar -table source_table_name -filter column_name>50