I need to insert a pandas dataframe into an Oracle table. One of the columns is a date, but it looks like this:
09/07/2021 13:07
How could I convert it into a date type column so as Oracle takes it when inserting the value?
CREATE TABLE test (
call_date TIMESTAMP NOT NULL,
cacont_acc VARCHAR2(12) NOT NULL,
status VARCHAR2(5),
exhausted VARCHAR2(20),
attempts NUMBER,
exhausted_reason VARCHAR2(2000),
agency VARCHAR2(10)
);
EDIT: This is how the python process to insert the dataframe looks like:
# Insert the exhausted df into Oracle
truncate_exhausted = """
truncate table test
"""
insert_exhausted = """
INSERT INTO test (
call_date,
cacont_acc,
status,
exhausted,
attempts,
exhausted_reason,
agency
) VALUES (
:1,
:2,
:3,
:4,
:5,
:6,
:7
)
"""
rows = [tuple(x) for x in df_exhausted.values]
cur.execute(truncate_exhausted)
cur.executemany(insert_exhausted, rows)
conn.commit()