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

Weird Alembic Behavior

I have 2 migration scripts. Script 1: Base from models import EntityProperty from contextlib import contextmanager # revision identifiers, used by Alembic. revision = 'ecbde8fa83e3' down_revision = None branch_labels = None depends_on = None from…
amrx
  • 673
  • 1
  • 9
  • 23
0
votes
0 answers

Alembic trying to delete my pre-existing Postgres table

Hello I am trying extend my pre-existing Postgres database that containing one table using SQLAlchemy. But when I am trying use migrate, I have this from alembic migration: INFO [alembic.runtime.migration] Context impl PostgresqlImpl. INFO …
0
votes
1 answer

Check if upgrades run correctly before upgrading table schema using Alembic

I have a sample Table class a(Base): __tablename__ = 'a' id = Column(Integer,primary_key=True) username = Column(VARCHAR(255)) Now I made some changes to my other tables and also added unique constraint to "username" column in the…
Uchiha Madara
  • 984
  • 5
  • 16
  • 35
0
votes
0 answers

psql change timestamp type with timezone

I am currently having a Db in Postgres with a timestamp column setup as below: ts timestamp with time zone not null default (now() at time zone 'utc'), this is saving the ts : 2017-08-22 10:34:21.547703+00 This the utc time.…
Seb
  • 2,929
  • 4
  • 30
  • 73
0
votes
0 answers

Alembic bulk_insert not addind data to DB

I'm working for the first time with alembic and I want to insert data into a table after doing a migration. This is my code def upgrade(): acl_table = op.create_table('mqtt_acl', sa.Column('created_at', sa.DateTime(),…
0
votes
1 answer

Maya file format to improve playback speed

What is the best file format in Maya to improve the playback speed in Maya ? I read in the Maya Autodesk documentation that GPU cache files are optimized for fast playback performance in Maya. Are GPU cache files the best for it ? Thank you a lot
Caryluna
  • 87
  • 1
  • 1
  • 7
0
votes
0 answers

Django update migrations from sqlalchemy to south

I've a django project which was using alembic and sql alchemy for migrations. I'd upgraded django to 1.9 which has south by default for migrations. Is there any way to switch to south for adding and removing of new fields without creating migrations…
Kishore K
  • 2,425
  • 4
  • 18
  • 18
0
votes
1 answer

One to Many Relationship | Flask-SQLAlchemy and Flask-Migrate

Attempting a one-to-many relationship between an outbound email (child), the source (parent 1) and target (parent 2). I am attempting to use flask-migrate for the setup of the database. The command I'm using: python manage.py db migrate Getting the…
0
votes
1 answer

How to update a record in SQLAlchemy Alembic migration?

I'm writing a Database Migration script for my SQLAlchemy application. The migration below works. But it doesn't actually do anything (yet!): 1: from alembic import op 2: import sqlalchemy as sa 3: 4: def upgrade(): 5: my_table =…
Saqib Ali
  • 11,931
  • 41
  • 133
  • 272
0
votes
0 answers

bulk insert using alembic operation fails on primary key

I want to create a new table with my alembic migration file and add 2 records on the table. My upgrade() function def upgrade(): op.create_table( 'new_table', sa.Column('id', sa.Integer(), nullable=False), …
Apostolos
  • 7,763
  • 17
  • 80
  • 150
0
votes
1 answer

Hard to upgrade my staging db through flask migrate

I want to apply the changes made on local db to the cloud db. My local db has three tables, User, email_history, event_monitor. I have deleted my local migrations folder and then ran python manage.py db init, python manage.py db migrate commands. It…
Avinash Raj
  • 172,303
  • 28
  • 230
  • 274
0
votes
1 answer

What version of alembic do I have installed?

I want to know what version of alembic I have installed (the library itself, not which migration revision is current). I tried the obvious things like alembic --version, and could not find a combination that worked. I don't see anything relevant…
Alex Altair
  • 3,246
  • 3
  • 21
  • 37
0
votes
2 answers

Alembic: Enforce value uniqueness across two values

I have the following table mysql> describe table; +----------------+-------------+------+-----+-------------------+----------------+ | Field | Type | Null | Key | Default | Extra …
hlin117
  • 20,764
  • 31
  • 72
  • 93
0
votes
1 answer

Integrating tornado (4.4.1), sqlalchemy (1.1.0) and alembic (0.8.7) in Python 2.7

I am writing my first Python web application, and I want to use alembic for handling the migrations. So far I have done this (just pointing out the imp. files) and it doesn't seem to work. Project structure: project/ alembic.ini alembic/ …
draxxxeus
  • 1,503
  • 1
  • 11
  • 14
0
votes
1 answer

how to add ironic db version file. now install don't copying db version file. how to do?

please allow me ask question. very very thank you. I want to add a db version into ironic, the version in "ironic /db/sqlalchemy/alembic/version/" The db version file name I user ironic-dbsync generate version file name First: I use ironic-dbsyncto…
Paul
  • 195
  • 2
  • 4
  • 12