alembic 1.13.0__tar.gz → 1.13.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. {alembic-1.13.0 → alembic-1.13.2}/LICENSE +2 -2
  2. {alembic-1.13.0 → alembic-1.13.2}/PKG-INFO +1 -1
  3. {alembic-1.13.0 → alembic-1.13.2}/alembic/__init__.py +1 -1
  4. alembic-1.13.2/alembic/autogenerate/__init__.py +10 -0
  5. {alembic-1.13.0 → alembic-1.13.2}/alembic/autogenerate/api.py +9 -7
  6. {alembic-1.13.0 → alembic-1.13.2}/alembic/autogenerate/compare.py +6 -5
  7. {alembic-1.13.0 → alembic-1.13.2}/alembic/autogenerate/render.py +34 -24
  8. {alembic-1.13.0 → alembic-1.13.2}/alembic/autogenerate/rewriter.py +26 -13
  9. {alembic-1.13.0 → alembic-1.13.2}/alembic/command.py +27 -16
  10. {alembic-1.13.0 → alembic-1.13.2}/alembic/config.py +25 -19
  11. {alembic-1.13.0 → alembic-1.13.2}/alembic/context.pyi +10 -5
  12. {alembic-1.13.0 → alembic-1.13.2}/alembic/ddl/__init__.py +1 -1
  13. {alembic-1.13.0 → alembic-1.13.2}/alembic/ddl/_autogen.py +19 -13
  14. {alembic-1.13.0 → alembic-1.13.2}/alembic/ddl/base.py +17 -13
  15. {alembic-1.13.0 → alembic-1.13.2}/alembic/ddl/impl.py +27 -19
  16. {alembic-1.13.0 → alembic-1.13.2}/alembic/ddl/mssql.py +4 -1
  17. {alembic-1.13.0 → alembic-1.13.2}/alembic/ddl/mysql.py +54 -34
  18. {alembic-1.13.0 → alembic-1.13.2}/alembic/ddl/oracle.py +9 -4
  19. {alembic-1.13.0 → alembic-1.13.2}/alembic/ddl/postgresql.py +18 -10
  20. {alembic-1.13.0 → alembic-1.13.2}/alembic/ddl/sqlite.py +8 -6
  21. {alembic-1.13.0 → alembic-1.13.2}/alembic/op.pyi +46 -8
  22. {alembic-1.13.0 → alembic-1.13.2}/alembic/operations/base.py +69 -16
  23. {alembic-1.13.0 → alembic-1.13.2}/alembic/operations/batch.py +7 -8
  24. {alembic-1.13.0 → alembic-1.13.2}/alembic/operations/ops.py +57 -35
  25. {alembic-1.13.0 → alembic-1.13.2}/alembic/operations/schemaobj.py +11 -8
  26. {alembic-1.13.0 → alembic-1.13.2}/alembic/operations/toimpl.py +3 -0
  27. {alembic-1.13.0 → alembic-1.13.2}/alembic/runtime/environment.py +20 -13
  28. {alembic-1.13.0 → alembic-1.13.2}/alembic/runtime/migration.py +34 -18
  29. {alembic-1.13.0 → alembic-1.13.2}/alembic/script/base.py +24 -24
  30. {alembic-1.13.0 → alembic-1.13.2}/alembic/script/revision.py +53 -33
  31. {alembic-1.13.0 → alembic-1.13.2}/alembic/script/write_hooks.py +3 -0
  32. {alembic-1.13.0 → alembic-1.13.2}/alembic/templates/async/alembic.ini.mako +3 -3
  33. {alembic-1.13.0 → alembic-1.13.2}/alembic/templates/generic/alembic.ini.mako +2 -2
  34. {alembic-1.13.0 → alembic-1.13.2}/alembic/templates/multidb/alembic.ini.mako +2 -2
  35. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/fixtures.py +20 -8
  36. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/suite/test_autogen_computed.py +1 -0
  37. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/suite/test_environment.py +3 -3
  38. alembic-1.13.2/alembic/util/__init__.py +35 -0
  39. {alembic-1.13.0 → alembic-1.13.2}/alembic/util/compat.py +25 -8
  40. {alembic-1.13.0 → alembic-1.13.2}/alembic/util/langhelpers.py +78 -36
  41. {alembic-1.13.0 → alembic-1.13.2}/alembic/util/messaging.py +15 -6
  42. {alembic-1.13.0 → alembic-1.13.2}/alembic/util/pyfiles.py +7 -3
  43. {alembic-1.13.0 → alembic-1.13.2}/alembic/util/sqla_compat.py +41 -14
  44. {alembic-1.13.0 → alembic-1.13.2}/alembic.egg-info/PKG-INFO +1 -1
  45. {alembic-1.13.0 → alembic-1.13.2}/alembic.egg-info/SOURCES.txt +1 -14
  46. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/autogenerate.rst.txt +8 -0
  47. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/changelog.rst.txt +93 -0
  48. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/front.rst.txt +1 -1
  49. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/basic.css +1 -1
  50. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/doctools.js +1 -1
  51. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/documentation_options.js +1 -1
  52. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/language_data.js +2 -2
  53. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/nature.css +1 -1
  54. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/searchtools.js +105 -60
  55. {alembic-1.13.0 → alembic-1.13.2}/docs/api/autogenerate.html +14 -14
  56. {alembic-1.13.0 → alembic-1.13.2}/docs/api/commands.html +33 -27
  57. {alembic-1.13.0 → alembic-1.13.2}/docs/api/config.html +12 -12
  58. {alembic-1.13.0 → alembic-1.13.2}/docs/api/ddl.html +10 -10
  59. {alembic-1.13.0 → alembic-1.13.2}/docs/api/index.html +9 -9
  60. {alembic-1.13.0 → alembic-1.13.2}/docs/api/operations.html +19 -19
  61. {alembic-1.13.0 → alembic-1.13.2}/docs/api/overview.html +9 -9
  62. {alembic-1.13.0 → alembic-1.13.2}/docs/api/runtime.html +18 -13
  63. {alembic-1.13.0 → alembic-1.13.2}/docs/api/script.html +12 -12
  64. {alembic-1.13.0 → alembic-1.13.2}/docs/autogenerate.html +18 -11
  65. {alembic-1.13.0 → alembic-1.13.2}/docs/batch.html +9 -9
  66. {alembic-1.13.0 → alembic-1.13.2}/docs/branches.html +9 -9
  67. {alembic-1.13.0 → alembic-1.13.2}/docs/build/autogenerate.rst +8 -0
  68. {alembic-1.13.0 → alembic-1.13.2}/docs/build/changelog.rst +93 -0
  69. {alembic-1.13.0 → alembic-1.13.2}/docs/build/conf.py +3 -3
  70. {alembic-1.13.0 → alembic-1.13.2}/docs/build/front.rst +1 -1
  71. {alembic-1.13.0 → alembic-1.13.2}/docs/changelog.html +101 -9
  72. {alembic-1.13.0 → alembic-1.13.2}/docs/cookbook.html +9 -9
  73. {alembic-1.13.0 → alembic-1.13.2}/docs/front.html +10 -10
  74. {alembic-1.13.0 → alembic-1.13.2}/docs/genindex.html +15 -11
  75. {alembic-1.13.0 → alembic-1.13.2}/docs/index.html +18 -9
  76. {alembic-1.13.0 → alembic-1.13.2}/docs/naming.html +9 -9
  77. {alembic-1.13.0 → alembic-1.13.2}/docs/offline.html +9 -9
  78. {alembic-1.13.0 → alembic-1.13.2}/docs/ops.html +26 -22
  79. {alembic-1.13.0 → alembic-1.13.2}/docs/py-modindex.html +9 -9
  80. {alembic-1.13.0 → alembic-1.13.2}/docs/search.html +11 -13
  81. alembic-1.13.2/docs/searchindex.js +1 -0
  82. {alembic-1.13.0 → alembic-1.13.2}/docs/tutorial.html +11 -11
  83. {alembic-1.13.0 → alembic-1.13.2}/pyproject.toml +9 -7
  84. {alembic-1.13.0 → alembic-1.13.2}/setup.cfg +2 -18
  85. {alembic-1.13.0 → alembic-1.13.2}/tests/test_autogen_diffs.py +10 -98
  86. {alembic-1.13.0 → alembic-1.13.2}/tests/test_autogen_indexes.py +5 -4
  87. {alembic-1.13.0 → alembic-1.13.2}/tests/test_autogen_render.py +0 -1
  88. {alembic-1.13.0 → alembic-1.13.2}/tests/test_batch.py +14 -12
  89. {alembic-1.13.0 → alembic-1.13.2}/tests/test_command.py +7 -14
  90. {alembic-1.13.0 → alembic-1.13.2}/tests/test_environment.py +5 -0
  91. {alembic-1.13.0 → alembic-1.13.2}/tests/test_impl.py +27 -0
  92. alembic-1.13.2/tests/test_messaging.py +30 -0
  93. {alembic-1.13.0 → alembic-1.13.2}/tests/test_mssql.py +4 -3
  94. {alembic-1.13.0 → alembic-1.13.2}/tests/test_postgresql.py +28 -16
  95. {alembic-1.13.0 → alembic-1.13.2}/tests/test_script_production.py +15 -2
  96. {alembic-1.13.0 → alembic-1.13.2}/tests/test_version_traversal.py +61 -2
  97. {alembic-1.13.0 → alembic-1.13.2}/tools/write_pyi.py +3 -3
  98. {alembic-1.13.0 → alembic-1.13.2}/tox.ini +4 -3
  99. alembic-1.13.0/.coveragerc +0 -5
  100. alembic-1.13.0/.github/FUNDING.yml +0 -6
  101. alembic-1.13.0/.github/ISSUE_TEMPLATE/bug_report.md +0 -41
  102. alembic-1.13.0/.github/ISSUE_TEMPLATE/config.yml +0 -15
  103. alembic-1.13.0/.github/ISSUE_TEMPLATE/use_case.md +0 -24
  104. alembic-1.13.0/.github/pull_request_template.md +0 -27
  105. alembic-1.13.0/.github/workflows/run-on-pr.yaml +0 -85
  106. alembic-1.13.0/.github/workflows/run-test.yaml +0 -101
  107. alembic-1.13.0/.gitignore +0 -24
  108. alembic-1.13.0/.gitreview +0 -6
  109. alembic-1.13.0/.pre-commit-config.yaml +0 -31
  110. alembic-1.13.0/alembic/autogenerate/__init__.py +0 -10
  111. alembic-1.13.0/alembic/util/__init__.py +0 -35
  112. alembic-1.13.0/docs/build/assets/api_overview.graffle +0 -2795
  113. alembic-1.13.0/docs/build/make.bat +0 -113
  114. alembic-1.13.0/docs/searchindex.js +0 -1
  115. alembic-1.13.0/reap_dbs.py +0 -25
  116. {alembic-1.13.0 → alembic-1.13.2}/CHANGES +0 -0
  117. {alembic-1.13.0 → alembic-1.13.2}/MANIFEST.in +0 -0
  118. {alembic-1.13.0 → alembic-1.13.2}/README.rst +0 -0
  119. {alembic-1.13.0 → alembic-1.13.2}/README.unittests.rst +0 -0
  120. {alembic-1.13.0 → alembic-1.13.2}/alembic/__main__.py +0 -0
  121. {alembic-1.13.0 → alembic-1.13.2}/alembic/context.py +0 -0
  122. {alembic-1.13.0 → alembic-1.13.2}/alembic/environment.py +0 -0
  123. {alembic-1.13.0 → alembic-1.13.2}/alembic/migration.py +0 -0
  124. {alembic-1.13.0 → alembic-1.13.2}/alembic/op.py +0 -0
  125. {alembic-1.13.0 → alembic-1.13.2}/alembic/operations/__init__.py +0 -0
  126. {alembic-1.13.0 → alembic-1.13.2}/alembic/py.typed +0 -0
  127. {alembic-1.13.0 → alembic-1.13.2}/alembic/runtime/__init__.py +0 -0
  128. {alembic-1.13.0 → alembic-1.13.2}/alembic/script/__init__.py +0 -0
  129. {alembic-1.13.0 → alembic-1.13.2}/alembic/templates/async/README +0 -0
  130. {alembic-1.13.0 → alembic-1.13.2}/alembic/templates/async/env.py +0 -0
  131. {alembic-1.13.0 → alembic-1.13.2}/alembic/templates/async/script.py.mako +0 -0
  132. {alembic-1.13.0 → alembic-1.13.2}/alembic/templates/generic/README +0 -0
  133. {alembic-1.13.0 → alembic-1.13.2}/alembic/templates/generic/env.py +0 -0
  134. {alembic-1.13.0 → alembic-1.13.2}/alembic/templates/generic/script.py.mako +0 -0
  135. {alembic-1.13.0 → alembic-1.13.2}/alembic/templates/multidb/README +0 -0
  136. {alembic-1.13.0 → alembic-1.13.2}/alembic/templates/multidb/env.py +0 -0
  137. {alembic-1.13.0 → alembic-1.13.2}/alembic/templates/multidb/script.py.mako +0 -0
  138. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/__init__.py +0 -0
  139. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/assertions.py +0 -0
  140. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/env.py +0 -0
  141. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/plugin/__init__.py +0 -0
  142. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/plugin/bootstrap.py +0 -0
  143. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/requirements.py +0 -0
  144. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/schemacompare.py +0 -0
  145. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/suite/__init__.py +0 -0
  146. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/suite/_autogen_fixtures.py +0 -0
  147. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/suite/test_autogen_comments.py +0 -0
  148. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/suite/test_autogen_diffs.py +0 -0
  149. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/suite/test_autogen_fks.py +0 -0
  150. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/suite/test_autogen_identity.py +0 -0
  151. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/suite/test_op.py +0 -0
  152. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/util.py +0 -0
  153. {alembic-1.13.0 → alembic-1.13.2}/alembic/testing/warnings.py +0 -0
  154. {alembic-1.13.0 → alembic-1.13.2}/alembic/util/editor.py +0 -0
  155. {alembic-1.13.0 → alembic-1.13.2}/alembic/util/exc.py +0 -0
  156. {alembic-1.13.0 → alembic-1.13.2}/alembic.egg-info/dependency_links.txt +0 -0
  157. {alembic-1.13.0 → alembic-1.13.2}/alembic.egg-info/entry_points.txt +0 -0
  158. {alembic-1.13.0 → alembic-1.13.2}/alembic.egg-info/not-zip-safe +0 -0
  159. {alembic-1.13.0 → alembic-1.13.2}/alembic.egg-info/requires.txt +0 -0
  160. {alembic-1.13.0 → alembic-1.13.2}/alembic.egg-info/top_level.txt +0 -0
  161. {alembic-1.13.0 → alembic-1.13.2}/docs/_images/api_overview.png +0 -0
  162. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/api/autogenerate.rst.txt +0 -0
  163. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/api/commands.rst.txt +0 -0
  164. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/api/config.rst.txt +0 -0
  165. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/api/ddl.rst.txt +0 -0
  166. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/api/index.rst.txt +0 -0
  167. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/api/operations.rst.txt +0 -0
  168. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/api/overview.rst.txt +0 -0
  169. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/api/runtime.rst.txt +0 -0
  170. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/api/script.rst.txt +0 -0
  171. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/batch.rst.txt +0 -0
  172. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/branches.rst.txt +0 -0
  173. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/cookbook.rst.txt +0 -0
  174. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/index.rst.txt +0 -0
  175. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/naming.rst.txt +0 -0
  176. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/offline.rst.txt +0 -0
  177. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/ops.rst.txt +0 -0
  178. {alembic-1.13.0 → alembic-1.13.2}/docs/_sources/tutorial.rst.txt +0 -0
  179. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/changelog.css +0 -0
  180. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/clipboard.min.js +0 -0
  181. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/copybutton.css +0 -0
  182. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/copybutton.js +0 -0
  183. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/copybutton_funcs.js +0 -0
  184. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/file.png +0 -0
  185. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/minus.png +0 -0
  186. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/nature_override.css +0 -0
  187. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/plus.png +0 -0
  188. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/pygments.css +0 -0
  189. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/site_custom_css.css +0 -0
  190. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/sphinx_highlight.js +0 -0
  191. {alembic-1.13.0 → alembic-1.13.2}/docs/_static/sphinx_paramlinks.css +0 -0
  192. {alembic-1.13.0 → alembic-1.13.2}/docs/build/Makefile +0 -0
  193. {alembic-1.13.0 → alembic-1.13.2}/docs/build/_static/nature_override.css +0 -0
  194. {alembic-1.13.0 → alembic-1.13.2}/docs/build/_static/site_custom_css.css +0 -0
  195. {alembic-1.13.0 → alembic-1.13.2}/docs/build/_templates/site_custom_sidebars.html +0 -0
  196. {alembic-1.13.0 → alembic-1.13.2}/docs/build/api/api_overview.png +0 -0
  197. {alembic-1.13.0 → alembic-1.13.2}/docs/build/api/autogenerate.rst +0 -0
  198. {alembic-1.13.0 → alembic-1.13.2}/docs/build/api/commands.rst +0 -0
  199. {alembic-1.13.0 → alembic-1.13.2}/docs/build/api/config.rst +0 -0
  200. {alembic-1.13.0 → alembic-1.13.2}/docs/build/api/ddl.rst +0 -0
  201. {alembic-1.13.0 → alembic-1.13.2}/docs/build/api/index.rst +0 -0
  202. {alembic-1.13.0 → alembic-1.13.2}/docs/build/api/operations.rst +0 -0
  203. {alembic-1.13.0 → alembic-1.13.2}/docs/build/api/overview.rst +0 -0
  204. {alembic-1.13.0 → alembic-1.13.2}/docs/build/api/runtime.rst +0 -0
  205. {alembic-1.13.0 → alembic-1.13.2}/docs/build/api/script.rst +0 -0
  206. {alembic-1.13.0 → alembic-1.13.2}/docs/build/batch.rst +0 -0
  207. {alembic-1.13.0 → alembic-1.13.2}/docs/build/branches.rst +0 -0
  208. {alembic-1.13.0 → alembic-1.13.2}/docs/build/cookbook.rst +0 -0
  209. {alembic-1.13.0 → alembic-1.13.2}/docs/build/index.rst +0 -0
  210. {alembic-1.13.0 → alembic-1.13.2}/docs/build/naming.rst +0 -0
  211. {alembic-1.13.0 → alembic-1.13.2}/docs/build/offline.rst +0 -0
  212. {alembic-1.13.0 → alembic-1.13.2}/docs/build/ops.rst +0 -0
  213. {alembic-1.13.0 → alembic-1.13.2}/docs/build/requirements.txt +0 -0
  214. {alembic-1.13.0 → alembic-1.13.2}/docs/build/tutorial.rst +0 -0
  215. {alembic-1.13.0 → alembic-1.13.2}/docs/build/unreleased/README.txt +0 -0
  216. {alembic-1.13.0 → alembic-1.13.2}/setup.py +0 -0
  217. {alembic-1.13.0 → alembic-1.13.2}/tests/__init__.py +0 -0
  218. {alembic-1.13.0 → alembic-1.13.2}/tests/_large_map.py +0 -0
  219. {alembic-1.13.0 → alembic-1.13.2}/tests/conftest.py +0 -0
  220. {alembic-1.13.0 → alembic-1.13.2}/tests/requirements.py +0 -0
  221. {alembic-1.13.0 → alembic-1.13.2}/tests/test_autogen_composition.py +0 -0
  222. {alembic-1.13.0 → alembic-1.13.2}/tests/test_bulk_insert.py +0 -0
  223. {alembic-1.13.0 → alembic-1.13.2}/tests/test_config.py +0 -0
  224. {alembic-1.13.0 → alembic-1.13.2}/tests/test_editor.py +0 -0
  225. {alembic-1.13.0 → alembic-1.13.2}/tests/test_external_dialect.py +0 -0
  226. {alembic-1.13.0 → alembic-1.13.2}/tests/test_mysql.py +0 -0
  227. {alembic-1.13.0 → alembic-1.13.2}/tests/test_offline_environment.py +0 -0
  228. {alembic-1.13.0 → alembic-1.13.2}/tests/test_op.py +0 -0
  229. {alembic-1.13.0 → alembic-1.13.2}/tests/test_op_naming_convention.py +0 -0
  230. {alembic-1.13.0 → alembic-1.13.2}/tests/test_oracle.py +0 -0
  231. {alembic-1.13.0 → alembic-1.13.2}/tests/test_post_write.py +0 -0
  232. {alembic-1.13.0 → alembic-1.13.2}/tests/test_revision.py +0 -0
  233. {alembic-1.13.0 → alembic-1.13.2}/tests/test_script_consumption.py +0 -0
  234. {alembic-1.13.0 → alembic-1.13.2}/tests/test_sqlite.py +0 -0
  235. {alembic-1.13.0 → alembic-1.13.2}/tests/test_stubs.py +0 -0
  236. {alembic-1.13.0 → alembic-1.13.2}/tests/test_suite.py +0 -0
  237. {alembic-1.13.0 → alembic-1.13.2}/tests/test_version_table.py +0 -0
