summaryrefslogtreecommitdiff
path: root/alembic
diff options
context:
space:
mode:
authorTim Penhey <tim@penhey.net>2023-02-24 10:17:57 +1300
committerGitHub <noreply@github.com>2023-02-23 22:17:57 +0100
commitb53ec0004a08c40a25a4dbf047c51cd140971a9c (patch)
tree9d68ba6b5a2d1290c7990538665dd2848b41d5de /alembic
parentdf26520617fa6f9ed65f7047d7e158cd31ba7154 (diff)
downloadalembic-b53ec0004a08c40a25a4dbf047c51cd140971a9c.tar.gz
Update docstring to suggest raw string (#1186)
* 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>
Diffstat (limited to 'alembic')
-rw-r--r--alembic/op.pyi2
-rw-r--r--alembic/operations/ops.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/alembic/op.pyi b/alembic/op.pyi
index 4e80a00..5c089e8 100644
--- a/alembic/op.pyi
+++ b/alembic/op.pyi
@@ -1009,7 +1009,7 @@ def execute(
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:
diff --git a/alembic/operations/ops.py b/alembic/operations/ops.py
index 808d1fb..3cdd170 100644
--- a/alembic/operations/ops.py
+++ b/alembic/operations/ops.py
@@ -2388,7 +2388,7 @@ class ExecuteSQLOp(MigrateOperation):
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: