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

Appearance settings

pythongosssss/sqlalchemy-sample

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample sqlalchemy project showing simple usage, schema migration and data migration.

Setup

Create virtual environment
python -m venv venv

Activate virtual environment
venv\Scripts\activate (Windows)
source venv/bin/activate (Linux/MacOS)

Install dependencies
pip install -r requirements.txt

Running

python main.py

Altering the database

Update db/models.py to e.g. add new column

Generate a new migration
alembic revision --autogenerate -m "your message"

Test upgrade

alembic upgrade head or running main.py will do this automatically if required

Downgrade

alembic downgrade -1

Reset migration/database

Delete alembic/versions/*
Delete testdb.db
Generate a new migration

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.