Hi,
(Apologies for asking so many questions here - I really appreciate the
help).
I have been using joined table inheritance without any problems for a
while with a very simple hierarchy: a base class/table called
Measurement and various subclasses that contain a typed "value" column
(FloatMeasurement, IntegerMeasurement, etc). In particular, I have
been doing a query on the base type (which has additional fields like
"date") and all is sweet - I receive the correct subclass as expected.
Recently I added a new subclass that had a composite column - the
"value" is a ratio of two integers and the custom datatype is a
subclass of tuple. This works fine when used directly - I can load
and save instances of RatioMeasurement with no problems.
However, if I query the base class and the query should return a
RatioMeasurement I now get an error. What appears to be happening is
that the default ColumnLoader is failing at line 65 of strategies.py
(version 0.4.6) because the row for the initial query (made on the
base class) doesn't contain the columns required for the composite
column (since they are in the subclass table).
Adding ".with_polymorphic('*')" to the query makes no difference. Nor
does adding "polymorphic_fetch='deferred'" to the base class mapping.
Does the above make sense? What am I doing wrong this time?!
Thanks,
Andrew
PS The trace is:
[...]
File "/usr/lib64/python2.5/site-packages/sqlalchemy/orm/query.py",
line 907, in first
ret = list(self[0:1])
File "/usr/lib64/python2.5/site-packages/sqlalchemy/orm/query.py",
line 986, in iterate_instances
rows = [process[0](context, row) for row in fetch]
File "/usr/lib64/python2.5/site-packages/sqlalchemy/orm/query.py",
line 1551, in main
extension=context.extension,
only_load_props=context.only_load_props,
refresh_instance=context.refresh_instance
File "/usr/lib64/python2.5/site-packages/sqlalchemy/orm/mapper.py",
line 1368, in _instance
return mapper._instance(context, row, result=result,
polymorphic_from=self)
File "/usr/lib64/python2.5/site-packages/sqlalchemy/orm/mapper.py",
line 1444, in _instance
self.populate_instance(context, instance, row,
only_load_props=only_load_props, instancekey=identitykey, isnew=isnew)
File "/usr/lib64/python2.5/site-packages/sqlalchemy/orm/mapper.py",
line 1484, in populate_instance
(newpop, existingpop, post_proc) =
selectcontext.exec_with_path(self, prop.key,
prop.create_row_processor, selectcontext, self, row)
TypeError; 'NoneType' object is not iterable
As far as I can tell, the None is the result of the "break" at line 65
of strategies.py which is returned up the call stack until the
unpacking of the result. I'm not completely sure about this, but the
"break" is the last thing I see executing with a debugger.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---