Skip to main content
Version: 3.11

Schema Importer

Schema Importer is a CLI tool for automatically configuring PostgreSQL. By using this tool, your PostgreSQL database can have identical database objects, such as namespaces and tables, as your ScalarDB instance.

Schema Importer reads the ScalarDB configuration file, retrieves the schemas of the tables defined in ScalarDB, and creates the corresponding foreign data wrapper external tables and views in that order. For more information, refer to Getting Started with ScalarDB Analytics with PostgreSQL.

Build Schema Importer​

You can build Schema Importer by using Gradle. To build Schema Importer, run the following command:

./gradlew build

You may want to build a fat JAR file so that you can launch Schema Importer by using java -jar. To build the fat JAR, run the following command:

./gradlew shadowJar

After you build the fat JAR, you can find the fat JAR file in the app/build/libs/ directory.

Run Schema Importer​

To run Schema Importer by using the fat JAR file, run the following command:

java -jar <PATH_TO_FAT_JAR_FILE>

Available options are as follows:

NameRequiredDescriptionDefault
--configYesPath to the ScalarDB configuration file
--config-on-postgres-hostNoPath to the ScalarDB configuration file on the PostgreSQL-running hostThe same value as --config will be used.
--namespace, -nYesNamespaces to import into the analytics instance. You can specify the --namespace option multiple times if you have two or more namespaces.
--hostNoPostgreSQL hostlocalhost
--portNoPostgreSQL port5432
--databaseNoPostgreSQL portpostgres
--userNoPostgreSQL userpostgres
--passwordNoPostgreSQL password
--debugNoEnable debug mode

Test Schema Importer​

To test Schema Importer, run the following command:

./gradlew test

Build a Docker image of Schema Importer​

To build a Docker image of Schema Importer, run the following command, replacing <TAG> with the tag version of Schema Importer that you want to use:

docker build -t ghcr.io/scalar-labs/scalardb-analytics-postgresql-schema-importer:<TAG> -f ./app/Dockerfile .