Questions tagged [alembic]

Alembic is a lightweight database migration tool for usage with the SQLAlchemy Database Toolkit for Python.

Alembic is a lightweight database migration tool for usage with the SQLAlchemy Database Toolkit for Python.

Some of the important operations that can be performed with alembic are

  • Upgrade(Perform Database migrations, Example: create/alter/modify)
  • Downgrade(Its the reverse operation of upgrade to undo the upgrade changes)
  • Current(Show the current revision and state of migration in the database)
  • Init(Initialize a new scripts directory)
  • Revision(Create a new revision file)

Related tags

References

854 questions
1
vote
0 answers

How to easily alter columns with Flask-Migrate?

I need to upgrade a model (add some columns) in my Flask app and I try to use Flask-Migrate to do this. Problem : No support for ALTER of constraints in SQLite. Commands I used : db migrate > db upgrade I read that there's probably something in the…
dnmxm
  • 260
  • 1
  • 11
1
vote
2 answers

Alembic operations with multiple schemas

NOTE: This is a question I have already found the answer for, but wanted to share it so it could help other people facing the same problem. I was trying to perform some alembic operations in my multi-schema postgresql database such as .add_column or…
1
vote
0 answers

"ModuleNotFoundError: No module named

got a problem developing app using alembic 1) Here's my project structure 2) Backend package structure 3) Alembic folder structure Well, at the env.py i have imports from backend.db.db_manager import declarative_base from backend.db_config import…
1
vote
2 answers

Error running migrations in a docker container

I am getting this error when trying to run migrations in my container. I cannot seem to figure out why. Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"alembic\": executable…
Kendrick Lamar
  • 781
  • 2
  • 8
  • 18
1
vote
1 answer

Alembic: how to downgrade an entire branch?

Say this is my graph of alembic versions: a -> b -> c -> d \> e -> f i'm interested in rolling back e and f but not c and d so the issue is: alembic downgrade takes an argument that represents the target revision (rather than the revision…
Aviv Goldgeier
  • 799
  • 7
  • 23
1
vote
0 answers

Alembic Migration for tables in SQLalchemy with index=true columns gives duplicate index error

My Previous Model: class sample(Base): __tablename__ = "sample" id = Column(BigInteger, primary_key=True,index=True) name = Column(String(30),index=True) My Latest Model: class sample(Base): __tablename__ = "sample" id =…
1
vote
1 answer

Fieldname modification in models SQLalchemy using ALEMBIC throws "Duplicate Column Name Error"

My Previous Model: class sample(Base): __tablename__ = "sample" id = Column(BigInteger, primary_key=True,index=True) Name = Column(String(30),index=True) My Latest Model: class sample(Base): __tablename__ = "sample" id =…
1
vote
0 answers

Flask-migrate staging on google app engine (GAE) / Cloud SQL

I have a flask app connected to a local postgres db with SQlAlchemy for dev purposes. I also have a live version of the app running on Google App Engine which is connected to a postgres db on CloudSQL I am trying to use flask-migrate (which builds…
1
vote
0 answers

flask_migrate BIGINT column length is ignored first time with MySQL

I have passed compare_type=True to the constructor of Mirate. migrate = Migrate(app, db, compare_type=True) My models are following: class User(db.Model): __tablename__ = 'user' id = Column(mysql.BIGINT(20, unsigned=True), …
nsssayom
  • 364
  • 1
  • 5
  • 21
1
vote
1 answer

How to enable verbosity on "alembic upgrade head"?

In one of the python projects I'm working on we are using alembic to handle the DB migration scripts. Lately he had an incident when container ,in which alembic upgrade head is running, got stucked ( by some locks on the DB set the the runtime app)…
Yonoss
  • 1,242
  • 5
  • 25
  • 41
1
vote
0 answers

How to use Alembic outside of python applications?

I am looking to extend on top of or use an existing tool for the purpose of database migrations. As we have applications in different languages, I need the tool to be language independent. I came across dbmate which solves my use case but Go…
oyeesh
  • 551
  • 9
  • 21
1
vote
0 answers

RuntimeError: Working outside of application context using Flask and Flask-Migrate

I'm trying to write a cache module using Flask and Flask-migrate. I get the following error: Traceback (most recent call last): File "manage.py", line 7, in migrate = Migrate(current_app, db) File…
izdwuut
  • 11
  • 3
1
vote
0 answers

Bake Alembic and export as glTF or FBX with animation

I have an Alembic animation of a flower growing. I am attempting to export it as glTF or FBX with the animation intact, but without success. My end goal is to be able to use the animated file in the browser, or in Spark AR. I have tried using…
Jonas Johansson
  • 229
  • 1
  • 3
  • 11
1
vote
1 answer

Prevent alembic auto-migration from being generated when there are no changes to the schema

I am working on a flask application and using Flask-Migrate with a snowflake database through the snowflake-sqlalchemy connector. I have the following models in my app/models.py: class User(db.Model): username = db.Column(db.String(100),…
1
vote
1 answer

Create database using Alembic

I have database migrations that use database1. I'm using it for Alembic for migrations. How do I create a database database1 before running alembic? I've created a database infrastructure using CloudFormation. And when we run the first migration,…
Ganesh Satpute
  • 3,664
  • 6
  • 41
  • 78