I am programming an application to manage the tables of a database (insert, delete, update, query...), using Oracle as SGBD, and Sqlalchemy as ORM
I have to insert a new tuple in a Database table, entering the data from the keyboard, but that table has a date type field that I don't know how to enter
The class associated with the table is this:
class Alimento(Base):
__tablename__ = 'alimento'
codigo = Column(CHAR(5), primary_key = True)
descripcion = Column(String(50))
fechac aducidad = Column(Date)
establecimiento = Column(CHAR(5), ForeignKey('establecimiento.codigo'))
fecharecogida = Column(Date, nullable=False)
codvoluntario = Column(CHAR(2), ForeignKey('voluntario.codigo'))
entregado = Column(SmallInteger)
And I have tried to create a new object with this line, to be able to introduce it with the add command
NuevoAlimento = clases.Alimento(codigo='ABCD0', establecimiento='A8377', fecharecogida = '01/07/2015', codvoluntario = 'T6')
But, when I run add(NewFood), I get this error:
cx_Oracle.DatabaseError: ORA-01861: literal does not match format string
How can I enter it so that Oracle admits it to me?
I was able to fix the problem with the following code: