[Python] Compare tkinter calendar get_date() Date with datetime field in Oracle db :

Discussão em 'Python' iniciado por Stack, Janeiro 20, 2025.

  1. Stack

    Stack Membro Participativo

    I´m trying to extract data within two tkinter calendar dates from an Oracle DB, Date in calendar is format date_pattern='yyyy-mm-dd' Date in Oracle DB is datetime yyyy-mm-dd hh:mm:dd, but I keep getting errors such as:

    -TypeError:can only concatenate str (not "Timestamp") to str
    Exception in Tkinter callback
    -TypeError: can only concatenate str (not "datetime.date") to
    str. Exception in Tkinter callback
    And the last error:
    -oracledb.exceptions.DatabaseError: ORA-01861: literal does
    not match format string. Exception in Tkinter callback






    Fecha = self.cal1.get_date()
    Fecha2=Fecha.strftime("%Y-%m-%d %H:%M:%S")
    sql = " SELECT t3.DESCRIPTION as ASSET_DESCRIPTION from maximo.BTV_workorder T1 inner join maximo.BTV_PM t2 on t2.Assetnum=T1.Assetnum left join maximo.BTV_ASSET t3 on T1.ASSETNUM=t3.ASSETNUM where T1.istask='1' and T1.SITEID='ALBAL' and T1.STATUS='COMP' and t2.STATUS='ACTIVE' and t1.STATUSDATE ='" + Fecha2 + "'"

    Continue reading...

Compartilhe esta Página