On Nov 21, 2011, at 2:38 PM, Andrew Buza wrote: > I'm working on translating some existing MS-dialect SQL over to > SQLAlchemy(0.6.7) and I've run into a statement that's giving me a > little trouble: > > UPDATE version SET doc =document.doc > FROM document, version > WHERE version.elnumber = document.elnumber > AND version.elnumber = ? > AND version.version = ? > > From what I could tell from the SA documentation there is no support > for the nonstandard 'from' clause in updates in the expression > language and that you should use correlated updates instead. However, > the 'doc' column is of type 'image' which is invalid in subqueries > according to an error message from my database driver. > > Is there anything I can do in SA's expression language or will I have > to use a hand-written statement in this case?
I can tell you that there are two trac tickets regarding this functionality, and this patch in particular has a @compiles recipe that does the basic idea: http://www.sqlalchemy.org/trac/attachment/ticket/1944/enhance2.py The various patches that need to be reconclied/tested are at: http://www.sqlalchemy.org/trac/ticket/1944 http://www.sqlalchemy.org/trac/ticket/2166 A key thing holding back the entire feature being built in is that Oracle has similar functionality but implements it entirely differently. This is a common issue Oracle introduces by doing things in a totally nonstandard way (like CONNECT BY...). That said, the straight string or @compiles approach will allow this to function now in a rudimental way. @compiles is documented at: http://www.sqlalchemy.org/docs/core/compiler.html -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. 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.
