Skip to content

mtelesborges/python-sqlalchemy-alembic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQLAlchemy Logo

This project contain a basic implementation using SQLAlchemy and Alembic

This project uses poetry for environment managing and some libraries for code formatting

Installing SQLAlchemy and Alembic

poetry add SQLAlchemy

poetry add alembic

Configuring alembic

  • Initilizing alembic
# inside the project folder, run the following code
alembic init alembic
  • Configuring alembic database url
# update the file project/alembic/env.py adding the following code before the functions
config.set_main_option('sqlalchemy.url', os.environ.get('DATABASE_URL'))

Migrations

# creating migration
alembic revision --autogenerate -m "Initial migration"

# executing migrations
alembic upgrade head

Tests

# inside the poetry environment, run the following code
task test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published