/usr/share/pyshared/reformat/mysql.py is in pgloader 2.3.3~dev3-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Author: Dimitri Fontaine <dim@tapoueh.org>
#
# pgloader mysql reformating module
#
def timestamp(reject, input):
""" Reformat str as a PostgreSQL timestamp
MySQL timestamps are like: 20041002152952
We want instead this input: 2004-10-02 15:29:52
"""
if len(input) != 14:
e = "MySQL timestamp reformat input too short: %s" % input
reject.log(e, input)
year = input[0:4]
month = input[4:6]
day = input[6:8]
hour = input[8:10]
minute = input[10:12]
seconds = input[12:14]
return '%s-%s-%s %s:%s:%s' % (year, month, day, hour, minute, seconds)
|