@@ -1,4 +1,4 @@
1
- Copyright 2009-2023 Michael Bayer.
1
+ Copyright 2009-2024 Michael Bayer.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of
4
4
  this software and associated documentation files (the "Software"), to deal in
@@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
16
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
17
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
18
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- SOFTWARE.
19
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: alembic
3
- Version: 1.13.0
3
+ Version: 1.13.2
4
4
  Summary: A database migration tool for SQLAlchemy.
5
5
  Home-page: https://alembic.sqlalchemy.org
6
6
  Author: Mike Bayer
@@ -1,4 +1,4 @@
1
1
  from . import context
2
2
  from . import op
3
3
 
4
- __version__ = "1.13.0"
4
+ __version__ = "1.13.2"
@@ -0,0 +1,10 @@
1
+ from .api import _render_migration_diffs as _render_migration_diffs
2
+ from .api import compare_metadata as compare_metadata
3
+ from .api import produce_migrations as produce_migrations
4
+ from .api import render_python_code as render_python_code
5
+ from .api import RevisionContext as RevisionContext
6
+ from .compare import _produce_net_changes as _produce_net_changes
7
+ from .compare import comparators as comparators
8
+ from .render import render_op_text as render_op_text
9
+ from .render import renderers as renderers
10
+ from .rewriter import Rewriter as Rewriter
@@ -28,6 +28,7 @@ if TYPE_CHECKING:
28
28
  from sqlalchemy.engine import Inspector
