Mikulas/pg-es-fdw

timestamp problem

Closed this issue · 1 comments

I use timestamp column in the foreign table, and write insert function.

When I write data to the base table, the database dump error message like this.

It seems like python couldn't parse timestamp format, I'm not sure
it's dependency issues (something I didn't install?)

or just this tool can't support that, thank you!

2018-02-06 11:49:51 CST ERROR: Error in python: TypeError
2018-02-06 11:49:51 CST DETAIL: Traceback (most recent call last):

File "build/bdist.linux-x86_64/egg/dite/init.py", line 93, in insert
return self.es_index(id, new_values)
File "build/bdist.linux-x86_64/egg/dite/init.py", line 72, in es_index
content = json.dumps(values)
File "/usr/lib/python2.7/json/init.py", line 243, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: datetime.datetime(2013, 5, 27, 3, 42, 34) is not JSON serializable

Hi, Sorry, I don't really know. Quick search shows it should be easy to serialize the datetime though https://stackoverflow.com/questions/11875770/how-to-overcome-datetime-datetime-not-json-serializable