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:

97 questions
0
votes
1 answer

AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'alter'

I'm working on a project that has both older sqlalchemy-migrate-based migrations and newer alembic-based migrations. I'm trying to remove the former. Ripping it out was easy enough but I'm seeing the following failure when I run some tests after…
stephenfin
  • 1,447
  • 3
  • 20
  • 41
0
votes
0 answers

Alembic few modules to single database, with specific file migrations

We need to build a large application that split to multiple modules. Each module has own alembic version table, and in each module we generated the alembic migration, but the problem when I generate a migration file, inside it generate drop of all…
0
votes
2 answers

Add a column to existing class of sqlalchemy

I have a parent class that generates a unique id and a child class having a username. class Ids(object): id = Column(Integer, Sequence('res_id_seq'), primary_key=True) class Names(Ids, base): username = Column(String(50)) # I have…
0
votes
2 answers

How does it matter the schema defined using sqlalchemy, if Alembic has already defined the schema?

I'm using alembic for database migration. And using sqlalchemy to connect to the database using python. In alembic, we define table schema as the first version and this the actual one which creates the schema. For example, I have given schema like…
venkat
  • 453
  • 4
  • 16
0
votes
0 answers

How to handle psycopg2 undefined table error when migrating postgres db to heroku?

I have reviewed at least 20 stackover flow answers, plus lots of blog posts, and I am at a complete loss for how to migrate my local postgres db to heroku for a simple flask app. I have been following along with several different tutorials and…
buchmayne
  • 144
  • 1
  • 15
0
votes
1 answer

Why am I getting a 'not unique' error when referencing a primary key?

I have two models - Station: class Station(db.Model): """Measurement station""" __tablename__ = "station" reference = db.Column(db.Text, nullable=False, primary_key=True) name = db.Column(db.Text, nullable=False, primary_key=True) …
0
votes
0 answers

sqlalchemy-migrate does not find change file for version

I am evaluating SQLAlchemy-migrate as a database migration tool. My db_version is 0, and the repository version is 1. $ python manage.py db_version --url=postgresql://localhost:5432/my_db 0 $ python manage.py version 1 and I only have one…
0
votes
1 answer

Tweet Scheduler based on Flask Megatutorial: Issues with getting fields of flask-sqlalchemy databse

I'm in the process of modifying the Flask app created in following along Miguel Grinberg's Flask Mega Tutorial such that it is possible to post tweets. I have imported tweepy for accessing the twitter api and modified the databases to hold the…
0
votes
1 answer

Python unable to find sqlalchemy-migrate in Docker image

My task is to Dockerize a Python flask application. Part of this application makes use of sqlite to manage the users. The issue I am facing is python is complaining that it cannot find the sqlalchemy-migrate distribution. In order to isolate the…
Carl Wainwright
  • 328
  • 5
  • 18
0
votes
0 answers

How to update models.py when I add a new column with an ORM?

I'm fairly new to Python and ORMs and I have a pretty specific question. To handle SQL, a Python ORM needs to have models defined, likely in a file called models.py, right? Now, when I want to automatically create a new column when I add content to…
ryneke
  • 11
  • 1
  • 2
0
votes
2 answers

sqlalchemy error: object() takes no parameters error after dropping column from db model.py

I get the following error typeerror: object() takes no parameters on a mysql command which doesn't make sense to me. The error is due to dropping the username column from my models.py which I no longer require Below is the user model definition in…
0
votes
1 answer

Sqlite3 schema upgrade using alembic

I have C++ application (Linux) which uses sqlite3 db through APIs. Currently DB is shipped along with binaries in RPM. This DB has all required tables already. My application does not try to change any schema while running. Now I have to support db…
ND1125
  • 31
  • 2
  • 7
0
votes
1 answer

Database migration sqlaclhemy gives an attributeError

I've build a flask application with a sqlalchemy based db. I use the migrate script from: Link to mega tutorial But when i run this script i get a attributeError. here is a screenie from the error: Link to picture
qLuke
  • 109
  • 12
0
votes
2 answers

how to create auto-generated file from last revision in Alembic

I'm following this tutorial.. and the initial auto generate is perfect.. it basically creates the migration file with the upgrade and downgrade methods just fine. so let's say this is the migration file's revision number: 3e96cf22770b.. all of my…
abbood
  • 23,101
  • 16
  • 132
  • 246
0
votes
1 answer

Fabfile with support for sqlalchemy-migrate deployments?

I have database migrations (with sqlalchemy-migrate) working well in my dev environment. However, I'm a little stumped about how to integrate this into my deployment process. I'd like to use fabric to execute the manage.py file on the remote server…
Chris Reid
  • 151
  • 1
  • 5