Reputation: 8343
I am using SQLAlchemy 0.4.8 with Postgres in order to manage my datastore. Until now, it's been fairly easy to automatically deploy my database: I was using metadata.create_all(bind=engine)
and everything worked just fine. But now I am trying to create a sequence that it's not being used by any table, so create_all()
doesn't create it, even though it's define correctly:
Sequence('my_seq', metadata=myMetadata)
.
Any thoughts on how I could make this work ?
P.S. And it's not possible at the moment to upgrade to a newer version of SQLAlchemy.
Upvotes: 8
Views: 1711
Reputation: 77032
Could you call the create
it by using its own Sequence.create method:
my_seq = Sequence('my_seq', metadata=myMetadata)
# ...
metadata.create_all(bind=engine)
# @note: create unused objects explicitly
my_seq.create(bind=engine)
# ...
Upvotes: 6