Skip to main content

A CLI utility to export CockroachDB schemas in SQL, JSON, or YAML formats.

Project description

PyPI version Python versions License Build status

CRDB Schema Exporter

A CLI tool to export schema definitions (DDL) from CockroachDB into SQL, JSON, or YAML formats. Supports secure TLS connections, per-table output, schema diffing, and archive packaging.

Features

  • Export tables, views, sequences, and user-defined types
  • Output formats: SQL, JSON, YAML
  • Optional: per-object files
  • Optional: output archive (.tar.gz)
  • Optional: schema diff
  • Secure connection with TLS certificates

Installation

Install from source:

pip install .

Build and install from source distribution:

python -m build
pip install dist/crdb_schema_exporter-0.1.0-py3-none-any.whl

Install from PyPI:

pip install crdb-schema-exporter

⚠️ Note: You must install the CockroachDB dialect:

pip install sqlalchemy-cockroachdb

Usage

crdb-schema-exporter --db=mydb --host=localhost [options]

Options

  • --db (required) – CockroachDB database name
  • --host – CRDB host (default: localhost)
  • --certs-dir – Path to TLS certificate directory
  • --tables – Comma-separated list of tables (db.table1,db.table2,...)
  • --per-table – Output individual files per object
  • --format – Output format: sql (default), json, yaml
  • --archive – Package output directory into a .tar.gz file
  • --diff – Compare exported schema against another SQL file
  • --parallel – Enable parallel exports
  • --verbose – Enable detailed debug logging
  • --log-dir – Directory to store log files (default: logs/)

Output

By default, exported schema files are saved under:

crdb_schema_dumps/<db_name>/

For example:

crdb_schema_dumps/movr/movr_schema.sql

Example

crdb-schema-exporter --db=movr --per-table --format=yaml --archive --verbose

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crdb_schema_exporter-0.1.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crdb_schema_exporter-0.1.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file crdb_schema_exporter-0.1.1.tar.gz.

File metadata

  • Download URL: crdb_schema_exporter-0.1.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for crdb_schema_exporter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 555727e03601912a00b1410b53b4e0ca193ac7d0d5266146d18f7c96b24e54df
MD5 e3aa9ffff317e08b80d9fc51db80fc8c
BLAKE2b-256 6c5ebcf47578dbdec7de738ab06b220221d6387633d92392d7a52a8ced01f5d1

See more details on using hashes here.

File details

Details for the file crdb_schema_exporter-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for crdb_schema_exporter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 69094f0fe73a80d80200363d26b502a1a06351783ee2305dd7f902c0c4306a1f
MD5 69fb68d59b551af30ce016e4da1b8dec
BLAKE2b-256 16cc1aa1eff250bca167a53be0de542cf9d2148463d35dd4c4afce930a934731

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page