From: Mike Bayer Date: Tue, 19 Apr 2022 12:51:36 +0000 (-0400) Subject: document argparse limitation X-Git-Tag: rel_1_8_0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d770c1ebc596c58c2d010233457fe62ea04af509;p=thirdparty%2Fsqlalchemy%2Falembic.git document argparse limitation Change-Id: I30257b346c3e3b518d63a80e495d354103063fa9 Fixes: #1020 --- diff --git a/alembic/autogenerate/api.py b/alembic/autogenerate/api.py index 27da02c4..a5528ff7 100644 --- a/alembic/autogenerate/api.py +++ b/alembic/autogenerate/api.py @@ -370,7 +370,6 @@ class AutogenContext: :paramref:`.EnvironmentContext.configure.include_name` parameter. """ - if "schema_name" in parent_names: if type_ == "table": table_name = name diff --git a/docs/build/tutorial.rst b/docs/build/tutorial.rst index cbf771cd..5bfab916 100644 --- a/docs/build/tutorial.rst +++ b/docs/build/tutorial.rst @@ -580,10 +580,29 @@ to get the current migration:: $ alembic history -r-3:current +.. note:: + + As illustrated above, to use ranges that start with a negative number (i.e. + a dash), due to a + `bug in argparse `_ , either + the syntax ``-r-:``, without any space, must be used as above:: + + $ alembic history -r-3:current + + or if using ``--rev-range``, an equals sign must be used:: + + $ alembic history --rev-range=-3:current + + Using quotes or escape symbols will not work if there's a space after + the argument name. + View all revisions from 1975 to the head:: $ alembic history -r1975ea: + + + Downgrading =========== diff --git a/tests/test_autogen_diffs.py b/tests/test_autogen_diffs.py index 8657aebe..ead1a7cd 100644 --- a/tests/test_autogen_diffs.py +++ b/tests/test_autogen_diffs.py @@ -825,6 +825,7 @@ class CompareTypeSpecificityTest(TestBase): (VARCHAR(30), String(30), False), (VARCHAR(30), String(40), True), (VARCHAR(30), Integer(), True), + (VARCHAR(30), String(), False), (Text(), String(255), True), # insp + metadata types same number of # args but are different; they're different