On Mon, Feb 27, 2006 at 08:43:37PM -0300, Sam's Lists wrote:
> I'm still confused as to why I need to specify the joinColumn
> though...
Look at your classes:
class Wstore(SQLObject):
companyId = StringCol(default=None, alternateID=True, length=60)
specialSearchR = SingleJoin('SpecialSearch')
class SpecialSearch(SQLObject):
companyId = ForeignKey('Wstore', alternateID=True)
How can SQLObject guess by what column the join should be performed?
> I can't find any examples of SingleJoins on the web, but the examples I've
> seen of MultipleJoins don't specify the joinColumn. Is this somehow a
> unique requirement of SingleJoins?
No. I use joinColumn very often for all joins. Look, the code from the
real program:
class Service(Base):
"""Services"""
title = UnicodeCol(length=255, default=None,
dbEncoding=config.Database.encoding)
groups = RelatedJoin("ServiceGroup")
specimen = ForeignKey("Specimen", default=None)
price = IntCol(default=0)
class ServiceGroup(Base):
"""Service groups"""
title = UnicodeCol(length=255, alternateID=True,
dbEncoding=config.Database.encoding)
services = RelatedJoin("Service")
Note - no joinColumn here. But in other tables I have to use joinColumn:
class Specimen(Base):
"""Specimens"""
title = UnicodeCol(length=255, default=None,
dbEncoding=config.Database.encoding)
services = MultipleJoin("Service", joinColumn="specimen_id")
class Order(Base):
"""Orders"""
class sqlmeta:
table = "orders" # the word "order" is reserved in SQL92
patient = ForeignKey("Patient", default=None, cascade=True)
services = MultipleJoin("OrderService", joinColumn="order_id")
class OrderService(Base):
"""Order's service"""
order = ForeignKey("Order", cascade=True)
service = ForeignKey("Service")
> A tangent....has there been any thought to allowing comments directly in the
> documentation on the web or somehow wikifying the docs? I'd be glad to
> share the things I learn as I puzzle through the docs, but I don't have an
> easy way to do it now.
You are welcome: http://wiki.sqlobject.org
> P.S. Any idea when 0.8 will be officially released?
Not so soon. We are going to release 0.7.1 RSN, but it lacks the
ability to freely interchange obj and obj.id. You can join the work at
http://sourceforge.net/tracker/index.php?func=detail&aid=1353728&group_id=74338&atid=540674
> How stable is the code
> that's now in the repository?
Very stable, I think. I run the test suite with Python 2.3 and 2.4,
with Postgres and SQLite, with psycopg1, psycopg2, PySQLite1 and
PySQLite2 before committing an every single patch. I always ask
developers who submit patches to provide tests and documentation (though
they don't always obey ;)). And I do not allow patches that break tests.
Read the entire page I mentioned above...
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED]
Programmers don't die, they just GOSUB without RETURN.
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss