To get the equivalent of
select a, b from very_wide_table
in SQLAlchemy I can write
VeryWideTable.query().with_entities(VeryWideTable.a, VeryWideTable.b)
What would be the equivalent of
select a, b, 'hello' from very_wide_table
I tried add_columns
but it wants a column object and I don't know how to specify a fixed string. I tried to add a fixed string to with_entities
but that was interpreted as a column name.
Use literal
:
.with_entities(VeryWideTable.a, VeryWideTable.b, literal("hello"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With