29
29
  from sqlalchemy.sql.schema import MetaData
30
30
  from sqlalchemy.sql.schema import SchemaItem
31
+ from sqlalchemy.sql.schema import Table
31
32
 
32
33
  from ..config import Config
33
34
  from ..operations.ops import DowngradeOps
@@ -165,6 +166,7 @@ def compare_metadata(context: MigrationContext, metadata: MetaData) -> Any:
165
166
  """
166
167
 
167
168
  migration_script = produce_migrations(context, metadata)
169
+ assert migration_script.upgrade_ops is not None
168
170
  return migration_script.upgrade_ops.as_diffs()
169
171
 
170
172
 
@@ -331,7 +333,7 @@ class AutogenContext:
331
333
  self,
332
334
  migration_context: MigrationContext,
333
335
  metadata: Optional[MetaData] = None,
334
- opts: Optional[dict] = None,
336
+ opts: Optional[Dict[str, Any]] = None,
335
337
  autogenerate: bool = True,
336
338
  ) -> None:
337
339
  if (
@@ -465,7 +467,7 @@ class AutogenContext:
465
467
  run_filters = run_object_filters
466
468
 
467
469
  @util.memoized_property
468
- def sorted_tables(self):
470
+ def sorted_tables(self) -> List[Table]:
469
471
  """Return an aggregate of the :attr:`.MetaData.sorted_tables`
470
472
  collection(s).
471
473
 
@@ -481,7 +483,7 @@ class AutogenContext:
481
483
  return result
482
484
 
483
485
  @util.memoized_property
484
- def table_key_to_table(self):
486
+ def table_key_to_table(self) -> Dict[str, Table]:
485
487
  """Return an aggregate of the :attr:`.MetaData.tables` dictionaries.
486
488
 
487
489
  The :attr:`.MetaData.tables` collection is a dictionary of table key
@@ -492,7 +494,7 @@ class AutogenContext:
492
494
  objects contain the same table key, an exception is raised.
493
495
 
494
496
  """
495
- result = {}
497
+ result: Dict[str, Table] = {}
496
498
  for m in util.to_list(self.metadata):
497
499
  intersect = set(result).intersection(set(m.tables))
498
500
  if intersect:
@@ -594,9 +596,9 @@ class RevisionContext:
594
596
  migration_script = self.generated_revisions[-1]
595
597
  if not getattr(migration_script, "_needs_render", False):
596
598
  migration_script.upgrade_ops_list[-1].upgrade_token = upgrade_token
597
- migration_script.downgrade_ops_list[
598
- -1
599
- ].downgrade_token = downgrade_token
599
+ migration_script.downgrade_ops_list[-1].downgrade_token = (
600
+ downgrade_token
601
+ )
600
602
  migration_script._needs_render = True
