Hey all, I'm using fixtures to test a Pylons app and running into some
trouble with foreign keys. According to examples (http://
fixture.googlecode.com/svn-history/r256/branches/sa_scoped_session/
fixture/examples/db/sqlalchemy_examples.py) I should be able to do
this:
class DriverData(DataSet):
class bob:
name = 'bob'
class DriverInfoData(DataSet):
class bob:
user_id = DriverData.bob.ref('id')
However, I get the following error:
LoadError: KeyError: "row 'bob' hasn't been loaded for <DriverInfoData
at 0x102f2ce50 with keys ['bob']> (loaded: [])" (with 'bob' of
'<fixture.dataset.dataset.bob object at 0x102f63a50>' in
<DriverInfoData at 0x102f2ce50 with keys ['bob']>)
The setup method of my test class looks like this:
def setUp(self):
self.data = dbfixture.data(DriverInfoData)
# Also tried passing two args (DriverInfoData, DriverData) and
in reverse order (DriverData, DriverInfoData)
self.data.setup()
What must I change in order to make sure DriverInfoData.bob gets
inserted into MySQL so the id is available to DriverInfo.bob has a
foreign key?
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en.