Need to execute migration with : in the expression
#1763
Unanswered
candiduslynx
asked this question in
Usage Questions
Replies: 2 comments 3 replies
-
|
Hi, Please refer to the text documentation on how to escape the colon https://docs.sqlalchemy.org/en/20/core/sqlelement.html#sqlalchemy.sql.expression.text |
Beta Was this translation helpful? Give feedback.
2 replies
-
|
when you have a thing you want evaluated as a column expression, for text() it looks like this: im not able to reproduce your |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a functional index I need to generate that includes
:in the expression:When generating it via the following expression Alembic generates
NULLinstead of':___':( func.split_part(category, literal(":"), literal_sql(1)) + type_coerce(text(":___"), type_=TEXT) + func.substring(func.split_part(category, literal(":"), literal(2)), literal(4)) )Initially I tried with
literal(":___")instead oftype_coerce(text(":___"), type_=TEXT)but it starts treating the string as param and shows'%(___)s'in the query text.Could you please advice on the Alembic usage and how to force it not to treat
:as parameter start?Update: workaround of
literal(":") + literal("___")seems to work.Beta Was this translation helpful? Give feedback.
All reactions