I've been going batty on this all morning.

I have a "permissions check" routine that repeatedly queries for a certain 
Foo2Bar table

    class Foo2Bar(Base):
        __tablename__ = 'foo_2_bar'
        id_foo = Column(Integer, ForeignKey("foo.id"), primary_key=True)
        id_bar = Column(Integer, ForeignKey("bar.id"), primary_key=True)

    print "Get Foo2Bar() 4x"
    print id(s.query(Foo2Bar).get((1,2)))
    print id(s.query(Foo2Bar).get((1,2)))
    print id(s.query(Foo2Bar).get((1,2)))
    print id(s.query(Foo2Bar).get((1,2)))

When I do this on a test harness, it works exactly like it should.  It only 
hits the database once.

When I do this in my app, it hits the database (postgres) unreliably.

I set up extensive logging and used a bunch of breakpoints with pdb.  
The session is the same at every point, there is an object already in the 
identity map for the composite key -- but it appears to get overridden each 
time.

If i put a `get()` in a loop 40x, it only gets the first one.  but every 
prior request is pulled from the database.

does anyone have a clue what could cause this behavior?


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to