I would like to mix straight SQL and mapper access within my code, but the way I'm doing it seems to be breaking something. For example, I'll do several operations using a raw SQL pattern like:

    dbEngine.text( "begin'").execute()
    dbEngine.text( "update foo set name = 'bar'").execute()
    dbEngine.text( "commit'").execute()

then try to create a new row in a table using a mapper pattern:

    session = create_session()
    thing = Thing( name = 'snafu' )
    session.flush()
    session.close()            
      
I don't get any error messages, but the results are really squirrelly... sometimes it works ok, sometimes snafu doesn't show up in the database, sometimes snafu makes it into the database but the program that created it can't see it (the varying isn't over time, but rather in different parts of the program where I do this). What's more, the behavior of the program can vary from machine to machine.

An obvious thing to do is switch to just ORM or SQL, but in the actual code (not the simplified example) it seems to make more sense to use the strengths of both where appropriate.  Is there perhaps a better way to mix SQL and ORM levels than what I'm doing?

Using SA 0.2.5, PostgreSQL 8.1.4 under WIndows.

Thanks,
Bob
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to