I seem to be having an issue when calling up the history of a versioned
SQLAlchemy class.
I have the following inheritance structure setup:
Node(Versioned, Base)
Specimen(Node)
Animal(Specimen)
If I attempt to fetch the animal history using the query generated by :
AnimalHistory = self.__history_mapper__.class_
q = object_session(self).query(AnimalHistory).filter(AnimalHistory.id ==
self.id).order_by(AnimalHistory.version.desc())
logger.debug(q)
I get the following query:
SELECT bla bla #trimmed for brevity
FROM node_history
JOIN specimen_history ON node_history.id = specimen_history.id AND
node_history.version = specimen_history.version
JOIN animal_history ON specimen_history.id = animal_history.id
WHERE animal_history.id = 28
ORDER BY animal_history.version DESC
Basically, I seem to be missing the appropriate "AND" statement on the
animal_history JOIN.
Because of this, I get an unwanted cartesian product between animal and
(specimen, node)
Could anyone point out the modification needed inside history_meta.py in
order to fix this ?
Thanks !!
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.