From: Ivo van der Wijk <ivo@am...> - 2004-06-15 08:23:55
I've been working with SQLObject for a while now and I love it. I have some
remarks and questions after using it for a while though:
For what it's worth - I tried to create an SQLObject on top of a view (in
PostgreSQL). This worked nicely for read operations, but updates don't work,
partially because SQLObject assumes that Myview.id has a sequence myview_id_seq,
while the original sequence is based on a different table on top of which the
view is defined.
Nothing serious, just something I tried. Perhaps someone has any real purpose
for this :)
I tried creating a tree-like structure in SQL with a base 'Node' table and
derived tables that need to be linked together. SQLObject can't really handle
this. Lots of (SQL) ways to work around this, so no real problem, but at that
time, my schema would have been more readable (and it would have allowed me to
play with SQL inheritance)
It's not quite clear to me if the section 'How Does Inheritance Work?' in the
FAQ relates to SQL Inheritance or to Python inheritance. Simple (single)
inheritance in python works fine for me, i.e.
parent = ForeignKey("Module")
priority = IntCol(default=0)
child = ForeignKey("Module")
This creates just a module_parent_relation table, which is what I would expect.
However, multiple inheritance (i.e. Mixins) doesn't work - the mixed in
attributes just don't get generated in SQL, i.e.
f = StringCol()
b = StringCol()
class blah(SQLObject, foo, bar) # or (foo, bar, SQLObject)
bl = StringCol()
Doesn't do the trick (come to think of it - should I derive foo and bar from
SQLObject as well? I should give that a try)
I'm using SQLBuilder to retrive childs of my nodes (which are ordered),
return Module.select(AND(ModuleParentRelation.q.childID == Module.q.id,
ModuleParentRelation.q.parentID == self.id),
Why can't orderBy use the q attribute of the class? I.e.
orderBy=ModuleParentRelatio.q.priority? (Or is there another way?)
Now I need to lookup the generated tablename, and it looks less readable.
I noticed that all-caps class names result in a rather weird generated class
name. I.e. 'FOO' will result in a class named 'fo_o'.
This is most likely completely according to the defined naming scheme, but I
wonder if anyone really wants this.
All in all, a great tool, I enjoy it alot.
Drs. I.R. van der Wijk -=-
Korte Leidsedwarsstraat 12 Amaze Internet Services V.O.F.
1017 RC Amsterdam, NL -=-
T +31-20-4688336 F +31-20-4688337 Zope/Plone/Content Management
W http://www.amaze.nl E info@... Open Source Solutions
W http://vanderwijk.info E ivo@... Consultancy