No weak-reference error this morning, hooray.  I'll be watching it for
a few days.

Could using a BoundMetaData in my model be contributing to the
problem?  I have the following structure:

===
ctx = get_session_context()
    # A custom function that creates a session_context like
    # pylons.database, but reads more engine options from the
    # config file.
engine = ctx.current.bind_to
meta = BoundMetaData(engine)

incidents = Table(..., meta, autoload=True)
ic = incident.columns
class Incident(object):
    pass
assign_mapper(ctx, Incident, incidents)

def list_incidents(top_only):
    q = Incident.query()
    if top_only:
        q = q.filter(Incident.c.is_top)
    return q
===

So when list_incidents() is called it's in a different thread than
where all the variables were defined.  The engine and metadata are
thread safe, right?  Should I use a DynamicMetaData and temporarily
connect it to define the tables, and then connect it to None?  Or
would that just me making things more complicated for no reason?  As
far as I can tell there's only one engine shared throughout the
application anyway, so it shouldn't harm anything to use a
BoundMetaData.

Could we have session.engine be an alias for session.bind_to?  Pretty
please?  The only reason I leave a top-level 'engine' around is in
case I need it for something, because .bind_to is so non-obvious.

-- 
Mike Orr <[EMAIL PROTECTED]>

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