Hi Svil, My integration between traits and sqlalchemy is working rather well (at least it's passing the unit tests I could think of). Thanks for all your help on that.
Now I'm trying to do something similar to what you did in dbcook with expressions. I'd like to construct a gui for the user to build queries with, save those queries etc. I started off simply using the filter() and order_by() functions, though those are attached to a particular session which isn't very useful. The way you did it is much better obviously, so something like results = session.query( klas).select( expr.walk( Translator( context_Vars, context_classes is exactly what I need. Can the expression be saved and modified again at a later stage? Though I don't know if I require all the functionality you have in your expression modules. Or perhaps I do. Basically I'd just like the user to be able to select those columns on the class that's being queried, and any other classes with foreign key constraints. That's simple to setup, the trick will be with all the different operators and parameter bindings. Is their a subset of things I should go through in your expression module to understand what I need to do something similar with a gui, or is everything very tightly integrated? Hope you're having a good weekend. Regards, Christian 2009/4/1 <[email protected]>: > > i have similar thing, but by keeping an expression in my own terms and > rendering into different things, like text, SQL, SA-expresion, etc. > u define what is a variable, const, functor, overload all the > operators, etc etc; then have a visitor that walks and translates > (interprets) it into whatever one needs. > > see the generic one > http://dbcook.svn.sourceforge.net/viewvc/dbcook/trunk/dbcook/utik/expr.py > and the above-into-SA-translator (automaticaly doing other stuff) > http://dbcook.svn.sourceforge.net/viewvc/dbcook/trunk/dbcook/expression.py > > ciao > svil > > On Wednesday 01 April 2009 21:18:23 Hinrich Winther wrote: >> Maybe there is a better way of doing it. To be exact: >> >> I want to disassemble a given _BinaryExpression into basic elements >> (a list of strings, arrays, integers ...) and reassemble it >> somewhere else out of this basic elements. >> >> On 01.04.2009, at 18:14, Michael Bayer wrote: >> > Hinrich Winther wrote: >> >> Hi, >> >> >> >> I need to generate a sqlalchemy.sql.expression._BinaryExpression >> >> by hand. So I looked into the docu and found that I need a left, >> >> right and a operator. I am stuck at the left :) type() says it >> >> is a sqlalchemy.sql.util.AnnotatedColumn. But I can't find the >> >> class definition anywhere in sqlalchemy. Where is it defined? >> > >> > if you just say column('foo') == column('bar') (column is >> > sqlalchemy.sql.column), you've got a _BinaryExpression. there >> > shouldn't >> > be a need to access _BinaryExpression directly. >> > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
