support for Sequence in create_all

Issue #1565 resolved
Former user created an issue

A Sequence defined outside of a table definition (that is bound using the metadata keyword) is not created when the metadata's create_all method is called. Why is this a problem, why not just put the sequence definition in the table? Giving the same column a default value (for example, that of calling the sequence's execute method / nextval) appears to cause SQLA to ignore the sequence. This is useful for when a sequence is being used by more than one table. Fixing the create_all issue is a more elegant solution than fixing the default issue, and perhaps the latter is intended behaviour.

Comments (3)

  1. Former user Account Deleted

    Just happened to glance around and saw #1563, I hadn't thought to try using server_default (which actually makes more sense) so the problem is resolved. I think it'd still be nice to be able to create the sequence with create_all though!

  2. Mike Bayer repo owner

    you can do this in 0.6 via:

    CreateSequence(some_sequence).execute_at("after-create", metadata)
    
  3. Log in to comment