Convert Convex snapshot exports to PostgreSQL schema and data SQL files
Project description
convex2pg
Convert a Convex snapshot export to PostgreSQL schema.sql + data.sql files.
Zero dependencies — standard library only.
Install
pip install -e ~/dev/convex2pg
# or with pipx (recommended for CLI tools)
pipx install ~/dev/convex2pg
Usage
# Write schema.sql + data.sql into the export directory
convex2pg ./my-convex-export/
# Write to a different output directory
convex2pg ./my-convex-export/ --output ./sql/
# Schema only (no inserts)
convex2pg ./my-convex-export/ --schema-only
# Data only (no CREATE TABLE)
convex2pg ./my-convex-export/ --data-only
# Print to stdout (pipe into psql)
convex2pg ./my-convex-export/ --stdout | psql -U user -d mydb
# Show per-table details
convex2pg ./my-convex-export/ --verbose
Convex export format
A Convex snapshot export is a directory containing:
export/
├── _tables/documents.jsonl # table metadata (skipped)
├── <table>/
│ ├── documents.jsonl # one JSON object per line
│ └── generated_schema.jsonl # Convex type info
└── _components/
└── <component>/
└── <table>/
├── documents.jsonl
└── generated_schema.jsonl
Type mapping
| Convex type | PostgreSQL type |
|---|---|
normalfloat64 |
DOUBLE PRECISION |
normalint64 |
BIGINT |
field_name |
TEXT |
boolean |
BOOLEAN |
array/object |
JSONB |
Convex ID (_id, *Id fields) |
VARCHAR(50) |
Timestamp fields (*At, *Time, expires*) |
BIGINT (ms since epoch) |
Timestamps are stored as milliseconds since epoch (BIGINT).
Convert to TIMESTAMP in PostgreSQL with:
SELECT to_timestamp(created_at / 1000.0) FROM "user";
Load into PostgreSQL
psql -U youruser -d yourdb -f schema.sql
psql -U youruser -d yourdb -f data.sql
This was written entirely by Claude
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file convex2pg-0.1.0.tar.gz.
File metadata
- Download URL: convex2pg-0.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c9fa04f84d52daeaf7172c6ec1ceb7db73bc29cc16736eff01fcb7fb7b34cf2
|
|
| MD5 |
75ba2f02c3ee906626734d7a8c5958e1
|
|
| BLAKE2b-256 |
a8d40a02d02e99b1121d4e43fa288d80411949d333399c8c9f7955c82cf8d868
|
Provenance
The following attestation bundles were made for convex2pg-0.1.0.tar.gz:
Publisher:
publish.yml on northjosh/convex2pg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
convex2pg-0.1.0.tar.gz -
Subject digest:
9c9fa04f84d52daeaf7172c6ec1ceb7db73bc29cc16736eff01fcb7fb7b34cf2 - Sigstore transparency entry: 976802950
- Sigstore integration time:
-
Permalink:
northjosh/convex2pg@40ce7ec8345f6055d1e87fabe687ac4a148151b7 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/northjosh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@40ce7ec8345f6055d1e87fabe687ac4a148151b7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file convex2pg-0.1.0-py3-none-any.whl.
File metadata
- Download URL: convex2pg-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b1a5b75200a88597c9114d09e8d79d6e2ca13f0f815a60b22a385f85519ab33
|
|
| MD5 |
70c09f7cda43e7b1753853ec6833db17
|
|
| BLAKE2b-256 |
1aea516ee76cb1d09329aea49fffcae1519269d22b237b92b2600c6390e3de62
|
Provenance
The following attestation bundles were made for convex2pg-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on northjosh/convex2pg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
convex2pg-0.1.0-py3-none-any.whl -
Subject digest:
8b1a5b75200a88597c9114d09e8d79d6e2ca13f0f815a60b22a385f85519ab33 - Sigstore transparency entry: 976802952
- Sigstore integration time:
-
Permalink:
northjosh/convex2pg@40ce7ec8345f6055d1e87fabe687ac4a148151b7 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/northjosh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@40ce7ec8345f6055d1e87fabe687ac4a148151b7 -
Trigger Event:
push
-
Statement type: