I'm connecting to an Oracle database for my work and we do replication by periodically joining tables across sites instead of a single server just in case a link in between goes down. One issue with this though is I need to generate unique keys for a single table so if the connection does go down, insertions to both tables won't cause a conflict when it's time to merge.
Because the ids aren't important to me during insertion, I just use a Sequence object (since Oracle doesn't support autoincrementing). This has worked fine, but I'm now trying how to combine this with the unique keys across the two sites. I noticed the Sequence class has a start and increment tag, which I thought would work perfectly by interleaving the keys per site. For example... if site1: init = 0 else: init = 1 sequence = Sequence('id_seq',start=init,increment=2) I don't see any actual documentation for what start and increment do (http://www.sqlalchemy.org/docs/core/schema.html#sqlalchemy.schema.Sequence), so I'm just assuming they function as I'd expect, where start is the first id to try and increment is the space between the possible id's, so site 1's ids will always be % 2 == 0, while site 2's would be % 2 == 1. This doesn't seem to be what I'm getting however. In a few test cases on one site, the first id starts at 10,283 and the next one generated is 10,284. In this case it's starting at a crazy high value other than 0 and it doesn't seem to be incrementing at all. Am I using these flags incorrectly? Is this a bug in sqlalchemy? Deprecated flags? Or is this whole idea garbage and I should use a guid? Thanks. -- 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.