you need to call ALTER SEQUENCE on your sequences such that they begin  
with an integer identifier greater than that of the table they are  
being used with.


On Nov 9, 2008, at 1:22 PM, Petr Kobalíček wrote:

> I have found some material about this and this is called 'sequences'
> in postgres terminology.
>
> So I know the problem, but I don't know how to synchronize sequences
> using sqlalchemy.
>
> Cheers
> - Petr
>
> 2008/11/9 Petr Kobalíček <[EMAIL PROTECTED]>:
>> Hi devs,
>>
>> I have postgres related problem. I'm normally developing with sqlite,
>> but we are using postgres on the server. The problem is that
>> sqlalchemy probably remembers primary keys and after database restore
>> it will start in all tables from 1.
>>
>> The error is (IntegrityError) duplicate key violates unique  
>> constraint.
>>
>> I'm defining tables in way that's in documentation, we want to  
>> include
>> more databases so we are not using specific DB extensions:
>>
>> # Example
>> OrderTable = sql.Table(
>> "Order", meta.metadata,
>> # Relation
>> sql.Column("orderId"             , sql.Integer      ,  
>> primary_key=True),
>> # If userId == None, the order is anonymous
>> sql.Column("userId"              , sql.Integer      ,
>> sql.ForeignKey("User.userId"), nullable=True),
>>
>> ...
>>
>> I don't know if this problem was discussed before, but I didn't found
>> any informations about this.
>>
>> Cheers and thanks for replies:)
>> - Petr
>>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to