Questions tagged [sqlalchemy-migrate]

Schema migration tools for SQLAlchemy, designed to support an agile approach to database design, and make it easier to keep development and production databases in sync, as schema changes are required.

Inspired by Ruby on Rails’ migrations, SQLAlchemy Migrate provides a way to deal with database schema changes in SQLAlchemy projects. Migrate was started as part of Google’s Summer of Code by Evan Rosson, mentored by Jonathan LaCour. The project was taken over by a small group of volunteers when Evan had no free time for the project. It is now hosted as a Google Code project. During the hosting change the project was renamed to SQLAlchemy Migrate.

Python 2.4-2.7 is supported.

Resources:

92 questions
53
votes
3 answers

alembic util command error can't find identifier

I'm trying to use alembic to handle local migrations on my project. It worked the first time, but then I needed to delete the folder and restart.(don't ask why, I just had to) I'm following this tutorial and I run the command python manage.py db…
47
votes
3 answers

Is it worth using sqlalchemy-migrate ?

I have a web application using sqlalchemy (within Pylons). I need to effiently change the schema to be able to change the production version at least on a daily basis, maybe more, without losing the data. I have played a little bit with…
ascobol
  • 7,026
  • 6
  • 45
  • 67
38
votes
2 answers

sqlalchemy postgresql enum does not create type on db migrate

I develop a web-app using Flask under Python3. I have a problem with postgresql enum type on db migrate/upgrade. I added a column "status" to model: class Banner(db.Model): ... status = db.Column(db.Enum('active', 'inactive', 'archive',…
20
votes
2 answers

Update column content during Alembic migration

Suppose my db model contains an object User: Base = declarative_base() class User(Base): __tablename__ = 'users' id =…
Jens
  • 6,642
  • 6
  • 45
  • 64
18
votes
8 answers

Cannot complete Flask-Migration

I've setup a local Postgres DB with SQLAlchemy and cannot commit my first entry. I keep on getting this error... ProgrammingError: (ProgrammingError) relation "user" does not exist LINE 1: INSERT INTO "user" (name, email, facebook_id,…
Suraj Kapoor
  • 1,273
  • 3
  • 16
  • 34
17
votes
3 answers

How to write alter column name migrations with sqlalchemy-migrate?

I'm trying to alter a column name. First attempt was with this script: meta = MetaData() users = Table('users', meta, Column('id', Integer, primary_key=True), Column('name', String(50), unique=True), Column('email', String(120),…
PEZ
  • 15,930
  • 6
  • 39
  • 63
15
votes
3 answers

Flask-Migrate sqlalchemy.exc.NoReferencedTableError: Foreign key associated with column

I am using Flask-Migrate in my application, with the following models: listpull/models.py from datetime import datetime from listpull import db class Job(db.Model): id = db.Column(db.Integer, primary_key=True) list_type_id =…
11
votes
3 answers

Update an sqlite database schema with sqlalchemy and elixir

I've created a python application which uses elixir/sqlalchemy to store data. The second release of the software requires any files created in the previous version to be updated in order to add/delete tables and columns. My question is: how can I…
Jon
  • 8,066
  • 8
  • 43
  • 62
10
votes
1 answer

Default value ignored in non-nullable column

I'm trying to create a new boolean, non-nullable column (with default=True) in a table with the following SQL alchemy script: from sqlalchemy import MetaData, Table, Boolean, Column def upgrade(migrate_engine): meta =…
phihag
  • 245,801
  • 63
  • 407
  • 443
9
votes
1 answer

Flask Database Issue

I am using this tutorial as a guideline. http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iv-database I want to have Categories that can heave multiple Products. Similar to how he has a User with multiple Posts. when I open up the…
Siecje
  • 3,226
  • 8
  • 30
  • 48
6
votes
2 answers

Is there an SQLAlchemy equivalent of django-evolution?

All I want is to have a workflow somewhat similar to: Add django_evolution to the INSTALLED_APPS for your project Run ./manage.py syncdb Make modifications to the model files in your project Run ./manage.py evolve --hint --execute Which is super…
ubershmekel
  • 9,570
  • 6
  • 62
  • 78
6
votes
1 answer

sqlalchemy: "Neither 'InstrumentedAttribute' object nor 'Comparator' object has an attribute" error

I've added a table to a database using sqlalchemy and sqlalchemy-migrate, and when I run unit tests on unrelated code that hits the database, I get the following error: Traceback (most recent call last): File…
Lorin Hochstein
  • 51,296
  • 30
  • 96
  • 131
6
votes
1 answer

Where can I find good examples or tutorials for sqlalchemy-migrate

In this thread someone pointed me to use sqlalchemy-migrate to help with a fast-changing web application using sqlalchemy. However a Do It Yourself method was also recommended consisting in manually writing CSV columns for the new database schema,…
ascobol
  • 7,026
  • 6
  • 45
  • 67
6
votes
2 answers

Why am I getting SQLAlchemy Error "__table_args__ value must be a tuple, dict, or None"

I have the following SQLAlchemy Model. It has been successfully migrated to the database: class MyClassA(db.Model, Timestamp): a_id = db.Column(db.Integer, nullable=False, primary_key=True) b_id = db.Column(db.Integer, db.ForeignKey(C.c_id),…
Saqib Ali
  • 9,138
  • 28
  • 99
  • 216
6
votes
1 answer

SQLAlchemy Migrate - Can I add (or modify) a column to a certain position of an existing table?

I want to add a column to a certain position of an existing table or move one of the columns. But I can't find any method in Sqlalchemy-migrate. I want to know methods equivalent following MySQL queries in sqlalchemy-migrate ALTER TABLE tablename…
Daehee Kim
  • 61
  • 3
1
2 3 4 5 6 7