[SQLObject] SQLObject 2

2006-02-22 Thread Ian Bicking
Hi guys. Some of you who have been tracking the SQL-CVS mailing list might have noticed the commit messages, but now it's more official-like. I've started a reimplementation of SQLObject, aimed at a big ol' cleanup and improvement of the project. Here's what I wrote on my blog, which kind of

[SQLObject] Distributed caching for SQLObject?

2006-02-22 Thread Arsalan Zaidi
Hi Just wondering if there are any plans to add the ability to distribute the cache (and so keep it turned on) if accessing the DB through various instances of SQLObject? Just spent a few minutes going through the code so I'm not sure of this is feasible, but it seems to me that one easy solution

[SQLObject] constraints on SQLObject

2006-02-22 Thread Julio Oña
Hello, I'm trying to use constraints on SQLObject columns, but apparently they are not enabled yet. With this email I'm sending a little example. Basically a test expecting te output of de constraint function, but nothing is printed besides the final listing. Reviewing the code of col.py I've fo

[SQLObject] Re: composite class error using get()?

2006-02-22 Thread jeff emminger
hmm... seems i found a way to fix it. i'm a bit of a python noob in general, so i don't know if this is optimal, but changing Address's _init method from def _init(self, id): SQLObject._init(self, id) self._coords = SOCoords(self) to def _init(self, id, *args, **kw):

[SQLObject] composite class error using get()?

2006-02-22 Thread jeff emminger
hi list newbie here... using the example mutable composite class Address verbatim from http://sqlobject.org/FAQ.html#composite-compound-attributes in the shell, after creating an object, calling Address.get(1) works fine. if i exit the shell/reopen and call the same Address.get(1) i get an error

[SQLObject] Problems understanding SingleJoins and ForeignKeys

2006-02-22 Thread Sam's Lists
So I'm happily developing a CherryPy-SqlObject-Cheetah application when i decide that I should really be using some more SqlObject features.  Namely ForeignKeys and SingleJoins.  After destroying my application, I wrote a simple test case.hopefully someone can take a look at it and tell me

[SQLObject] _get_/_set_ method override with inheritable classes?

