SQLObject problemchen
Verfasst: Donnerstag 20. September 2007, 06:58
Hiho!
wollt mal fragen ob jemand erfahrung mit SQLObject hat. hab mir das mal bisl angeschaut und würde gerne damit arbeiten. tutorials findet man ja ned all zu viele, und da kommt auch schon das problem.
laut dem tutorial sollte man so eine 1:m verbindung modellieren können:
leider funkt das bei mir überhaupt ned. Fehler sieht unter anderem so aus:
Traceback (most recent call last):
File "test5.py", line 23, in <module>
Address.createTable()
jemand eine ahnung woran das liegt? bin für jede hilfe dankbar,
mfg
flokki
wollt mal fragen ob jemand erfahrung mit SQLObject hat. hab mir das mal bisl angeschaut und würde gerne damit arbeiten. tutorials findet man ja ned all zu viele, und da kommt auch schon das problem.
laut dem tutorial sollte man so eine 1:m verbindung modellieren können:
Code: Alles auswählen
from sqlobject import *
import sys, os
db_filename = os.path.abspath('data.db')
if os.path.exists(db_filename):
os.unlink(db_filename)
db_filename = db_filename.replace(':', '|')
connection_string = 'sqlite:/'+ db_filename
connection = connectionForURI(connection_string)
sqlhub.processConnection = connection
class Address(SQLObject):
street = StringCol()
city = StringCol()
state = StringCol(length=2)
zip = StringCol(length=9)
person = ForeignKey('Person')
Address.createTable()
class Person(SQLObject):
firstName = StringCol()
middleInitial = StringCol(length=1, default=None)
lastName = StringCol()
addresses = MultipleJoin('Address')
Person.createTable()
Traceback (most recent call last):
File "test5.py", line 23, in <module>
Address.createTable()
jemand eine ahnung woran das liegt? bin für jede hilfe dankbar,
mfg
flokki