601
603
  else:
602
604
  migration_script._upgrade_ops.append(
@@ -1,3 +1,6 @@
1
+ # mypy: allow-untyped-defs, allow-incomplete-defs, allow-untyped-calls
2
+ # mypy: no-warn-return-any, allow-any-generics
3
+
1
4
  from __future__ import annotations
2
5
 
3
6
  import contextlib
@@ -577,9 +580,7 @@ def _compare_indexes_and_uniques(
577
580
  # 5. index things by name, for those objects that have names
578
581
  metadata_names = {
579
582
  cast(str, c.md_name_to_sql_name(autogen_context)): c
580
- for c in metadata_unique_constraints_sig.union(
581
- metadata_indexes_sig # type:ignore[arg-type]
582
- )
583
+ for c in metadata_unique_constraints_sig.union(metadata_indexes_sig)
583
584
  if c.is_named
584
585
  }
585
586
 
@@ -982,7 +983,7 @@ def _normalize_computed_default(sqltext: str) -> str:
982
983
 
983
984
  """
984
985
 
985
- return re.sub(r"[ \(\)'\"`\[\]]", "", sqltext).lower()
986
+ return re.sub(r"[ \(\)'\"`\[\]\t\r\n]", "", sqltext).lower()
986
987
 
987
988
 
988
989
  def _compare_computed_default(
@@ -1240,7 +1241,7 @@ def _compare_foreign_keys(
1240
1241
  obj.const, obj.name, "foreign_key_constraint", False, compare_to
1241
1242
  ):
1242
1243
  modify_table_ops.ops.append(
1243
- ops.CreateForeignKeyOp.from_constraint(const.const)
1244
+ ops.CreateForeignKeyOp.from_constraint(const.const) # type: ignore[has-type] # noqa: E501
1244
1245
  )
1245
1246
 
1246
1247
  log.info(
@@ -1,3 +1,6 @@
1
+ # mypy: allow-untyped-defs, allow-incomplete-defs, allow-untyped-calls
2
+ # mypy: no-warn-return-any, allow-any-generics
3
+
1
4
  from __future__ import annotations
2
5
 
3
6
  from io import StringIO
@@ -184,9 +187,11 @@ def _render_create_table_comment(
184
187
  prefix=_alembic_autogenerate_prefix(autogen_context),
185
188
  tname=op.table_name,
186
189
  comment="%r" % op.comment if op.comment is not None else None,
187
- existing="%r" % op.existing_comment
188
- if op.existing_comment is not None
189
- else None,
190
+ existing=(
191
+ "%r" % op.existing_comment
192
+ if op.existing_comment is not None
193
+ else None
194
+ ),
190
195
  schema="'%s'" % op.schema if op.schema is not None else None,
191
196
  indent=" ",
192
197
  )
@@ -213,9 +218,11 @@ def _render_drop_table_comment(
213
218
  return templ.format(
214
219
  prefix=_alembic_autogenerate_prefix(autogen_context),
215
220
  tname=op.table_name,
216
- existing="%r" % op.existing_comment
217
- if op.existing_comment is not None
218
- else None,
221
+ existing=(
222
+ "%r" % op.existing_comment
223
+ if op.existing_comment is not None
224
+ else None
225
+ ),
219
226
  schema="'%s'" % op.schema if op.schema is not None else None,
220
227
  indent=" ",
221
228
  )
@@ -325,9 +332,11 @@ def _add_index(autogen_context: AutogenContext, op: ops.CreateIndexOp) -> str:
325
332
  _get_index_rendered_expressions(index, autogen_context)
326
333
  ),
327
334
  "unique": index.unique or False,
328
- "schema": (", schema=%r" % _ident(index.table.schema))
329
- if index.table.schema
330
- else "",
335
+ "schema": (
336
+ (", schema=%r" % _ident(index.table.schema))
337
+ if index.table.schema
338
+ else ""
339
+ ),
331
340
  "kwargs": ", " + ", ".join(opts) if opts else "",
332
341
  }
333
342
  return text
@@ -589,9 +598,11 @@ def _get_index_rendered_expressions(
589
598
  idx: Index, autogen_context: AutogenContext
590
599
  ) -> List[str]:
591
600
  return [
592
- repr(_ident(getattr(exp, "name", None)))
593
- if isinstance(exp, sa_schema.Column)
594
- else _render_potential_expr(exp, autogen_context, is_index=True)
601
+ (
602
+ repr(_ident(getattr(exp, "name", None)))
603
+ if isinstance(exp, sa_schema.Column)
604
+ else _render_potential_expr(exp, autogen_context, is_index=True)
605
+ )
595
606
  for exp in idx.expressions
596
607
  ]
597
608
 
@@ -849,7 +860,7 @@ def _render_Variant_type(
849
860
  ) -> str:
850
861
  base_type, variant_mapping = sqla_compat._get_variant_mapping(type_)
851
862
  base = _repr_type(base_type, autogen_context, _skip_variants=True)
852
- assert base is not None and base is not False
863
+ assert base is not None and base is not False # type: ignore[comparison-overlap] # noqa:E501
853
864
  for dialect in sorted(variant_mapping):
854
865
  typ = variant_mapping[dialect]
855
866
  base += ".with_variant(%s, %r)" % (
@@ -946,7 +957,7 @@ def _fk_colspec(
946
957
  won't fail if the remote table can't be resolved.
947
958
 
948
959
  """
949
- colspec = fk._get_colspec() # type:ignore[attr-defined]
960
+ colspec = fk._get_colspec()
950
961
  tokens = colspec.split(".")
951
962
  tname, colname = tokens[-2:]
952
963
 
@@ -1016,8 +1027,7 @@ def _render_foreign_key(
1016
1027
  % {
1017
1028
  "prefix": _sqlalchemy_autogenerate_prefix(autogen_context),
1018
1029
  "cols": ", ".join(
1019
- "%r" % _ident(cast("Column", f.parent).name)
1020
- for f in constraint.elements
1030
+ repr(_ident(f.parent.name)) for f in constraint.elements
1021
1031
  ),
1022
1032
  "refcols": ", ".join(
1023
1033
  repr(_fk_colspec(f, apply_metadata_schema, namespace_metadata))
@@ -1058,12 +1068,10 @@ def _render_check_constraint(
1058
1068
  # ideally SQLAlchemy would give us more of a first class
1059
1069
  # way to detect this.
1060
1070
  if (
1061
- constraint._create_rule # type:ignore[attr-defined]
1062
- and hasattr(
1063
- constraint._create_rule, "target" # type:ignore[attr-defined]
1064
- )
1071
+ constraint._create_rule
1072
+ and hasattr(constraint._create_rule, "target")
1065
1073
  and isinstance(
1066
- constraint._create_rule.target, # type:ignore[attr-defined]
1074
+ constraint._create_rule.target,
1067
1075
  sqltypes.TypeEngine,
1068
1076
  )
1069
1077
  ):
@@ -1075,9 +1083,11 @@ def _render_check_constraint(
1075
1083
  )
1076
1084
  return "%(prefix)sCheckConstraint(%(sqltext)s%(opts)s)" % {
1077
1085
  "prefix": _sqlalchemy_autogenerate_prefix(autogen_context),
1078
- "opts": ", " + (", ".join("%s=%s" % (k, v) for k, v in opts))
1079
- if opts
1080
- else "",
1086
+ "opts": (
1087
+ ", " + (", ".join("%s=%s" % (k, v) for k, v in opts))
1088
+ if opts
1089
+ else ""
1090
+ ),
1081
1091
  "sqltext": _render_potential_expr(
1082
1092
  constraint.sqltext, autogen_context, wrap_in_text=False
1083
1093
  ),
@@ -4,7 +4,7 @@ from typing import Any
4
4
  from typing import Callable
5
5
  from typing import Iterator
6
6
  from typing import List
7
- from typing import Optional
7
+ from typing import Tuple
8
8
  from typing import Type
9
9
  from typing import TYPE_CHECKING
10
10
  from typing import Union
@@ -16,12 +16,18 @@ if TYPE_CHECKING:
16
16
  from ..operations.ops import AddColumnOp
17
17
  from ..operations.ops import AlterColumnOp
18
18
  from ..operations.ops import CreateTableOp
19
+ from ..operations.ops import DowngradeOps
19
20
  from ..operations.ops import MigrateOperation
20
21
  from ..operations.ops import MigrationScript
21
22
  from ..operations.ops import ModifyTableOps
22
23
  from ..operations.ops import OpContainer
23
- from ..runtime.environment import _GetRevArg
24
+ from ..operations.ops import UpgradeOps
24
25
  from ..runtime.migration import MigrationContext
26
+ from ..script.revision import _GetRevArg
27
+
28
+ ProcessRevisionDirectiveFn = Callable[
29
+ ["MigrationContext", "_GetRevArg", List["MigrationScript"]], None
30
+ ]
25
31
 
26
32
 
27
33
  class Rewriter:
@@ -52,15 +58,21 @@ class Rewriter:
52
58
 
53
59
  _traverse = util.Dispatcher()
54
60
 
55
- _chained: Optional[Rewriter] = None
61
+ _chained: Tuple[Union[ProcessRevisionDirectiveFn, Rewriter], ...] = ()
56
62
 
57
63
  def __init__(self) -> None:
58
64
  self.dispatch = util.Dispatcher()
59
65
 
60
- def chain(self, other: Rewriter) -> Rewriter:
66
+ def chain(
67
+ self,
68
+ other: Union[
69
+ ProcessRevisionDirectiveFn,
70
+ Rewriter,
71
+ ],
72
+ ) -> Rewriter:
61
73
  """Produce a "chain" of this :class:`.Rewriter` to another.
62
74
 
63
- This allows two rewriters to operate serially on a stream,
75
+ This allows two or more rewriters to operate serially on a stream,
64
76
  e.g.::
65
77
 
66
78
  writer1 = autogenerate.Rewriter()
@@ -89,7 +101,7 @@ class Rewriter:
89
101
  """
90
102
  wr = self.__class__.__new__(self.__class__)
91
103
  wr.__dict__.update(self.__dict__)
92
- wr._chained = other
104
+ wr._chained += (other,)
93
105
  return wr
94
106
 
95
107
  def rewrites(
@@ -101,7 +113,7 @@ class Rewriter:
101
113
  Type[CreateTableOp],
102
114
  Type[ModifyTableOps],
103
115
  ],
104
- ) -> Callable:
116
+ ) -> Callable[..., Any]:
105
117
  """Register a function as rewriter for a given type.
106
118
 
107
119
  The function should receive three arguments, which are
@@ -146,8 +158,8 @@ class Rewriter:
146
158
  directives: List[MigrationScript],
147
159
  ) -> None:
148
160
  self.process_revision_directives(context, revision, directives)
149
- if self._chained:
150
- self._chained(context, revision, directives)
161
+ for process_revision_directives in self._chained:
162
+ process_revision_directives(context, revision, directives)
151
163
 
152
164
  @_traverse.dispatch_for(ops.MigrationScript)
153
165
  def _traverse_script(
@@ -156,7 +168,7 @@ class Rewriter:
156
168
  revision: _GetRevArg,
157
169
  directive: MigrationScript,
158
170
  ) -> None:
159
- upgrade_ops_list = []
171
+ upgrade_ops_list: List[UpgradeOps] = []
160
172
  for upgrade_ops in directive.upgrade_ops_list:
161
173
  ret = self._traverse_for(context, revision, upgrade_ops)
162
174
  if len(ret) != 1:
@@ -164,9 +176,10 @@ class Rewriter:
164
176
  "Can only return single object for UpgradeOps traverse"
165
177
  )
166
178
  upgrade_ops_list.append(ret[0])
167
- directive.upgrade_ops = upgrade_ops_list
168
179
 
169
- downgrade_ops_list = []
180
+ directive.upgrade_ops = upgrade_ops_list # type: ignore
181
+
182
+ downgrade_ops_list: List[DowngradeOps] = []
170
183
  for downgrade_ops in directive.downgrade_ops_list:
171
184
  ret = self._traverse_for(context, revision, downgrade_ops)
172
185
  if len(ret) != 1:
@@ -174,7 +187,7 @@ class Rewriter:
174
187
  "Can only return single object for DowngradeOps traverse"
175
188
  )
176
189
  downgrade_ops_list.append(ret[0])
177
- directive.downgrade_ops = downgrade_ops_list
190
+ directive.downgrade_ops = downgrade_ops_list # type: ignore
178
191
 
179
192
  @_traverse.dispatch_for(ops.OpContainer)
180
193
  def _traverse_op_container(
@@ -1,3 +1,5 @@
1
+ # mypy: allow-untyped-defs, allow-untyped-calls
2
+
1
3
  from __future__ import annotations
2
4
 
3
5
  import os
@@ -18,7 +20,7 @@ if TYPE_CHECKING:
18
20
  from .runtime.environment import ProcessRevisionDirectiveFn
19
21
 
20
22
 
21
- def list_templates(config: Config):
23
+ def list_templates(config: Config) -> None:
22
24
  """List available templates.
23
25
 
24
26
  :param config: a :class:`.Config` object.
@@ -47,7 +49,7 @@ def init(
47
49
 
48
50
  :param config: a :class:`.Config` object.
49
51
 
50
- :param directory: string path of the target directory
52
+ :param directory: string path of the target directory.
51
53
 
52
54
  :param template: string name of the migration environment template to
53
55
  use.
@@ -172,7 +174,7 @@ def revision(
172
174
  will be applied to the structure generated by the revision process
173
175
  where it can be altered programmatically. Note that unlike all
174
176
  the other parameters, this option is only available via programmatic
175
- use of :func:`.command.revision`
177
+ use of :func:`.command.revision`.
176
178
 
177
179
  """
178
180
 
@@ -313,9 +315,11 @@ def merge(
313
315
 
314
316
  :param config: a :class:`.Config` instance
315
317
 
316
- :param message: string message to apply to the revision
318
+ :param revisions: The revisions to merge.
319
+
320
+ :param message: string message to apply to the revision.
317
321
 
318
- :param branch_label: string label name to apply to the new revision
322
+ :param branch_label: string label name to apply to the new revision.
319
323
 
320
324
  :param rev_id: hardcoded revision identifier instead of generating a new
321
325
  one.
@@ -368,9 +372,10 @@ def upgrade(
368
372
 
369
373
  :param config: a :class:`.Config` instance.
370
374
 
371
- :param revision: string revision target or range for --sql mode
375
+ :param revision: string revision target or range for --sql mode. May be
376
+ ``"heads"`` to target the most recent revision(s).
372
377
 
373
- :param sql: if True, use ``--sql`` mode
378
+ :param sql: if True, use ``--sql`` mode.
374
379
 
375
380
  :param tag: an arbitrary "tag" that can be intercepted by custom
376
381
  ``env.py`` scripts via the :meth:`.EnvironmentContext.get_tag_argument`
@@ -411,9 +416,10 @@ def downgrade(
411
416
 
412
417
  :param config: a :class:`.Config` instance.
413
418
 
414
- :param revision: string revision target or range for --sql mode
419
+ :param revision: string revision target or range for --sql mode. May
420
+ be ``"base"`` to target the first revision.
415
421
 
416
- :param sql: if True, use ``--sql`` mode
422
+ :param sql: if True, use ``--sql`` mode.
417
423
 
418
424
  :param tag: an arbitrary "tag" that can be intercepted by custom
419
425
  ``env.py`` scripts via the :meth:`.EnvironmentContext.get_tag_argument`
@@ -447,12 +453,13 @@ def downgrade(
447
453
  script.run_env()
448
454
 
449
455
 
450
- def show(config, rev):
456
+ def show(config: Config, rev: str) -> None:
451
457
  """Show the revision(s) denoted by the given symbol.
452
458
 
453
459
  :param config: a :class:`.Config` instance.
454
460
 
455
- :param revision: string revision target
461
+ :param rev: string revision target. May be ``"current"`` to show the
462
+ revision(s) currently applied in the database.
456
463
 
457
464
  """
458
465
 
@@ -482,7 +489,7 @@ def history(
482
489
 
483
490
  :param config: a :class:`.Config` instance.
484
491
 
485
- :param rev_range: string revision range
492
+ :param rev_range: string revision range.
486
493
 
487
494
  :param verbose: output in verbose mode.
488
495
 
@@ -541,7 +548,9 @@ def history(
541
548
  _display_history(config, script, base, head)
542
549
 
543
550
 
544
- def heads(config, verbose=False, resolve_dependencies=False):
551
+ def heads(
552
+ config: Config, verbose: bool = False, resolve_dependencies: bool = False
553
+ ) -> None:
545
554
  """Show current available heads in the script directory.
546
555
 
547
556
  :param config: a :class:`.Config` instance.
@@ -566,7 +575,7 @@ def heads(config, verbose=False, resolve_dependencies=False):
566
575
  )
567
576
 
568
577
 
569
- def branches(config, verbose=False):
578
+ def branches(config: Config, verbose: bool = False) -> None:
570
579
  """Show current branch points.
571
580
 
572
581
  :param config: a :class:`.Config` instance.
@@ -636,7 +645,9 @@ def stamp(
636
645
  :param config: a :class:`.Config` instance.
637
646
 
638
647
  :param revision: target revision or list of revisions. May be a list
639
- to indicate stamping of multiple branch heads.
648
+ to indicate stamping of multiple branch heads; may be ``"base"``
649
+ to remove all revisions from the table or ``"heads"`` to stamp the
650
+ most recent revision(s).
640
651
 
641
652
  .. note:: this parameter is called "revisions" in the command line
642
653
  interface.
@@ -726,7 +737,7 @@ def ensure_version(config: Config, sql: bool = False) -> None:
726
737
 
727
738
  :param config: a :class:`.Config` instance.
728
739
 
729
- :param sql: use ``--sql`` mode
740
+ :param sql: use ``--sql`` mode.
730
741
 
731
742
  .. versionadded:: 1.7.6
732
743
 
@@ -12,6 +12,7 @@ from typing import Dict
12
12
  from typing import Mapping
13
13
  from typing import Optional
14
14
  from typing import overload
15
+ from typing import Sequence
15
16
  from typing import TextIO
16
17
  from typing import Union
17
18
 
@@ -104,7 +105,7 @@ class Config:
104
105
  stdout: TextIO = sys.stdout,
105
106
  cmd_opts: Optional[Namespace] = None,
106
107
  config_args: Mapping[str, Any] = util.immutabledict(),
107
- attributes: Optional[dict] = None,
108
+ attributes: Optional[Dict[str, Any]] = None,
108
109
  ) -> None:
109
110
  """Construct a new :class:`.Config`"""
110
111
  self.config_file_name = file_
@@ -140,7 +141,7 @@ class Config:
140
141
  """
141
142
 
142
143
  @util.memoized_property
143
- def attributes(self):
144
+ def attributes(self) -> Dict[str, Any]:
144
145
  """A Python dictionary for storage of additional state.
145
146
 
146
147
 
@@ -159,7 +160,7 @@ class Config:
159
160
  """
160
161
  return {}
161
162
 
162
- def print_stdout(self, text: str, *arg) -> None:
163
+ def print_stdout(self, text: str, *arg: Any) -> None:
163
164
  """Render a message to standard out.
164
165
 
165
166
  When :meth:`.Config.print_stdout` is called with additional args
@@ -183,7 +184,7 @@ class Config:
183
184
  util.write_outstream(self.stdout, output, "\n", **self.messaging_opts)
184
185
 
185
186
  @util.memoized_property
186
- def file_config(self):
187
+ def file_config(self) -> ConfigParser:
187
188
  """Return the underlying ``ConfigParser`` object.
188
189
 
189
190
  Direct access to the .ini file is available here,
@@ -220,8 +221,7 @@ class Config:
220
221
  @overload
221
222
  def get_section(
222
223
  self, name: str, default: None = ...
223
- ) -> Optional[Dict[str, str]]:
224
- ...
224
+ ) -> Optional[Dict[str, str]]: ...
225
225
 
226
226
  # "default" here could also be a TypeVar
227
227
  # _MT = TypeVar("_MT", bound=Mapping[str, str]),
@@ -229,14 +229,12 @@ class Config:
229
229
  @overload
230
230
  def get_section(
231
231
  self, name: str, default: Dict[str, str]
232
- ) -> Dict[str, str]:
233
- ...
232
+ ) -> Dict[str, str]: ...
234
233
 
235
234
  @overload
236
235
  def get_section(
237
236
  self, name: str, default: Mapping[str, str]
238
- ) -> Union[Dict[str, str], Mapping[str, str]]:
239
- ...
237
+ ) -> Union[Dict[str, str], Mapping[str, str]]: ...
240
238
 
241
239
  def get_section(
242
240
  self, name: str, default: Optional[Mapping[str, str]] = None
@@ -312,16 +310,16 @@ class Config:
312
310
  return default
313
311
 
314
312
  @overload
315
- def get_main_option(self, name: str, default: str) -> str:
316
- ...
313
+ def get_main_option(self, name: str, default: str) -> str: ...
317
314
 
318
315
  @overload
319
316
  def get_main_option(
320
317
  self, name: str, default: Optional[str] = None
321
- ) -> Optional[str]:
322
- ...
318
+ ) -> Optional[str]: ...
323
319
 
324
- def get_main_option(self, name, default=None):
320
+ def get_main_option(
321
+ self, name: str, default: Optional[str] = None
322
+ ) -> Optional[str]:
325
323
  """Return an option from the 'main' section of the .ini file.
326
324
 
327
325
  This defaults to being a key from the ``[alembic]``
@@ -351,7 +349,9 @@ class CommandLine:
351
349
  self._generate_args(prog)
352
350
 
353
351
  def _generate_args(self, prog: Optional[str]) -> None:
354
- def add_options(fn, parser, positional, kwargs):
352
+ def add_options(
353
+ fn: Any, parser: Any, positional: Any, kwargs: Any
354
+ ) -> None:
355
355
  kwargs_opts = {
356
356
  "template": (
357
357
  "-t",
@@ -554,7 +554,9 @@ class CommandLine:
554
554
  )
555
555
  subparsers = parser.add_subparsers()
556
556
 
557
- positional_translations = {command.stamp: {"revision": "revisions"}}
557
+ positional_translations: Dict[Any, Any] = {
558
+ command.stamp: {"revision": "revisions"}
559
+ }
558
560
 
559
561
  for fn in [getattr(command, n) for n in dir(command)]:
560
562
  if (
@@ -609,7 +611,7 @@ class CommandLine:
609
611
  else:
610
612
  util.err(str(e), **config.messaging_opts)
611
613
 
612
- def main(self, argv=None):
614
+ def main(self, argv: Optional[Sequence[str]] = None) -> None:
613
615
  options = self.parser.parse_args(argv)
614
616
  if not hasattr(options, "cmd"):
615
617
  # see http://bugs.python.org/issue9253, argparse
@@ -624,7 +626,11 @@ class CommandLine:
624
626
  self.run_cmd(cfg, options)
625
627
 
626
628
 
627
- def main(argv=None, prog=None, **kwargs):
629
+ def main(
630
+ argv: Optional[Sequence[str]] = None,
631
+ prog: Optional[str] = None,
632
+ **kwargs: Any,
633
+ ) -> None:
628
634
  """The console runner function for Alembic."""
629
635
 
630
636
  CommandLine(prog=prog).main(argv=argv)
@@ -160,8 +160,8 @@ def configure(
160
160
  MigrationContext,
161
161
  Column[Any],
162
162
  Column[Any],
163
- TypeEngine,
164
- TypeEngine,
163
+ TypeEngine[Any],
164
+ TypeEngine[Any],
165
165
  ],
166
166
  Optional[bool],
167
167
  ],
@@ -636,7 +636,8 @@ def configure(
636
636
  """
637
637
 
638
638
  def execute(
639
- sql: Union[Executable, str], execution_options: Optional[dict] = None
639
+ sql: Union[Executable, str],
640
+ execution_options: Optional[Dict[str, Any]] = None,
640
641
  ) -> None:
641
642
  """Execute the given SQL using the current change context.
642
643
 
@@ -759,7 +760,11 @@ def get_x_argument(
759
760
  The return value is a list, returned directly from the ``argparse``
760
761
  structure. If ``as_dictionary=True`` is passed, the ``x`` arguments
761
762
  are parsed using ``key=value`` format into a dictionary that is
762
- then returned.
763
+ then returned. If there is no ``=`` in the argument, value is an empty
764
+ string.
765
+
766
+ .. versionchanged:: 1.13.1 Support ``as_dictionary=True`` when
767
+ arguments are passed without the ``=`` symbol.
763
768
 
764
769
  For example, to support passing a database URL on the command line,
765
770
  the standard ``env.py`` script can be modified like this::
@@ -801,7 +806,7 @@ def is_offline_mode() -> bool:
801
806
 
802
807
  """
803
808
 
804
- def is_transactional_ddl():
809
+ def is_transactional_ddl() -> bool:
805
810
  """Return True if the context is configured to expect a
806
811
  transactional DDL capable backend.
807
812