I am planning on using PG for production but for now I'm stuck on Mysql. Mysql does not seem to support Sequence..
can't I just do x = Column(Integer, autoincreament=True) Would that work on both? I cannot test PG just jet. On Jan 16, 2012, at 5:07 PM, Michael B ayer wrote: > > On Jan 16, 2012, at 6:29 AM, Martijn Moeling wrote: > >>> >>> Now I need to import data from the current production system. This data >>> already has Serialnumbers generated. >>> >>> What should I do to make this work? Do I need the sequence created after >>> the Import and set the Start value to the last imported SerialNumber+1 ? >>> I would prefer creating the sequence before the import and "Update" the >>> Sequence after the import. > > you can create the sequence with a start value if you pass "start=X" to > Sequence(). Or you can just bump it up with nextval(). Or PG allows you to > call setval() on it. You can pretty much set it to anything at at any > time. http://www.postgresql.org/docs/9.1/static/functions-sequence.html > > If you want to have things created before you deal with import data, then > just bump up the sequence as you go through your data. Assigning to > SerialNr on the Order will have the effect of not using the Sequence on > insert. Also the create_all() step will create the Sequence construct in > the DB also. > > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
