[Python] SqlAlchemy/Psycog2 undefined function TO_TIMESTAMP

Discussão em 'Python' iniciado por Stack, Setembro 2, 2025.

  1. Stack

    Stack Membro Participativo

    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...

Compartilhe esta Página