On Friday 10 October 2008 19:42:19 Doug Farrell wrote:
> Hi all,
>
> I'm using SqlAlchemy 0.5rc1 to track jobs with a sqlite datatabe in
> a state machine used by a server. Each job represents a currently
> active job in the server and will "be alive" for awhile as it takes
> time for the server to process each job. When a job is done it is
> removed from the system, and the database. Each job has an integer
> autoincrementing primary key. This is just a flat table with no
> relations to any other table, with records being created and
> deleted as the jobs come into and go out of existance. The server
> runs for awhile (hours) but I've been getting these exceptions:
>
> Can't attach instance [EMAIL PROTECTED]; another instance with key (,
> (220,)) is already present in this session.
>
> What is this trying to tell me? Does this mean that a newly created
> job is trying to use the primary key of an already existing job?
could be that, but that means the autoincrement has wrapped over 
maxint?

otherwise such thing happens in scerarios like:
x = X()
sess.save(x)
sess.flush()
sess.clear()
y = sess.query(X).one()
#now u have two same instances: x and y
use sess.merge in this case, like x=sess.merge(x) before using x 
further

--~--~---------~--~----~------------~-------~--~----~
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