[SQLObject] Re: SQLObject + postgresql + twisted
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Ian B. <ia...@co...> - 2004-10-08 17:36:07
|
Miika Keskinen wrote: n> I'm sorry I did not post to mailing list but I rather ask your opinion > about two things that I've found that'll be pretty usefull. Well, no reason not to share the ideas with the mailing list, so I'll copy it. > Have you though about having oppotrunity to use > twisted.enterprise.adbapi as database backend? I'm big twisted fan and > using sqlobject with adbapi would help on some things. That could certainly be another backend. In the end, SQLObject expects synchronous database operations, so it would probably have to turn that into a synchronous operation as well. Which would just be confusing, since the underlying drivers are synchronous, and adbapi turns them into asynchronous calls using threads, and then they'd have to be made synchronous again, and then the whole thing might become asynchronous when you use SQLObject if your code is asynchronous. So... I'm not sure of the benefit. It's possible that SQLObject could be made a bit more asynchronous without extreme effort, at least for some of the methods. Simply by fiddling with main.makeProperties you might be able to do this -- adding an asynchronous method for each _get_ and _set_. With continuations (in Stackless) you might be able to turn it all into something asynchronous via a special DBConnection object; maybe greenlets can do this? But that's all very experimental. And this all has to interact safely with C extension modules, since all the database drivers are written in C. > And secondly could postgresql INHERITS be used with sqlobject? I think > it would not require big changes and if you have some column defined > as 'id serial' and then you inherit that table the childs will inherit > that 'serial'-property and each child will have then unique id. Also > selecting from parent can return elements found from child-tables. SQLObject really expects to get back a single kind of object from a select, not one of several possible tables. I don't think it would be that easy. Generally I'm suspicious of inheritance in relational databases. Maybe other people have a thought on this. There was also a patch out there to add subclassing that didn't rely on database support. > Of course this is postgresql specific (or not specific as inheritance is > part of sql99 iirc) as mysql doesn't implement it - dunno if other > system do. > > But if you find any sense of these I'll be more than glad to drop in > some piece of code to test these in practice? If you'd like, I can give you subversion access and you can try some of these ideas out in a branch. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |