Re: [SQLObject] Paramaterized queryAll...
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2009-08-15 14:48:18
|
On Fri, Aug 14, 2009 at 10:19:23PM -0700, Sam's Lists wrote: > QueryAll and QueryOne work okay with strings. > > But I'd like to be able to pass parameterized queries to them. Am I correct > that this is not supported? What are my options? > > I.e. something like this: > > queryAll('select * from stocks where symbol=?', (symbol,)) > > (My actual queries are much more complicated, of course). The best thing would be to merge my work on the parameterized queries at http://svn.colorstudy.com/home/phd/SQLObject/paramstyles/ . Look at sqlobject/include/DBSingleStyle.py and sqlobject/dbconnection.py. I was working on the branch and wanted to merge it into mainline, but at that time Luke Opperman merged his work (all SELECT implementations moved to SQLBuilder, and all implementations use unified sqlbuilder.Select) and the paramstyles branch became too much incompatible with the mainline, so I dropped it. Now it requires a lot of work to be merged; actually I think most of the work needs to be redone almost from the beginning; the work must change SQLBuilder instead of DBConnection. The second option is to create query strings yourself using SQLBuilder.Select or just string interpolation. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |