sqlalchemy can't locate strategy
Hi Elad,
thanks for updating the README. With the given example, I run into the following error though:
In [4]: rxn = parse_reaction_formula("kegg:C00002 + kegg:C00001 = kegg:C00008 + kegg:C00009")
---------------------------------------------------------------------------
InvalidRequestError Traceback (most recent call last)
in ()
----> 1 rxn = parse_reaction_formula("kegg:C00002 + kegg:C00001 = kegg:C00008 + kegg:C00009")
/home/r.giessmann/anaconda3/lib/python3.6/site-packages/equilibrator_api/utils.py in parse_reaction_formula(formula)
49 :return: a Reaction object
50 """
---> 51 return PhasedReaction.parse_formula(ccache.get_compound, formula)
52
53
/home/r.giessmann/anaconda3/lib/python3.6/site-packages/equilibrator_cache/reaction.py in parse_formula(cls, str_to_compound, formula, rid)
214
215 sparse_reaction = {}
--> 216 left_dict = Reaction.parse_formula_side(left, str_to_compound)
217 right_dict = Reaction.parse_formula_side(right, str_to_compound)
218 for cid, count in left_dict.items():
/home/r.giessmann/anaconda3/lib/python3.6/site-packages/equilibrator_cache/reaction.py in parse_formula_side(s, str_to_compound)
148 if len(tokens) == 1:
149 amount = 1.0
--> 150 compound = str_to_compound(member)
151 else:
152 try:
/home/r.giessmann/anaconda3/lib/python3.6/site-packages/equilibrator_cache/compound_cache.py in get_compound(self, compound_id)
167 namespace = namespace.lower()
168
--> 169 return self.get_compound_from_registry(namespace, accession)
170
171 def get_compound_from_registry(
/home/r.giessmann/anaconda3/lib/python3.6/site-packages/equilibrator_cache/compound_cache.py in get_compound_from_registry(self, namespace, accession)
177 return self.compound_dict[(namespace, accession)]
178
--> 179 query = self.session.query(Compound)
180 if namespace == "inchi_key":
181 # try to find this compound by assuming the input is an InChIKey
/home/r.giessmann/anaconda3/lib/python3.6/site-packages/sqlalchemy/orm/session.py in query(self, *entities, **kwargs)
1375 :class:.Session
."""
1376
-> 1377 return self._query_cls(entities, self, **kwargs)
1378
1379 @property
/home/r.giessmann/anaconda3/lib/python3.6/site-packages/sqlalchemy/orm/query.py in init(self, entities, session)
137 self.session = session
138 self._polymorphic_adapters = {}
--> 139 self._set_entities(entities)
140
141 def _set_entities(self, entities, entity_wrapper=None):
/home/r.giessmann/anaconda3/lib/python3.6/site-packages/sqlalchemy/orm/query.py in _set_entities(self, entities, entity_wrapper)
148 entity_wrapper(self, ent)
149
--> 150 self._set_entity_selectables(self._entities)
151
152 def _set_entity_selectables(self, entities):
/home/r.giessmann/anaconda3/lib/python3.6/site-packages/sqlalchemy/orm/query.py in _set_entity_selectables(self, entities)
178 aliased_adapter
179 )
--> 180 ent.setup_entity(*d[entity])
181
182 def _mapper_loads_polymorphically_with(self, mapper, adapter):
/home/r.giessmann/anaconda3/lib/python3.6/site-packages/sqlalchemy/orm/query.py in setup_entity(self, ext_info, aliased_adapter)
3583 self.selectable = ext_info.selectable
3584 self.is_aliased_class = ext_info.is_aliased_class
-> 3585 self._with_polymorphic = ext_info.with_polymorphic_mappers
3586 self._polymorphic_discriminator =
3587 ext_info.polymorphic_on
/home/r.giessmann/anaconda3/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py in get(self, obj, cls)
765 if obj is None:
766 return self
--> 767 obj.dict[self.name] = result = self.fget(obj)
768 return result
769
/home/r.giessmann/anaconda3/lib/python3.6/site-packages/sqlalchemy/orm/mapper.py in _with_polymorphic_mappers(self)
1947 def _with_polymorphic_mappers(self):
1948 if Mapper._new_mappers:
-> 1949 configure_mappers()
1950 if not self.with_polymorphic:
1951 return []
/home/r.giessmann/anaconda3/lib/python3.6/site-packages/sqlalchemy/orm/mapper.py in configure_mappers()
2868 % (mapper, mapper._configure_failed))
2869 e._configure_failed = mapper._configure_failed
-> 2870 raise e
2871 if not mapper.configured:
2872 try:
InvalidRequestError: One or more mappers failed to initialize - can't proceed with initialization of other mappers. Triggering mapper: 'Mapper|Compound|compounds'. Original exception was: can't locate strategy for <class 'sqlalchemy.orm.relationships.RelationshipProperty'> (('lazy', 'selectin'),)