Re: [sqlalchemy] How-to : update A also create an update of B

2012-08-31 Thread Tony Moutaux
Le jeudi 30 août 2012 17:16:40 UTC+2, Michael Bayer a écrit : def after_flush(session, flush_context): my_bs = figure_out_bs(session) new_session = Session(bind=session.connection()) new_session.add_all(my_bs) # this won't actually

Re: [sqlalchemy] getting results uncidoe from mssql with pyodbc (where mssql encoding is windows-1255) using turbogears scoped DBSession

2012-08-31 Thread alonn
thanks - I use pyodbc 2.1.11 with sqlalchemy 0.7.3 would upgrading one of them (or both) help me solve this? I saw in sqlalchemy 0.7.7 changlog : [feature] Added interim create_engine flag supports_unicode_binds to PyODBC dialect, to force whether or not the dialect passes Python

[sqlalchemy] How to implement conditional foreign key relationships?

2012-08-31 Thread Christoph Zwerschke
I'm trying to use SQLAlchemy with a silly legacy database the design of which I cannot change. In this database, there are parent tables with foreign key columns which can point to two different tables, depending on another column in the parent table. Think for example of a user table with a

Re: [sqlalchemy] getting results uncidoe from mssql with pyodbc (where mssql encoding is windows-1255) using turbogears scoped DBSession

2012-08-31 Thread Michael Bayer
freetds or windows ? critical plus: stack trace? critical On Aug 31, 2012, at 9:28 AM, alonn wrote: thanks - I use pyodbc 2.1.11 with sqlalchemy 0.7.3 would upgrading one of them (or both) help me solve this? I saw in sqlalchemy 0.7.7 changlog : [feature] Added interim

Re: [sqlalchemy] How to implement conditional foreign key relationships?

2012-08-31 Thread Christoph Zwerschke
Am 31.08.2012 16:07, schrieb Michael Bayer: right, this is a really common (and IMHO incorrect) design that is referred to as a generic foreign key or a polymorphic foreign key. It was popularized by frameworks such as Rails and Django. We have a recipe that implements this exact schema with

Re: [sqlalchemy] getting results uncidoe from mssql with pyodbc (where mssql encoding is windows-1255) using turbogears scoped DBSession

2012-08-31 Thread alonn
I'm working on windows 7, where can I find the stack trace? On Friday, August 31, 2012 4:53:15 PM UTC+3, Michael Bayer wrote: freetds or windows ? critical plus: stack trace? critical On Aug 31, 2012, at 9:28 AM, alonn wrote: thanks - I use pyodbc 2.1.11 with sqlalchemy 0.7.3

Re: [sqlalchemy] getting results uncidoe from mssql with pyodbc (where mssql encoding is windows-1255) using turbogears scoped DBSession

2012-08-31 Thread Michael Bayer
when it says UnicodeDecodeError, there should be a big stack trace. Since I don't know from your description what feature is actually failing to decode. I don't understand how a code change in a client of the result set could workaround such an issue if the decoding issue is on the result

Re: [sqlalchemy] How to implement conditional foreign key relationships?

2012-08-31 Thread Christoph Zwerschke
Thanks again for the link to the Polymorphic Associations with SQLAlchemy article. You're right, that's the same problem I had been facing. Your generic solution is not applicable for me, because I can't change the database design, but the elementary solution is good enough. For the curious,