Issues

Issue #100 duplicate

Uses ForeignkeyConstraint.parent not available in sqlalchemy 0.7.8

Guido Günther
created an issue

Testsuite when run against 0.7.9 fails with:

test_006_upgrade_again (tests.test_versioning.VersioningTest) ... ok

======================================================================
ERROR: test_render_fk_constraint_kwarg (tests.test_autogenerate.AutogenRenderTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/alembic-0.4.1+ds/tests/test_autogenerate.py", line 964, in test_render_fk_constraint_kwarg
    autogenerate._render_constraint(fk, self.autogen_context),
  File "/tmp/buildd/alembic-0.4.1+ds/alembic/autogenerate.py", line 593, in _render_constraint
    return renderer(constraint, autogen_context)
  File "/tmp/buildd/alembic-0.4.1+ds/alembic/autogenerate.py", line 640, in _render_foreign_key
    apply_metadata_schema = constraint.parent.metadata.schema
AttributeError: 'ForeignKeyConstraint' object has no attribute 'parent'

so it seems "revision --autogenerate" wouldn't work in this case. Is 0.8 a requirement now? If not should the code be changed to also support 0.7?

This popped up while trying to roll a new Debian package. It'd be great if we could support 0.7 and 0.8 there.

Comments (2)

  1. Mike Bayer repo owner

    all schemaitems have a .parent, in that test it's just not set yet as the test was relying upon an 0.8 mechanism of associating the fkc with the parent. #96 fixed this issue by repairing the test so that the fkc is explicitly associated when 0.8 isn't present.

  2. Log in to comment