_determine_joins raises TypeError: 'dict_values' object does not support indexing

Issue #3005 resolved
Marek Baczyński created an issue

Python 3.4.0, sqlalchemy master

When using sadisplay (https://pypi.python.org/pypi/sadisplay) like this:

desc = sadisplay.describe(getattr(db, attr) for attr in dir(db))

I get an exception:

#!
  File "...venv\lib\site-packages\sadisplay\describe.py", line 100, in describe
    mapper = class_mapper(item)
  File "...venv\lib\site-packages\sqlalchemy\orm\base.py", line 378, in class_mapper
    mapper = _inspect_mapped_class(class_, configure=configure)
  File "...venv\lib\site-packages\sqlalchemy\orm\base.py", line 355, in _inspect_mapped_class
    mapper._configure_all()
  File "...venv\lib\site-packages\sqlalchemy\orm\mapper.py", line 1129, in _configure_all
    configure_mappers()
  File "...venv\lib\site-packages\sqlalchemy\orm\mapper.py", line 2544, in configure_mappers
    mapper._post_configure_properties()
  File "...venv\lib\site-packages\sqlalchemy\orm\mapper.py", line 1657, in _post_configure_properties
    prop.init()
  File "...venv\lib\site-packages\sqlalchemy\orm\interfaces.py", line 143, in init
    self.do_init()
  File "...venv\lib\site-packages\sqlalchemy\orm\relationships.py", line 1510, in do_init
    self._setup_join_conditions()
  File "...venv\lib\site-packages\sqlalchemy\orm\relationships.py", line 1586, in _setup_join_conditions
    can_be_synced_fn=self._columns_are_mapped
  File "...venv\lib\site-packages\sqlalchemy\orm\relationships.py", line 1849, in __init__
    self._determine_joins()
  File "...venv\lib\site-packages\sqlalchemy\orm\relationships.py", line 1932, in _determine_joins
    consider_as_foreign_keys=consider_as_foreign_keys
  File "<string>", line 2, in join_condition
  File "...venv\lib\site-packages\sqlalchemy\sql\selectable.py", line 764, in _join_condition
    crit = [(x == y) for x, y in constraints.values()[0]]
TypeError: 'dict_values' object does not support indexing

This used to work a couple of days ago with sqlalchemy master.

Comments (6)

  1. Marek Baczyński reporter

    Not sure. I've got diagram generation in the makefile for the project and this line

    desc = sadisplay.describe(getattr(db, attr) for attr in dir(db))
    

    is the only related code I control. I can try cutting the DB model and checking what happens.

  2. Log in to comment