I have a class in Python for retrieving all the columns in a table and return a JSON with this data.
The problem is at least one of those columns is a datetime and I can't seem to understand how to serialize the columns so I can generate a valid JSON.
My class is as follows:
class GetTodos(Resource):
def get(self):
con = cx_Oracle.connect('brunojs/bdpf5@127.0.0.1/orcl')
cur = con.cursor()
cur.execute("select * from organite_repository")
r = [dict((cur.description[i][0], value) \
for i, value in enumerate(row)) for row in cur.fetchall()]
cur.connection.close()
return (r[0] if r else None) if None else r
Any hints on this?