I'm looking to create an auto increment column on a non-primary key column. I'm using SqlAlchemy 0.6.0 and MySQL 5
CREATE TABLE person (
id INTEGER NOT NULL AUTO_INCREMENT,
first_name VARCHAR(100) NOT NULL,
last_name VARCHAR(100) NOT NULL,
PRIMARY KEY (first_name, last_name),
UNIQUE (id)
)
but would like to do it with SQLAlchemy, so I can keep my whole schema defined in Python.
I've tried using a Sequence() object as an argument to my column definition, but to no avail with MySQL. Is it possible to just add the "AUTO_INCREMENT" string to the table definition? I realize this would be a MySQL-only solution, but would be willing to accept that for now.
Thanks,
Anthony Theocharis