Thread: [SQLObject] DBAPI prepared queries
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2005-10-10 15:17:08
|
Hello! I have started a new "DBAPI prepared queries" branch at svn://colorstudy.com/home/phd/SQLObject/paramstyles The directory is called "paramstyles" because the implementation is based on http://cvs.sourceforge.net/viewcvs.py/*checkout*/ppa/misc/DBSingleStyle.py written by Denis Otkidach. Highlights of the last commit: -- the return of the submodule sqlobject.include - there I put a copy of DBSingleStyle.py; -- DBAPI._executeRetry() method is modified to allow query to be a string (for backward compatibility) or sqlbuilder.SQLQuery instance. The branch requires developers to start working on it! All, or at least most occurrence of generated query strings must be changed to SQLQuery. Especially sqlbuilder.py requires work. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Ian B. <ia...@co...> - 2005-10-10 16:08:45
|
Oleg Broytmann wrote: > Hello! > > I have started a new "DBAPI prepared queries" branch at Great! > svn://colorstudy.com/home/phd/SQLObject/paramstyles > > The directory is called "paramstyles" because the implementation is > based on http://cvs.sourceforge.net/viewcvs.py/*checkout*/ppa/misc/DBSingleStyle.py > written by Denis Otkidach. OK, so that's the list-with-special-objects-to-represent-bound-parameters style. That seems fine -- it makes composition relatively straight-forward anyway (just using +). > Highlights of the last commit: > > -- the return of the submodule sqlobject.include - there I put a copy of > DBSingleStyle.py; In practice I think we'll need to maintain this module ourselves, and should feel free to fiddle with it as necessary. I think. Anyway, I don't know if we need to mark it as special (but it doesn't matter that much if we do). > -- DBAPI._executeRetry() method is modified to allow query to be a string > (for backward compatibility) or sqlbuilder.SQLQuery instance. > > The branch requires developers to start working on it! All, or at least > most occurrence of generated query strings must be changed to SQLQuery. > Especially sqlbuilder.py requires work. Unfortunately I'm heading out of town for this week and next, so I won't be able to help for a while. Some thoughts: * The current style has to continue to be supported, particularly things like "name = %s" % self.sqlrepr(value). If all goes well, we can start emiting warnings in 0.9 (but I don't think 0.8 should emit warnings by default). * We should maintain (or even expand) the introspectability of queries. In the future we still want to be able to do things like automatically add joining clauses. And coercing values in column-specific ways. So for the most part the sqlbuilder model of specific query objects should be maintained, and instead something *like* __sqlrepr__ should be added (but not actually __sqlrepr__, since that's taken) that returns these special lists. __sqllist__? The to_* functions themselves could be extended to look for that attribute on objects, and if found they should call that function and expand as necessary. Or a wrapper function or somesuch. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |
From: Oleg B. <ph...@ph...> - 2005-10-10 17:05:08
|
On Mon, Oct 10, 2005 at 11:08:04AM -0500, Ian Bicking wrote: > So for the most part the sqlbuilder model of specific query objects should > be maintained, and instead something *like* __sqlrepr__ should be added > (but not actually __sqlrepr__, since that's taken) that returns these > special lists. __sqllist__? Ugh! Sometimes I need to be hit by a Really Big Cluestick! (-: I was very afraid to touch sqlbuilder, especially in the area of __sqlrepr__. Now I see there is a simpler yet better way - to add yet another method. __sqlquery__, I suppose. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2005-10-10 17:05:40
|
On Mon, Oct 10, 2005 at 09:04:59PM +0400, Oleg Broytmann wrote: > Ugh! Sometimes I need to be hit by a Really Big Cluestick! (-: I was > very afraid to touch sqlbuilder, especially in the area of __sqlrepr__. Now > I see there is a simpler yet better way - to add yet another method. Thank you for kicking me in the right direction! :-) Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |