Ah, after days of trying to figure it out, it turns out Postgres just
won't let you cast a column when editing an existing view. I had to
drop the view first and create a brand new one from scratch. Casting
in SQLAlchemy worked but I think I'm going to go with the "backend"
fix. Thanks for the
For some reason if I use CAST directly in PG, it complains "cannot
change data type of view column". Its rather cumbersome but it does
seem to at least work in SQLAlchemy. Thanks.
On Jul 5, 3:43 pm, Michael Bayer wrote:
> any expression in SQL can be coerced into a particular type using
> cas
any expression in SQL can be coerced into a particular type using
casts. PG supports the SQL standard CAST operator which SQLAlchemy
provides as expression.cast, i.e.
from sqlalchemy import cast, Integer
cast(somevalue + someothervalue, Integer)
This will instruct PG to cast the value as inte