On Dec 1, 7:24 pm, imgrey <[EMAIL PROTECTED]> wrote:
>
> > OK, i guess you are using the SAVEPOINT then since the postgres docs
> > seem to recommend that as a workaround for the transaction abort its
> > doing at the IntegrityError point...and the abort is bad for you
> > because you want to recover from it, meaning that you're essentially
> > using the IntegrityError as a method of checking for existing data.
>
> Where is the flaw in such approach ? The thing is in necessity to
> minimize the time of one transaction as most as possible, since very
> intensive load expected. But I've replaced it with select/insert
> sequence anyway.
I think the error throw of the IntegrityError is totally expensive
from both a DB perspective as well as a python perspective. if
missing data is truly so rare then it might be fine, but the
necessesity of then using SAVEPOINT seems to complicate things more
than necessary. but you'd have to benchmark different scenarios to
see which is best.
>
> if not metadata.is_bound():
> metadata.bind = db
> session.connection()
> session.begin()
> session.execute(insert(f_table), {'user_id': 1,
> 'path': '/',
> 'ls': [],
> })
> session.commit()
> session.close()
>
> INFO sqlalchemy.engine.threadlocal.TLEngine.0x..6c ROLLBACK
> in postgresql-8.2-main.log: """EET LOG: unexpected EOF on client
> connection """
>
when you close your session, the underlying connection is returned to
the connection pool where it gets rolled back. if you want a
connection that stays opened, either dont close the session, or check
out the connection from the engine explicitly and bind your session to
it.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---