[PYTHON] (sqlalchemy) Display text in select field

I'll forget it, so make a note

from sqlalchemy.sql.expression import literal

query = session.query(Table.column1, literal('sample_text'), Table.column2)

The following SQL is generated from this query

select column1, 'sample_text', column2 from Table;

Recommended Posts

(sqlalchemy) Display text in select field
Clustering text in Python
Text processing in Python
Table definition in SQLAlchemy
Python OpenCV tried to display the image in text.
OperationalError in SQLAlchemy + SQLite3
Select file in dialog with python → Display file name in message box
UTF8 text processing in python
Display HTML in Jupyter notebook
Display UTM-30LX data in Python
Select features using text data
Implement extension field in Python
Speech to speech in python [text to speech]
Display Japanese in JSON file
Save Time type in SQLAlchemy