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

sqlalchemy-migration generates wrong script for db.func.current_timestamp()

I use a postgresql9.4+flask+sqlalchemy in my current project. For making database migrations I decided to use sqlalchemy-migrate. But I've met the problem that this tool does not represent default value for the field correctly. To simplify my…
ruslash
  • 864
  • 1
  • 8
  • 12
1
vote
1 answer

How to create a migration script to add a Geometry column in SQLAlchemy-Migrate?

I'm following the Flask mega tutorial. It all worked well until I tried to add a Geometry column to the database. Note it is in the Post class, called location. #! model.py from app import db from geoalchemy2 import Geometry class User(db.Model): …
1
vote
0 answers

FileNotFoundError [Error2] occurring even when the absolute path is being provided

I am working through flask following this tutorial. When running the db_migrate.py script I am getting a file not found error on the open(migrations, "wt") command. db_migrate.py #!flask/bin/python import imp from migrate.versioning import api from…
Bhargav
  • 898
  • 1
  • 14
  • 32
1
vote
0 answers

flask sqlalchemy migrate for a single postgres schema?

I am trying to perform db version control in postgres for just one schema, lets call it mySchema. Ideally I could use the api.create_model command below from the migrate.versioning package. The problem is I want to do this just for the mySchema…
mgoldwasser
  • 14,558
  • 15
  • 79
  • 103
1
vote
1 answer

Flask db migrate doesn't affect my database tables

I'm trying to implement the Flask manager for SQLalchemy. When I run python run.py db migrate then python run.py db upgrade, my tables aren't affected. I just removed a field from my models.py file that should be removed from the table. Here are my…
user2094540
1
vote
1 answer

How to alter column type from character varying to integer using sqlalchemy-migrate

I'm using sqlalchemy-migrate to alter the type of one of the columns in a table in a Postgre SQL database. The upgrade script I'm using is: # -*- cofing: utf-8 -*- from sqlalchemy import MetaData, Table, Column, String, Integer from migrate import…
Willington Vega
  • 4,732
  • 3
  • 21
  • 19
0
votes
1 answer

How to migrate data to new table with some default value from old table in SQL

I have table User with field username, password. I want to create tracking_user table with these field: username, password, custom, time. How can I create SQL script to create tracking_user with username, password from user table and custom have…
MIM
  • 19
  • 7
0
votes
0 answers

ProgrammingError sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column todos.completed does not exist

I'm trying to complete a Udacity project and the code supplied is not running. It is supposed to be a todo app that can perform CRUD functions. I am struggling to perform the delete function on the code. So far i have done the CREATE, READ, UPDATE…
Ada
  • 9
  • 2
0
votes
1 answer

How to specify data type while writing a Unique constraint using sql alchemy

I have some python code that I am refactoring, I can see that the tables have a column called "my_column" with a data type integer. Does this automatically get created? Also is there a way I can explicitly set the data type of "my_column" to…
capedCoder
  • 289
  • 1
  • 3
  • 9
0
votes
1 answer

Disabling SQL alchemy relationship in a model

I have a SQLAlchemy model called Hospital that maps to a table in the DB with various fields. I also have another table called Animal and a Hospital logically contains Animals so I have a relationship like this in the Hospital model: animals =…
user2399453
  • 2,930
  • 5
  • 33
  • 60
0
votes
0 answers

How to use SQLAlchemy ORM with SQLAlchemy Migrate?

I was using SQLAlchemy ORM to connect to a in memory database when I decided to implement a versioning tracking to the DB schema. To do this I've been following the tutorial on how to set up Versioning using SQLAlchemy, but now I'm wondering if…
Tolure
  • 859
  • 1
  • 14
  • 34
0
votes
0 answers

SQL alechmy update database schema

I'm using SQL alechmy for a project, I've got a system running with some important data, but I would like to update my schemas to make new features. What's the best practice here? Can schemas be updated without dropping all tables and recreate…
C Lu
  • 87
  • 8
0
votes
1 answer

Snowflake DB Transfer to Postgres

I'm trying to make a complete copy of a Snowflake DB into PostgreSQL DB (every table/view, every row). I don't know the best way to go about accomplishing this. I've tried using a package called pipelinewise , but I could not get the access needed…
0
votes
1 answer

Broke my Flask-sqlalchemy sqlite db instance

While testing my Flask applications functionality i somehow broke my db by editing my models during up/downgrading. I am using Migrate for this purpose but i am fairly new to it. which leads to my question: How do I completely reset my db(Migrate…
0
votes
1 answer

SQLAlchemy objects don't recognize new columns after DB schema was changed

I have a local DB set up for which I create object-relational mapping with SQLAlchemy objects. Everything was fine until I changed the schema of the DB - including adding a new column to one of the tables. Now I keep…