Hi,
I am trying to follow the Person/Address foreignkey example in the
http://www.sqlobject.org/SQLObject.html#foreignkey
I am just wondering why the foreignkey constraint is not created on the
Address table. The column person_id is created of course, but the foreignkey
constraint is NOT set (I am checking this using IBExpert tools). Is this
intentional?
BTW I have found two problems (errors??):
1)
when: person = ForeignKey('Person', cascade = 'null')
than, when I am trying to delete rows from the Person table (see example
bellow), I am getting this error:
ProgrammingError
"(-104, 'isc_dsql_prepare: \n Dynamic SQL Error\n SQL error code = -104\n
Token unknown - line 1, column 33\n NULL')"
File:
/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py,
line: 329
2)
when: addresses = SingleJoin('Address')
print p1.addresses throws following:
unhandled AttributeError
"class FirebirdConnection has no attribute 'limit_re'"
File:
/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/firebird/firebirdconnection.py,
line: 120
I am on the Firebird 2.0 Database, Python 2.5.4,
=========== exampel code ==================
class Person(SQLObject):
firstName = StringCol()
middleInitial = StringCol(length=1, default=None)
lastName = StringCol()
addresses = MultipleJoin('Address')
# addresses = MultipleJoin('Address', joinColumn="person_id")
# addresses = SingleJoin('Address')
class Address(SQLObject):
street = StringCol()
city = StringCol()
state = StringCol(length=2)
zip = StringCol(length=9)
# person = ForeignKey('Person', cascade = False)
# person = ForeignKey('Person', cascade = True)
person = ForeignKey('Person', cascade = 'null')
Person.dropTable(ifExists=True)
Address.dropTable(ifExists=True)
Person.createTable()
Address.createTable()
p1=Person(firstName="John", lastName="Doe")
Address(street='123 W Main St', city='Smallsville', state='MMM',
zip='65555', person=p1)
Address(street='321 V Side St', city='Bigsville', state='NNN', zip='54444',
person=p1)
print p1.addresses
peeps = Person.select()
for peep in peeps:
print peep
peep.destroySelf()
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss