3
3

More than 5 years have passed since last update.

(sqlalchemy)selectのフィールドにテキストを表示する

Posted at

度忘れしそうなのでメモ

from sqlalchemy.sql.expression import literal

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

このqueryから生成されるのは以下のSQL

select column1, 'sample_text', column2 from Table;

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3