diff options
author | Andreas Zeidler <az@zitc.de> | 2014-06-04 11:50:11 +0200 |
---|---|---|
committer | Andreas Zeidler <az@zitc.de> | 2014-06-04 11:50:11 +0200 |
commit | dddfffc737c6e58f8949117b059c4ef13b2b72c3 (patch) | |
tree | dd0495be38b373bbdd8ffe8e30beeb0cc3a4d835 | |
parent | 67ffed92c020c010a4958289ea090653367eb93d (diff) | |
download | alembic-dddfffc737c6e58f8949117b059c4ef13b2b72c3.tar.gz |
(hopefully) make the code a bit more readable
-rw-r--r-- | alembic/autogenerate/render.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/alembic/autogenerate/render.py b/alembic/autogenerate/render.py index 7f58f96..a8b889e 100644 --- a/alembic/autogenerate/render.py +++ b/alembic/autogenerate/render.py @@ -377,19 +377,14 @@ def _fk_colspec(fk, metadata_schema): never tries to resolve the remote table. """ - if metadata_schema is None: - return fk._get_colspec() - else: + colspec = fk._get_colspec() + if metadata_schema is not None and colspec.count(".") == 1: # need to render schema breaking up tokens by hand, since the # ForeignKeyConstraint here may not actually have a remote # Table present - colspec = fk._get_colspec() - tokens = colspec.split(".") # no schema in the colspec, render it - if len(tokens) == 2: - return "%s.%s" % (metadata_schema, colspec) - else: - return colspec + colspec = "%s.%s" % (metadata_schema, colspec) + return colspec def _render_foreign_key(constraint, autogen_context): rendered = _user_defined_render("foreign_key", constraint, autogen_context) |