On Nov 7, 2007, at 6:01 AM, klaus wrote:

>
> This is strange. I had problems reproducing the bug for a long time
> and was now quite happy that I succeeded.
>
> Yes, I'm using PostgreSQL 8.1.5 and psycopg2. And I still see the
> behavior that I reported. That should narrow the problem down to
> something in my local setup... I'm sorry for wasting your time.
>

are you on release 0.4.0 ?  attached is the full script i was using, i  
moved the tables around so that I could use drop_all()/create_all().   
Additionally, I just remembered that there are often dictionary- 
ordering related issues which will occur on linux but not OSX (which  
is my normal platform).   So I'll try on linux later today...or if  
anyone else wants to run the attached script with PG, SA0.4 and a  
linux machine that would be helpful.



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

from sqlalchemy import *
from sqlalchemy.orm import *

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

table = Table("test", metadata,
             Column("id", Integer, primary_key=True),
             Column("data", String))


referer = Table("referer", metadata,
          Column("id", Integer, primary_key=True),
          Column("fk", Integer, ForeignKey("test.id")))

metadata.drop_all()
metadata.create_all()

table.insert().execute([{"data": 1}, {"data": 2}, {"data": 3},
                       {"data": 4}, {"data": 5}, {"data": 6},
                       {"data": 7}, {"data": 8}, {"data": 9},
                       {"data": 10}, {"data": 11}, {"data": 12},
                       {"data": 13}, {"data": 14}, {"data": 15},
                       {"data": 30}, {"data": 44}, {"data": 55}])


test = table.select(table.c.id.in_([2, 3, 4, 5, 8, 10, 11, 13, 30, 44,
45])).alias("testView")

referer.insert().execute([{"fk": 2}])

class Test(object):
   pass

mapper(Test, test)


class Referer(object):
   pass

mapper(Referer, referer, properties={"ref": relation(Test)})

session = create_session()

t = session.query(Test).get(2)
print t
r = session.query(Referer).get(1)
print r.fk, r.ref





Reply via email to