[SQLObject] Bug: inheritance and aggregates

2006-12-11 Thread David Turner
[I'm not subscribed; please CC me on replies] Code: from sqlobject import * from sqlobject.inheritance import InheritableSQLObject __connection__ = sqlite:/:memory:?debug=t class Role(InheritableSQLObject): department = StringCol() persons = RelatedJoin(Person) class Student(Role):

[SQLObject] Bug: InheritableSQLObject can leave DB in inconsistent state

2006-12-11 Thread David Turner
Consider the following code: from sqlobject import * from sqlobject.inheritance import InheritableSQLObject __connection__ = sqlite:/:memory: def default_morx(): deriveds = list(Derived.select()) if deriveds.count(): return deriveds[0].morx else: return -1 class

Re: [SQLObject] Bug: InheritableSQLObject can leave DB in inconsistent state

2006-12-11 Thread David Turner
On Mon, 2006-12-11 at 22:24 +0300, Oleg Broytmann wrote: On Mon, Dec 11, 2006 at 02:17:20PM -0500, David Turner wrote: 1. Wait to create the row in base until just before the row in derived is to be created. 2. (maybe) use transactions. We cannot wait because we need an id from

Re: [SQLObject] Bug: InheritableSQLObject can leave DB in inconsistent state

2006-12-11 Thread David Turner
On Mon, 2006-12-11 at 22:53 +0300, Oleg Broytmann wrote: On Mon, Dec 11, 2006 at 02:47:05PM -0500, David Turner wrote: There's a bit of a tricky thing about transactions: we need to make sure that the calculation of default values for the derived row takes place outside (but simultaneous

Re: [SQLObject] Bug: InheritableSQLObject can leave DB in inconsistent state

2006-12-11 Thread David Turner
On Mon, 2006-12-11 at 23:52 +0300, Oleg Broytmann wrote: On Mon, Dec 11, 2006 at 03:37:38PM -0500, David Turner wrote: Shouldn't it be considered a bug in the user program if it access the DB during row creation? I don't see why it should be. Because accessing the DB

Re: [SQLObject] Bug: InheritableSQLObject can leave DB in inconsistent state

2006-12-12 Thread David Turner
On Tue, 2006-12-12 at 00:33 +0300, Oleg Broytmann wrote: or using a liveness marker which is atomically set at the end of creation. Either of these would work. Patches could be submitted to the SF tracker. OK:

Re: [SQLObject] BUG: join involving multiple child tables of a parent fails

2006-12-20 Thread David Turner
On Wed, 2006-12-20 at 10:25 +0100, Diez B. Roggisch wrote: I don't consider this a bug in the strict sense of the word - you are abusing InheritableSQLObject. By inheriting from it, you make things essentially the same kind, but all you really want is them all to respond to a common

[SQLObject] Patch: versioning

2006-12-28 Thread David Turner
This patch adds versioning to SQLObject. It's based on some code from Ian Bicking, which I made work. It supports inheritance. Even if this patch is no good, please do look at the new code in inheritance -- I think it's important if asDict() is going to work for children of

Re: [SQLObject] Patch: versioning

2006-12-28 Thread David Turner
Oleg Broytmann wrote: On Thu, Dec 28, 2006 at 12:13:35PM -0500, David Turner wrote: This patch Which one? Oleg. Mako has a thing which checks outgoing email for phrases like this and warns if there is no attachment. I believe I shall try to get something like this set up

Re: [SQLObject] Patch: versioning

2006-12-28 Thread David Turner
Oleg Broytmann wrote: On Thu, Dec 28, 2006 at 01:39:17PM -0500, David Turner wrote: +class MyClass(SQLObject): + name = StringCol() + versions = Versioning() So, a version is a special attribute that catches updates and stores older values in a special additional table

Re: [SQLObject] Patch: versioning

2007-01-04 Thread David Turner
On Sat, 2006-12-30 at 08:13 +0200, Dan Pascu wrote: On Thursday 28 December 2006 21:40, David Turner wrote: I should probably also have a method which returns a dict of only items that have changed between this version and a specified version (by default, the current version

Re: [SQLObject] Versioning and doneConstructing

2007-01-16 Thread David Turner
On Fri, 2007-01-12 at 15:20 +0300, Oleg Broytmann wrote: On Thu, Jan 11, 2007 at 05:04:55PM -0500, David Turner wrote: I really don't like the half-constructing code. Me too. I have argued [1] against it but without much success. ;) What I don't like in it is doneColumn - an additional

Re: [SQLObject] Versioning and doneConstructing

2007-01-16 Thread David Turner
On Tue, 2007-01-16 at 23:55 +0300, Oleg Broytmann wrote: On Tue, Jan 16, 2007 at 02:14:45PM -0500, David Turner wrote: The only way to prevent this is to lock the DB for writing before reading Not neccessary. There is Serializeable transaction isolation level. Oh, right. That would do

Re: [SQLObject] Bug: inheritance and aggregates

2007-01-23 Thread David Turner
On Tue, 2007-01-23 at 19:26 +0300, Oleg Broytmann wrote: Hello! On Mon, Dec 11, 2006 at 11:48:29AM -0500, David Turner wrote: print Student.select().max('year') This is hard to fix, but I managed to fix the following case: print Student.select().max(Student.q.year) Thanks! I

Re: [SQLObject] orderBy multiple columns

2007-04-24 Thread David Turner
On Tue, 2007-04-24 at 15:56 +0400, Oleg Broytmann wrote: On Tue, Apr 24, 2007 at 07:49:14AM -0400, David Turner wrote: I can't figure out how to make SQLObject order by multiple columns. Is this possible? It seems like Table.select(query).orderBy(col1 asc, col2 desc) or something ought

Re: [SQLObject] RowUpdateSignal, how to use best?

2007-07-16 Thread David Turner
On Mon, 2007-07-16 at 01:25 -0700, Andy Grover wrote: Hi Oleg and everybody, What is the best way to use RowUpdateSignal? I have been trying to use it to 1) Log all updates to a hierarchy of tables to another table and 2) update a last_updated row in the instance. RowUpdateSignal seems

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-03 Thread David Turner
the conversion to unicode of the query in mysqlconnection.py: if self.need_unicode and not isinstance(query, unicode): try: query = unicode(query, self.encoding) except UnicodeError: pass Finally David Turner dived into the problem

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-03 Thread David Turner
On Wed, 2007-10-03 at 22:57 +0200, Markus Gritsch wrote: On 10/3/07, Markus Gritsch [EMAIL PROTECTED] wrote: On 10/3/07, David Turner [EMAIL PROTECTED] wrote: I was thinking that it might make more sense to just remove that whole section. I understand that whoever wrote that code thought

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-04 Thread David Turner
On Thu, 2007-10-04 at 14:47 +0200, Markus Gritsch wrote: On 10/4/07, Oleg Broytmann [EMAIL PROTECTED] wrote: On Thu, Oct 04, 2007 at 01:50:52PM +0200, Markus Gritsch wrote: In MySQLdb queries are *allowed* to be unicode. I meant - there were a period when SQLObject forces queries to be

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-05 Thread David Turner
On Thu, 2007-10-04 at 17:40 -0400, David Turner wrote: On Thu, 2007-10-04 at 14:47 +0200, Markus Gritsch wrote: On 10/4/07, Oleg Broytmann [EMAIL PROTECTED] wrote: On Thu, Oct 04, 2007 at 01:50:52PM +0200, Markus Gritsch wrote: In MySQLdb queries are *allowed* to be unicode. I

