Skip to main content

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

Project description

PyPI version Python version 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.0.tar.gz (6.5 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.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: crdb_schema_exporter-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 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.0.tar.gz
Algorithm Hash digest
SHA256 6ad47888b01e063a799fed7cd4f212b3fc5f766e595eb1eb3bc146edff35b1b1
MD5 2ee71514ffade13d89ad8d5c07672664
BLAKE2b-256 8143e3c239e15cf2c5ac24d65a00bdeb57b50ce82b24eaa511e8c77d501e89f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crdb_schema_exporter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 efb66a662e754d0b2f7a7724bc5b79e6ed5fcfe8d7ae51967d9bd02654408815
MD5 86351209936678d9c3f62c6927ad78fb
BLAKE2b-256 b2f8e46f8429754bbf5140e6fa2014694ef91c272a5c3e6d69dc9fc66d46d053

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