Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dictlike examples broken in 1.3 #4446

Closed
zzzeek opened this issue Jan 14, 2019 · 1 comment
Closed

dictlike examples broken in 1.3 #4446

zzzeek opened this issue Jan 14, 2019 · 1 comment
Labels
documentation orm sqlalchemy.ext extension modules, most of which are ORM related
Milestone

Comments

@zzzeek
Copy link
Member

zzzeek commented Jan 14, 2019

we still dont' have examples/ in the test suite, which is getting to be a problem, but anyway, examples/vertical/dictlike-polymorphic is broken likely due to #3423.

$ PYTHONPATH=~/dev/sqlalchemy/lib/ python -m examples.vertical.dictlike-polymorphic
2019-01-14 17:17:13,297 INFO

2019-01-14 17:17:13,303 INFO sqlalchemy.engine.base.Engine ()
2019-01-14 17:17:13,303 INFO sqlalchemy.engine.base.Engine COMMIT
Traceback (most recent call last):
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/ext/associationproxy.py", line 241, in _as_instance
    inst = class_.__dict__[self.key + "_inst"]
KeyError: '_AssociationProxy_facts_139851016114016_inst'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/attributes.py", line 355, in __getattr__
    return getattr(descriptor, attribute)
AttributeError: 'hybrid_property' object has no attribute 'impl'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/attributes.py", line 358, in __getattr__
    return getattr(self.comparator, attribute)
AttributeError: 'value' object has no attribute 'impl'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/python-3.7.0/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/opt/python-3.7.0/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/classic/dev/sqlalchemy/examples/vertical/dictlike-polymorphic.py", line 191, in <module>
    stoat["color"] = "red"
  File "/home/classic/dev/sqlalchemy/examples/vertical/dictlike.py", line 58, in __setitem__
    self._proxied[key] = value
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/ext/associationproxy.py", line 187, in __get__
    inst = self._as_instance(class_, obj)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/ext/associationproxy.py", line 245, in _as_instance
    inst = AssociationProxyInstance.for_proxy(self, owner, obj)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/ext/associationproxy.py", line 371, in for_proxy
    target_assoc, parent, owning_class, target_class, value_attr
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/ext/associationproxy.py", line 383, in _construct_for_assoc
    is_object = getattr(target_class, value_attr).impl.uses_objects
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/attributes.py", line 367, in __getattr__
    attribute,
AttributeError: Neither 'hybrid_property' object nor 'value' object associated with AnimalFact.value has an attribute 'impl'

@zzzeek zzzeek added documentation orm sqlalchemy.ext extension modules, most of which are ORM related labels Jan 14, 2019
@zzzeek zzzeek added this to the 1.3 milestone Jan 14, 2019
@sqla-tester
Copy link
Collaborator

Mike Bayer has proposed a fix for this issue in the master branch:

Relax "ambiguous" association proxy restrictions, support Proxy https://gerrit.sqlalchemy.org/1098

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation orm sqlalchemy.ext extension modules, most of which are ORM related
Projects
None yet
Development

No branches or pull requests

2 participants