On Dec 1, 7:24 pm, imgrey <[EMAIL PROTECTED]> wrote:

>
> INFO sqlalchemy.engine.threadlocal.TLEngine.0x..6c ROLLBACK
> in postgresql-8.2-main.log: """EET LOG:  unexpected EOF on client
> connection """
>

I'll note that if the issue here is an EOF error in the PG logs, we
can look into seeing why that is; we do explicitly close all cursors
and connections when we close things, although a ROLLBACK does not
close any connections, just cursors.  so without any experimentation
its not clear what the source of your PG log error is, whether its a
natural side effect of how psycopg2 works, or whatever...but if the
ROLLBACK is failing as a result, thats not something we've observed
before and certainly not with a regular session.close().

heres a short test script:

from sqlalchemy import *
from sqlalchemy.orm import *

engine = create_engine('postgres://scott:[EMAIL PROTECTED]/test',
echo=True)

meta = MetaData(engine)
t = Table('foo', meta, Column('id', Integer))
t.create(checkfirst=True)

session = create_session(bind=engine)

session.connection()  # this doesnt really affect much
session.begin()
session.execute(insert(t), {'id':5})
session.commit()
session.close()

engine.dispose()


heres the PG logs:

LOG:  statement: SET DATESTYLE TO 'ISO'
LOG:  statement: SHOW client_encoding
LOG:  statement: SHOW default_transaction_isolation
LOG:  statement: BEGIN; SET TRANSACTION ISOLATION LEVEL READ COMMITTED
LOG:  statement: select relname from pg_class c join pg_namespace n on
n.oid=c.relnamespace where n.nspname=current_schema() and
lower(relname)='foo'
LOG:  statement:
        CREATE TABLE foo (
                id INTEGER
        )


LOG:  statement: END
LOG:  statement: BEGIN; SET TRANSACTION ISOLATION LEVEL READ COMMITTED
LOG:  statement: INSERT INTO foo (id) VALUES (5)
LOG:  statement: END


if the program ends without the engine.dispose() at the end, then you
get the "EOF" error, but thats just the python program ending without
psycopg2 cleanly disposing of opened connections.

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