On 24 Gen, 23:31, Rick Morrison <rickmorri...@gmail.com> wrote:
> > Oh... i didn't explain myself... I mean that it's already empty at the
> > first cycle of the loop...
>
> It would be normal to not enter the loop if you haven't yet opened any
> connections, as connections are opened on demand. Make sure your program
> issues at least one query during this test. If you are already issuing
> queries, then bundle up this as a simple test case as you can make, and
> we'll have a look at it.

I was already issuing some queries... ( that's why sql server profiler
tells me that there's an opened connection ). Here's a more complete
example:

import pyodbc
pyodbc.pooling = False
import sqlalchemy as sa
sa_engine=sa.create_engine(dbUri, echo=False, strategy='threadlocal')
sa_Session = sa.orm.scoped_session( sessionmaker( bind=sa_engine ) )
metadata = sa.MetaData(sa_engine)
sa_session = sa_Session()

# The table definition... could be any table anyway..
#stations = sa.Table("Stations", metadata,
                    #sa.Column("name", sa.VARCHAR(20), primary_key=True),
                    #sa.Column("description", sa.String(200)),
                    #sa.Column("priority", sa.SmallInteger()),
                    #autoload=aload)

stations.select().execute().fetchall()

#Sql Server Profilers tells me that a connection is opened
sa_session.close()
sa_Session.close_all()
sa_engine.dispose()
del sa_session
del sa_Session
del sa_engine



PS: Is there any method, function, class or whatever in sqlalchemy to
get all opened connection pool to the DB ? In this case my sqlalchemy
connection is closed but che conn pool il still alive at the db....
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to