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/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|