2006-02-22 Thread Dan Weeks
Hello, Is it possible to override the _get_ and _set_ methods in an InheritableSQLObject subclasa? I have the following: class SuperElement(sqlobject.inheritance.InheritableSQLObject): handle = sqlobject.StringCol(length=64, varchar=False, notNone=True) name = sqlobject.StringCol(length=

Re: [SQLObject] Re: Re: InheritableSQLObject behaviour changed in r1435 in trunk ?

2006-02-22 Thread Oleg Broytmann
On Thu, Feb 16, 2006 at 04:40:14PM +0800, gary ng wrote: > "Oleg Broytmann" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > On Thu, Feb 16, 2006 at 04:15:09PM +0800, gary ng wrote: > > > class Middle(InheritableSQLObject): > > > _connection = hub > > > class sqlmeta: > > >

Re: [SQLObject] Raw SQL, quoting parameters

2006-02-22 Thread Cliff Wells
On Wed, 2006-02-22 at 20:46 +0300, Oleg Broytmann wrote: > On Wed, Feb 22, 2006 at 08:40:54PM +0300, Oleg Broytmann wrote: > > from sqlobject.sqlbuilder import _LikeQuoted > > connection.queryOne(connection.sqlrepr("SELECT lo_import(" + > > _LikeQuoted(filename) + " AS loid")) > >Debugged: >

Re: [SQLObject] Raw SQL, quoting parameters

2006-02-22 Thread Oleg Broytmann
On Wed, Feb 22, 2006 at 08:40:54PM +0300, Oleg Broytmann wrote: > from sqlobject.sqlbuilder import _LikeQuoted > connection.queryOne(connection.sqlrepr("SELECT lo_import(" + > _LikeQuoted(filename) + " AS loid")) Debugged: connection.queryOne("SELECT lo_import(" + connection.sqlrepr(_LikeQuo

Re: [SQLObject] Raw SQL, quoting parameters

2006-02-22 Thread Oleg Broytmann
On Wed, Feb 22, 2006 at 09:11:17AM -0800, Cliff Wells wrote: > self.loid, = hub.hub.getConnection( ).queryOne( "SELECT lo_import('%s') AS > loid" % filename ) > > Unfortunately it takes all of two seconds to see what's going to be > wrong. How can I quote/escape the filename? from sqlobject.sql

Re: [SQLObject] Creation order with sqlobject-admin

2006-02-22 Thread BJörn Lindqvist
> I have a class A that has a foreignkey to class B, but sqlobject-admin > (list/create) picks them up in the wrong order (A then B), which causes an > error in sqlobject-admin create because A has a foreignkey to B which > doesn't exist yet. > > class A(SQLObject): > b=ForeignKey('B') > > clas

Re: [SQLObject] Setting mysql engine for created tables

2006-02-22 Thread BJörn Lindqvist
> Well; Björn's suggestion will do for my case, but I can't think of a reason > why > %s support in createSQL would be a bad thing to have, especially now that > it's implemented and documented... Me neither, except that you may want to choose another name for the table name expansion token. Like

[SQLObject] Raw SQL, quoting parameters

2006-02-22 Thread Cliff Wells
This works: self.loid, = hub.hub.getConnection( ).queryOne( "SELECT lo_import('%s') AS loid" % filename ) Unfortunately it takes all of two seconds to see what's going to be wrong. How can I quote/escape the filename? Regards, Cliff -- -

Re: [SQLObject] Setting mysql engine for created tables

2006-02-22 Thread David Faure
On Wednesday 22 February 2006 10:13, Oleg Broytmann wrote: > On Wed, Feb 22, 2006 at 10:04:47AM +0100, David Faure wrote: > > There are 1000 things that one might want to do with ALTER TABLE... > >SQLObject is designed (at least that is an intent) to avoid direct > manipulations with SQL. Ye

Re: [SQLObject] Setting mysql engine for created tables

2006-02-22 Thread David Faure
On Wednesday 22 February 2006 09:48, you wrote: > On 2/21/06, David Faure <[EMAIL PROTECTED]> wrote: > > I'm looking for how to choose the mysql engine > > (http://mysql.speedbone.de/doc/refman/5.0/en/storage-engines.html) > > used by tables created by SQLObject. Since it can be done with an ALTER

Re: [SQLObject] Patch: support for locking rows

2006-02-22 Thread Oleg Broytmann
On Wed, Feb 22, 2006 at 02:48:42PM +0100, David Faure wrote: > >Why do you want to lock the row with cacheValues=False? > > Because another process might be accessing the same table row at the same > time. I do understand what locking is. I do not understand locking with cacheValues=False

Re: [SQLObject] Patch: support for locking rows

2006-02-22 Thread David Faure
On Wednesday 22 February 2006 14:40, Oleg Broytmann wrote: > On Wed, Feb 22, 2006 at 02:34:59PM +0100, David Faure wrote: > > >class sqlmeta: > > > cacheValues = False > > > > > >Now EVERY access to an attribute causes SELECT or UPDATE. > > > > OK. Now if I want those SELECTS to loc

Re: [SQLObject] Patch: support for locking rows

2006-02-22 Thread Oleg Broytmann
On Wed, Feb 22, 2006 at 02:34:59PM +0100, David Faure wrote: > >class sqlmeta: > > cacheValues = False > > > >Now EVERY access to an attribute causes SELECT or UPDATE. > > OK. Now if I want those SELECTS to lock the rows, how would I do that, if not > with an sqlmeta boolean? W

Re: [SQLObject] Patch: support for locking rows

2006-02-22 Thread David Faure
On Wednesday 22 February 2006 14:28, Oleg Broytmann wrote: > On Wed, Feb 22, 2006 at 02:21:06PM +0100, David Faure wrote: > > Could you help me a bit so that I can do the right thing then? > > What's the idea behind loadvalue and getvalue issueing a SELECT statement? > > I thought the select was do

Re: [SQLObject] Patch: support for locking rows

2006-02-22 Thread Oleg Broytmann
On Wed, Feb 22, 2006 at 02:21:06PM +0100, David Faure wrote: > Could you help me a bit so that I can do the right thing then? > What's the idea behind loadvalue and getvalue issueing a SELECT statement? > I thought the select was done by MyObject.select(), so why is select done > (again? instead?)

Re: [SQLObject] Patch: support for locking rows

2006-02-22 Thread David Faure
On Wednesday 22 February 2006 14:01, Oleg Broytmann wrote: > On Wed, Feb 22, 2006 at 01:26:49PM +0100, David Faure wrote: > > I think that sqlmeta.lockRows is the best way to make -all- selects lock > > rows, > >I dont think there is a general need to *always* lock rows for a table. Well, my

Re: [SQLObject] Patch: support for locking rows

2006-02-22 Thread Oleg Broytmann
On Wed, Feb 22, 2006 at 01:26:49PM +0100, David Faure wrote: > I think that sqlmeta.lockRows is the best way to make -all- selects lock rows, I dont think there is a general need to *always* lock rows for a table. Oleg. -- Oleg Broytmannhttp://phd.pp.ru/[EMAIL PRO

Re: [SQLObject] Patch: support for locking rows

2006-02-22 Thread David Faure
On Wednesday 22 February 2006 09:27, Oleg Broytmann wrote: > On Wed, Feb 22, 2006 at 01:21:58AM +0100, David Faure wrote: > > +`createSQL`: > > + SQL queries run after table creation. createSQL can be a string with a > > + single SQL command, a list of SQL commands, or a dictionary with keys >

Re: [SQLObject] Setting mysql engine for created tables

2006-02-22 Thread Oleg Broytmann
On Wed, Feb 22, 2006 at 10:04:47AM +0100, David Faure wrote: > There are 1000 things that one might want to do with ALTER TABLE... SQLObject is designed (at least that is an intent) to avoid direct manipulations with SQL. These 1000 things, if they are portable between different SQL backends, s

Re: [SQLObject] Setting mysql engine for created tables

2006-02-22 Thread David Faure
On Wednesday 22 February 2006 09:48, BJörn Lindqvist wrote: > On 2/21/06, David Faure <[EMAIL PROTECTED]> wrote: > > I'm looking for how to choose the mysql engine > > (http://mysql.speedbone.de/doc/refman/5.0/en/storage-engines.html) > > used by tables created by SQLObject. Since it can be done w

Re: [SQLObject] Setting mysql engine for created tables

2006-02-22 Thread David Faure
On Wednesday 22 February 2006 09:24, Oleg Broytmann wrote: > On Wed, Feb 22, 2006 at 12:32:47AM +0100, David Faure wrote: > > class TNSQLObject(SQLObject): > > class sqlmeta: > > # this solves the problem of the global naming style posted > > previously > > style = Prep

Re: [SQLObject] Setting mysql engine for created tables

2006-02-22 Thread BJörn Lindqvist
On 2/21/06, David Faure <[EMAIL PROTECTED]> wrote: > I'm looking for how to choose the mysql engine > (http://mysql.speedbone.de/doc/refman/5.0/en/storage-engines.html) > used by tables created by SQLObject. Since it can be done with an ALTER TABLE > command, it looks like > I don't have to custo

Re: [SQLObject] Patch: support for locking rows

2006-02-22 Thread Oleg Broytmann
On Wed, Feb 22, 2006 at 01:21:58AM +0100, David Faure wrote: > +`createSQL`: > + SQL queries run after table creation. createSQL can be a string with a > + single SQL command, a list of SQL commands, or a dictionary with keys that > + are dbNames and values that are either single SQL command

Re: [SQLObject] Setting mysql engine for created tables

2006-02-22 Thread Oleg Broytmann
On Wed, Feb 22, 2006 at 12:32:47AM +0100, David Faure wrote: > class TNSQLObject(SQLObject): > class sqlmeta: > # this solves the problem of the global naming style posted > previously > style = PrependDBStyle() > # this almost works... the problem