* Update docstring to suggest raw string
When escaping the `:` for `op.execute` if a normal string is used, you need to escape the backslash, eg. `'\\:colon_value'` or using a raw string.
For the docs I feel it is nicer to show the raw string.
* Update stub documentation
Change-Id: Ia605c6c036fe82cebff9b427333404f1c59ea74d
---------
Co-authored-by: CaselIT <cfederico87@gmail.com>
literal SQL string contains a colon, it must be escaped with a
backslash, as::
- op.execute("INSERT INTO table (foo) VALUES ('\:colon_value')")
+ op.execute(r"INSERT INTO table (foo) VALUES ('\:colon_value')")
:param sqltext: Any legal SQLAlchemy expression, including:
literal SQL string contains a colon, it must be escaped with a
backslash, as::
- op.execute("INSERT INTO table (foo) VALUES ('\:colon_value')")
+ op.execute(r"INSERT INTO table (foo) VALUES ('\:colon_value')")
:param sqltext: Any legal SQLAlchemy expression, including:
if True: # avoid flake/zimports messing with the order
from alembic.operations.base import Operations
from alembic.runtime.environment import EnvironmentContext
+ from alembic.runtime.migration import MigrationContext
from alembic.script.write_hooks import console_scripts
from alembic.util.compat import inspect_formatargspec
from alembic.util.compat import inspect_getfullargspec
"sqlalchemy.sql.dml.",
]
CONTEXT_MANAGERS = {"op": ["batch_alter_table"]}
+ADDITIONAL_ENV = {"MigrationContext": MigrationContext}
def generate_pyi_for_proxy(
**sa.sql.schema.__dict__,
**sa.__dict__,
**sa.types.__dict__,
+ **ADDITIONAL_ENV,
**ops.__dict__,
**module.__dict__,
}