python - Using an integer as an SQL Alchemy selectable -
python - Using an integer as an SQL Alchemy selectable -
i'm trying generate sqlalchemy code match sql statement:
select table.id, table.value, 1 new_column table; i can select([table.c.id, table.c.value, 1]) work no problem, , adds new column results value of 1 expected, have no command on name of column. i've tried figure out way utilize label, since integer not sqlalchemy column, can't utilize it.
is there way same behavior raw sql in sqlalchemy?
in worst case can utilize raw sql, much prefer utilize sqlalchemy table object.
select([table.c.id, table.c.value, literal("1").label("new_column")])
python sql sqlalchemy
Comments
Post a Comment