Something's changed with sqlite since 0.6. Once a sqlite engine is created to a physical file the usual workaround for schema change does not work. It works correctly on sqlite in memory and even when reattaching from memory to a file.
from sqlalchemy import Column, Sequence, create_engine, Integer from sqlalchemy.ext.declarative import declarative_base import os Base = declarative_base() metadata = Base.metadata class A(Base): __tablename__ = 'A' __table_args__ = {'schema':'S'} id = Column(u'ID', Integer, Sequence('A_PK'), primary_key=True) e = create_engine('sqlite://', echo=True) e.execute("attach database 'test.db' as S;") metadata.bind = e metadata.create_all() # all good e = create_engine('sqlite:///test.db', echo=True) e.execute("attach database 'test.db' as S;") metadata.bind = e metadata.create_all() # OperationalError: (OperationalError) unknown database "S" 'PRAGMA "S".table_info("A")' () os.remove('test.db') # the work-around I came up with e = create_engine('sqlite://', echo=True) e.execute("attach database 'test.db' as S;") metadata.bind = e metadata.create_all() # works fine again, tables were created in file Previously (ver. 0.6), the OperationalError would not occur. Neither SQLite nor pysqlite version have changed. -- Victor Olex http://linkedin.com/in/victorolex http://twitter.com/agilevic -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.