]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
(hopefully) make the code a bit more readable
authorAndreas Zeidler <az@zitc.de>
Wed, 4 Jun 2014 09:50:11 +0000 (11:50 +0200)
committerAndreas Zeidler <az@zitc.de>
Wed, 4 Jun 2014 09:50:11 +0000 (11:50 +0200)
alembic/autogenerate/render.py

index 7f58f9660b8f46215d7eaba7ccd7b33eb962457c..a8b889eeed9711d153c4aa15b7e9df6e2ab88549 100644 (file)
@@ -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)