---
type: Development Guide
title: Schema Importer
description: 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.
resource: https://scalardb-community.scalar-labs.com/docs/3.11/scalardb-analytics-postgresql/schema-importer/
tags:
- scalardb-community
- v3.11
- phase:implement
- section:develop
status: stable
product: scalardb-community
product_title: ScalarDB Community
version: '3.11'
doc_id: scalardb-analytics-postgresql/schema-importer
lifecycle_phase: implement
breadcrumb:
- Develop
generated:
  by: process:okf-build/1.0.0
  at: '2026-08-04T23:51:04Z'
sources:
- id: docs-scalardb-community
  resource: https://github.com/scalar-labs/docs-scalardb-community/blob/71d199cb0df1c638bd7e305b64fa09fc7236e5c4/versioned_docs/version-3.11/scalardb-analytics-postgresql/schema-importer.mdx
  title: ScalarDB Community documentation source (MDX)
  author: process:scalar-labs/docs-scalardb-community
  last_modified: '2025-04-07T11:32:02Z'
---

# 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](./getting-started.md).

## Build Schema Importer

You can build Schema Importer by using [Gradle](https://gradle.org/). To build Schema Importer, run the following command:

```console
./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:

```console
./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:

```console
java -jar <PATH_TO_FAT_JAR_FILE>
```
Available options are as follows:

| Name                        | Required | Description                                                                                                                                 | Default                                    |
| --------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| `--config`                  | **Yes**  | Path to the ScalarDB configuration file                                                                                                     |                                            |
| `--config-on-postgres-host` | No       | Path to the ScalarDB configuration file on the PostgreSQL-running host                                                                      | The same value as `--config` will be used. |
| `--namespace`, `-n`         | **Yes**  | Namespaces to import into the analytics instance. You can specify the `--namespace` option multiple times if you have two or more namespaces.    |                                            |
| `--host`                    | No       | PostgreSQL host                                                                                                                             | localhost                                  |
| `--port`                    | No       | PostgreSQL port                                                                                                                             | 5432                                       |
| `--database`                | No       | PostgreSQL port                                                                                                                             | postgres                                   |
| `--user`                    | No       | PostgreSQL user                                                                                                                             | postgres                                   |
| `--password`                | No       | PostgreSQL password                                                                                                                         |                                            |
| `--debug`                   | No       | Enable debug mode                                                                                                                           |                                            |

## Test Schema Importer

To test Schema Importer, run the following command:

```console
./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:

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