VALUES clause in SQLAlchemy

后端 未结 6 873
北海茫月
北海茫月 2020-12-01 17:26

Is there a way to build a Query object in SQLAlchemy which will be the equivalent of:

SELECT * FROM (VALUES (1, 2, 3)) AS sq;

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-01 17:46

    I suggest my version of zzzeek's snippet which

    • renders None as NULL
    • specifies literal type based on column type
    • handles ARRAY literals (useful for PostgreSQL)

    How to make use of bindparam() in a custom Compiled expression?

提交回复
热议问题