Re: [SQLObject] alternateID StringCol mysql

2007-11-08 Thread David Turner
On Thu, 2007-11-08 at 21:08 +0300, Oleg Broytmann wrote: On Thu, Nov 08, 2007 at 06:03:37PM +, jonhattan wrote: A workaround could be to set a length of 1000 if no length is specified and alternateId is present. 1000 for StringCol I'd rather raise an exception instead of silently

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread David Turner
On Tue, 2007-11-27 at 15:17 +0100, Markus Gritsch wrote: On 27/11/2007, Oleg Broytmann [EMAIL PROTECTED] wrote: On Tue, Nov 27, 2007 at 02:56:59PM +0100, Markus Gritsch wrote: But if a BLOB contains just bytes which do *not* trigger the Exception, the BLOB in the query *does* get

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread David Turner
On Tue, 2007-11-27 at 19:33 +0100, Markus Gritsch wrote: P.S. Thank you for your example, I will look into it in more detail. Ah, this example looks quite familiar ;) Indeed. Please look at the attached screenshots, they show that everything is ok. Aha! I have tracked down the problem

[SQLObject] Inheritance and signals

2008-09-27 Thread David Turner
Depending on how attributes are set on child classes, rowupdatesignal fires either just on the base class, or on both the base and the child. This is inconsistent. from sqlobject import * from sqlobject.inheritance import InheritableSQLObject class Base(InheritableSQLObject): name =

Re: [SQLObject] Inheritance and signals

2008-09-28 Thread David Turner
On Sun, 2008-09-28 at 00:51 +0400, Oleg Broytmann wrote: On Sat, Sep 27, 2008 at 01:51:45PM -0400, David Turner wrote: Depending on how attributes are set on child classes, rowupdatesignal fires either just on the base class, or on both the base and the child. This is inconsistent. I

Re: [SQLObject] Cascade, MySQL, InnoDB

2008-11-07 Thread David Turner
I think it will work to add the following to mysql/mysqlconnection.py: def createTableSQL(self, soClass): constraints = self.createReferenceConstraints(soClass) extraSQL = self.createSQL(soClass) createSql = ('CREATE TABLE %s (\n%s\n) engine=innodb' %

Re: [SQLObject] undo strategies

2009-01-25 Thread David Turner
http://www.sqlobject.org/Versioning.html On Sat, 2009-01-24 at 13:07 -0800, Daniel Fetchinson wrote: I guess this question is familiar to many of you and since I came across it for the first time now I'm soliciting best practice and strategy advice. I have a set of tables with all sorts of

Re: [SQLObject] SQLObject Speed ?

2009-07-22 Thread David Turner
On Wed, 2009-07-22 at 15:03 -0400, Stef Telford wrote: Oleg Broytmann wrote: On Wed, Jul 22, 2009 at 02:26:57PM -0400, Stef Telford wrote: yes. evals appear to be a 'bad' thing here :\ Well, those evals are in sqlmeta.addColumn and .addJoin methods, so they work

Re: [SQLObject] SQLObject Speed ?

2009-07-22 Thread David Turner
On Wed, 2009-07-22 at 16:16 -0400, David Turner wrote: On Wed, 2009-07-22 at 15:03 -0400, Stef Telford wrote: Oleg Broytmann wrote: On Wed, Jul 22, 2009 at 02:26:57PM -0400, Stef Telford wrote: yes. evals appear to be a 'bad' thing here :\ Well, those evals

Re: [SQLObject] wsgi and sqlobject

2010-04-29 Thread David Turner
On Thu, 2010-04-29 at 21:16 +0200, Markus W. Barth wrote: I'll be shortly starting a new project and I am thinking of using a rather light-weight framework like the werkzeug-based flask. Could anybody on the list with wsgi+sqlobject tell me about his/her (positive/negative) experience with