Re: [SQLObject] only q-values in sqlbuilder Select?
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2011-07-25 08:04:07
|
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. |