Skip to content

Instantly share code, notes, and snippets.

@davehague
Last active March 4, 2025 15:50
Show Gist options
  • Save davehague/450ce8f9c19e5184f9943ad9d6a41b84 to your computer and use it in GitHub Desktop.
Save davehague/450ce8f9c19e5184f9943ad9d6a41b84 to your computer and use it in GitHub Desktop.
Export Supabase Table Schemas

Setup

  1. Download and install pgAdmin
  2. Get your Supabase connection settings from the database settings page.

Export

In pgAdmin:

  1. Right click the schema and choose 'CREATE script' to script the schema
  2. Right click the schema and choose 'BACKUP...' to script the tables
    • For filename put in a FULL path ("C:/users/name/Downloads/export.sql")
    • For Format choose 'Plain'
    • In the 'Data Options' tab choose 'Only Schemas'
    • In the 'Objects' tab select the object you want to export

Alternatives

Another option could be to use a Python script like the db-schema-extractor, which makes extraction a single command:

# Extract schema and save to output directory
python db_schema_extractor.py -c configs/my-database.ini -o output/my-schema.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment