What is the significance of literal("a") vs "b" in concat example? #9874
-
|
https://docs.sqlalchemy.org/en/20/core/functions.html#sqlalchemy.sql.functions.concat
>>> print(select(literal("a") + "b"))
SELECT :param_1 || :param_2 AS anon_1It's unclear to me in this example if:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
or... I guess |
Beta Was this translation helpful? Give feedback.
-
|
Hi, literal is generated automatically when using a literal with any sqlalchemy construct. So In the example literal is explicit because otherwise the operation would be done by python: |
Beta Was this translation helpful? Give feedback.
Hi,
literal is generated automatically when using a literal with any sqlalchemy construct. So
column('foo') + 1is equivalent tocolumn('foo') + literal(1)In the example literal is explicit because otherwise the operation would be done by python:
select('a' + 'b')is the same asselect('ab'), meaning that it will generateSELECT :param_1 AS anon_1