> It doesn't.
>
> I use it all the time.  When I' doing some auditing I have
>
>     changedBy = ForeignKey('User', notNone = True)

It still doesn't work for me. The table gets generated alright, but
when I try to query something, it breaks.

Right now I have something like:

class Expense(SQLObject):
    date = DateCol()
    description = StringCol()
    amount = CurrencyCol()
    sharedBy = MultipleJoin("Share")

class Share(SQLObject):
    eid = ForeignKey("Expense")

I add an Expense, and then try to do e.sharedBy from the shell, I get
this (the unknown column expense_id is towards the end):

1/QueryAll:  SELECT id FROM share WHERE expense_id = 1
---------------------------------------------------------------------------
_mysql_exceptions.OperationalError                          Traceback
(most recent call last)

/var/www/group-expenses/<ipython console>

/var/www/group-expenses/<string> in <lambda>(self)

/home/diwaker/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/joins.py
in performJoin(self, inst)
    129             self.otherClass,
    130             self.joinColumn,
--> 131             inst.id)
    132         if inst.sqlmeta._perConnection:
    133             conn = inst._connection

/home/diwaker/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/dbconnection.py
in _SO_selectJoin(self, soClass, column, value)
    596
    597     def _SO_selectJoin(self, soClass, column, value):
--> 598         return self.queryAll("SELECT %s FROM %s WHERE %s = %s" %
    599                              (soClass.sqlmeta.idName,
    600                               soClass.sqlmeta.table,

/home/diwaker/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/dbconnection.py
in queryAll(self, s)
    742     def queryAll(self, s):
    743         self.assertActive()
--> 744         return self._dbConnection._queryAll(self._connection, s)
    745
    746     def queryOne(self, s):

/home/diwaker/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/dbconnection.py
in _queryAll(self, conn, s)
    307             self.printDebug(conn, s, 'QueryAll')
    308         c = conn.cursor()
--> 309         self._executeRetry(conn, c, s)
    310         value = c.fetchall()
    311         if self.debugOutput:

/home/diwaker/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/mysql/mysqlconnection.py
in _executeRetry(self, conn, cursor, query)
     58         while 1:
     59             try:
---> 60                 return cursor.execute(query)
     61             except MySQLdb.OperationalError, e:
     62                 if e.args[0] == 2013: # SERVER_LOST error

/usr/lib/python2.4/site-packages/MySQLdb/cursors.py in execute(self,
query, args)
    135             del tb
    136             self.messages.append((exc, value))
--> 137             self.errorhandler(self, exc, value)
    138         self._executed = query
    139         self._warning_check()

/usr/lib/python2.4/site-packages/MySQLdb/connections.py in
defaulterrorhandler(connection, cursor, errorclass, errorvalue)
     31     else:
     32         connection.messages.append(error)
---> 33     raise errorclass, errorvalue
     34
     35

OperationalError: (1054, "Unknown column 'expense_id' in 'where clause'")

Here's my tg-admin info output:
TurboGears 0.9a1dev-r893
nose 0.8.6
RuleDispatch 0.5a0.dev-r2100
setuptools 0.6a10
FormEncode 0.4
cElementTree 1.0.5-20051216
PasteScript 0.4.2
elementtree 1.2.6
simplejson 1.1
SQLObject 0.7.1dev-r1457
CherryPy 2.2.0beta
TurboKid 0.9.1dev-r871
PyProtocols 1.0a0
Cheetah 1.0
PasteDeploy 0.4
Paste 0.4.1
FormEncode 0.4
kid 0.8
elementtree 1.2.6

Diwaker
--
Web/Blog/Gallery: http://floatingsun.net/blog

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to