Hey! Just started working with Pylons in combination with SQLAlchemy, and my model looks something like this:
from sqlalchemy import Column from sqlalchemy.types import Integer, String from helloworld.model.meta import Base class Person(Base): __tablename__ = "person" id = Column(Integer, primary_key=True) name = Column(String(100)) email = Column(String(100)) def __init__(self, name='', email=''): self.name = name self.email = email def __repr__(self): return "<Person('%s')" % self.name
In order to avoid reusing the sqlite identifier that might have been deleted, I want to add AUTOINCREMENT to the id column. I looked through the sqlalchemy documentation and saw that sqlite_autoincrement could be released. An example where this attribute is specified can be found here .
sqlite_autoincrement seems to be released when the table itself was created, and I just wondered how it could be provided using a declarative style model like mine.
sqlite sqlalchemy auto-increment pylons
Maxfrank
source share