On Mon, Jul 25, 2011 at 02:01:50AM -0300, Egor Sledov wrote:
> I am trying to go through sqlbuilder Select example at
> http://sqlobject.org/SQLBuilder.html
>
> >>> select = Select(['name', 'age'], staticTables = ['person'])
> >>> print cn.sqlrepr(select)
> SELECT 'name', 'age' FROM person
>
> Why does sqlrepr put quotes around column names?
Because Select doesn't treat strings as a special case and calls
sqlrepr() on them. Strings should be probably special-cased.
> Is it allowed to provide a list of string field names here or Select accepts
> only list of q-values now?
Items is a list of SQLExpressions and you can get a static
SQLExpression like this:
from sqlobject.sqlbuilder import Select, const
>>> select = Select([const.name, const.age], staticTables = ['person'])
>>> print cn.sqlrepr(select)
SELECT name, age FROM person
Oleg.
--
Oleg Broytman http://phdru.name/ [email protected]
Programmers don't die, they just GOSUB without RETURN.
------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide. Store less, Store more with what you own, Move data to
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss