So I am attempting to use a to_timestamp function in sqlalchemy for our postgres database. I know that with SQLite, you can create functions via the create_function method, but I don't know if/how you can do this with postgres. I'm trying to create the to_timestamp function as it is being used in the Oracle implementation of our stored procedures, but we are trying to move off of the PLSQL and Oracle to Python/Sqlalchemy and Postgres. The function is obviously used within a query/statement, but it errors out. worker_stmt = ( select() .where( SfcObsTable.month == func.to_char(func.to_timestamp(obs.observationtime, "YYYYMMDDHH24MISS"), "MM") ) ) I believe the same will also be happening to the to_char func as well but I haven't been able to get to that point to tell. Any ideas on how to do this or a way to make this work would be great. Thanks! Continue reading...