Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

jetbase-hq/jetbase

Repository files navigation

Welcome to Jetbase πŸš€

Jetbase is a simple, lightweight database migration tool for Python projects.

Jetbase helps you manage database migrations in a simple, version-controlled way. Whether you're adding a new table, modifying columns, or need to undo a change, Jetbase makes it super easy!


Created and maintained by Jaz πŸ› οΈ


Key Features ✨

  • πŸ“¦ Simple Setup β€” Get started with just one command
  • ⬆️ Easy Upgrades β€” Apply pending migrations with confidence
  • ⬇️ Safe Rollbacks β€” Made a mistake? No problem, roll it back!
  • πŸ“Š Clear Status β€” Always know which migrations have been applied and which are pending
  • πŸ”’ Migration Locking β€” Prevents conflicts when multiple processes try to migrate
  • βœ… Checksum Validation β€” Detects if migration files have been modified
  • πŸ”„ Repeatable Migrations β€” Support for migrations that run on every upgrade

πŸ“š Full Documentation

Quick Start πŸƒβ€β™‚οΈ

Installation

Using pip:

pip install jetbase

Using uv:

uv add jetbase

Note for Snowflake and Databricks Users:
To use Jetbase with Snowflake or Databricks, install the appropriate extras:

pip install "jetbase[snowflake]"
pip install "jetbase[databricks]"

Initialize Your Project

jetbase init
cd jetbase

This creates a jetbase/ directory with:

  • A migrations/ folder for your SQL files
  • An env.py configuration file

Configure Your Database

Edit jetbase/env.py with your database connection string (currently support for postgres, sqlite snowflake, databricks):

PostgreSQL example:

sqlalchemy_url = "postgresql+psycopg2://user:password@localhost:5432/mydb"

SQLite example:

sqlalchemy_url = "sqlite:///mydb.db"

Create Your First Migration

jetbase new "create users table" -v 1

This creates a new SQL file called V1__create_users_table.sql.

Tip:
You can also create migrations manually by adding SQL files in the jetbase/migrations directory, using the V<version>__<description>.sql naming convention (e.g., V1__add_users_table.sql, V2.4__add_users_table.sql).

Write Your Migration

Open the newly created file and add your SQL:

-- upgrade
CREATE TABLE users (
 id SERIAL PRIMARY KEY,
 name VARCHAR(100) NOT NULL,
 email VARCHAR(255) UNIQUE NOT NULL
);
CREATE TABLE items (
 id SERIAL PRIMARY KEY,
 name VARCHAR(100) NOT NULL
);
-- rollback
DROP TABLE items;
DROP TABLE users;

Apply the Migration

jetbase upgrade

That's it! Your database is now up to date. πŸŽ‰

Note:
Jetbase uses SQLAlchemy under the hood to manage database connections.
For any database other than SQLite, you must install the appropriate Python database driver.
For example, to use Jetbase with PostgreSQL:

pip install psycopg2

You can also use another compatible driver if you prefer (such as asyncpg, pg8000, etc.).

Supported Databases

Jetbase currently supports:

  • βœ… PostgreSQL
  • βœ… SQLite
  • βœ… Snowflake
  • βœ… Databricks
  • βœ… MySQL

Need Help?

Open an issue on GitHub!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /