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
1 answer

Merging different alembic revision heads fails on heroku

I'm working to modify a cookiecutter Flask app. locally I have deleted the migration folder and sqllite db a couple of times during development. I've pushed my chnages to heroku. When trying to migrate the heroku postgresdb : $ heroku run python…
user1592380
  • 34,265
  • 92
  • 284
  • 515
1
vote
1 answer

flask unable to run db migrate - NameError: name 'conn_uniques' is not defined

Every time I update my models I have to delete and reinitialize the database. ./manage.py db init and then initial ./manage.py db migrate work but every subsequent ./manage.py db migrate fails with the following error: INFO [alembic.migration]…
Sergo Pasoevi
  • 2,833
  • 3
  • 27
  • 41
1
vote
0 answers

Why is my database migration not doing anything?

When I run my migrations, it doesn't do anything: ➔ python db_control.py db upgrade INFO [alembic.migration] Context impl PostgresqlImpl. INFO [alembic.migration] Will assume transactional DDL.
John Bachir
  • 22,495
  • 29
  • 154
  • 227
1
vote
1 answer

alembic and development / production databases

For development purposes I am using sqlite, though I expect to use postgres in the production environment. I see that alembic supports multiple databases. What I am less clear on is whether the migration scripts for different database engines are…
user2449525
  • 158
  • 8
1
vote
1 answer

Why is Alembic running the wrong migration script?

When I try alembic upgrade head Alembic runs the previous migration script, obviously raising an error because my schema has changed. In my database, I have version_num set to 48957fdfe8d5. After running alembic revision -m '' Alembic…
jds
  • 7,910
  • 11
  • 63
  • 101
1
vote
1 answer

Python, Alembic.io, Cask: Properties of object do not save when using write_to_file()

I am often writing scripts for various 3d packages (3ds max, Maya, etc) and that is why I am interested with Alembic, a file format that is getting a lot of attention lately. Quick explanation for anyone who does not know this project: alembic -…
Kowalski Paweł
  • 594
  • 1
  • 6
  • 27
1
vote
1 answer

Alembic cannot import app

My structure: rootdir - app - alembic - env.py - __init__.py - alembic.ini - models.py My env.py has: from app.models import * from app import db target_metadata = db.metadata I get the error: ImportError: No module named 'app' when…
Tjorriemorrie
  • 16,818
  • 20
  • 89
  • 131
1
vote
0 answers

HDF5 error no file name specified, Crashes in Boost

I'm trying to build a source code on OSX but getting the following error when running it. It seems to be related HDF5 but I've got no clue how to fix that since the Linux and Win built of this source code already works fine. Error detected in HDF5…
Yasin
  • 609
  • 1
  • 10
  • 22
1
vote
1 answer

SQLAlchemy db interactions fail depending how I run the python script

This seems to be the most obscure issue I have dealt with so far. I am struggling hard. I have an application that collects remote data from some hardware and saves it to a database. I renamed one of the columns using alembic. I have a development…
Brian Leach
  • 3,974
  • 8
  • 36
  • 75
1
vote
1 answer

Performing alembic operations without intermediate commits

I'm trying to use alembic programmatically (without writing migrations) to perform some DDL operations on my database. import sqlalchemy import alembic context =…
BvdBijl
  • 607
  • 6
  • 16
1
vote
1 answer

Can I use .py file instead of .ini file on alembic?

I want to use alembic.py for configuration instead of alembic.ini. But I can't find any example of that type of configuration. Is there any way to not use alembic.ini?
Jony cruse
  • 815
  • 1
  • 13
  • 23
1
vote
0 answers

Update constraint with Flask-Migration

I'm trying to change a foreign key's constraint but I keep getting this error: sqlalchemy.exc.OperationalError: (OperationalError) (1025, "Error on rename of './tillsammans_dev/profile_accommodation_contact' to './tillsammans_dev/#sql2-4c1-37'…
jwanglof
  • 548
  • 1
  • 5
  • 20
1
vote
0 answers

sqlalchemy named cursor not found when using sqlalchemy.sql.text()

This runs fine: with conn.connection.cursor(name='migration_cursor') as ss_cur: ss_cur.execute("SELECT id, stuff FROM cart WHERE stuff_type={}".format(some_variable)) However, this fails: from sqlalchemy.sql import text with…
Ryan Norton
  • 145
  • 1
  • 2
  • 8
1
vote
1 answer

Inserting column to all tables in my database

I am required to create an evolution in alembic which adds two new columns to all tables in the database (excluding of course the alembic tables). Is it possible in alembic to iterate over all tables and execute alembic commands on them?
valanto
  • 893
  • 3
  • 8
  • 23
1
vote
1 answer

Is it possible to replace maya geometry cache with alembic cache?

I am researching the way to improve efficiency of using cache in Maya. For wide use, Alembic Cache is a good choice as I know. So, I try to use it as replacement of Geometry Cache(mcx). But Alembic Cache has a limitation of matching names of…
Hyun-geun Kim
  • 919
  • 3
  • 22
  • 37