I am fetching content of the table and downloading it CSV (using LibPQ, DataFrames and CSV).
This is the code converting DataFrame to CSV:
executeResult = execute(conn, "SELECT * FROM table") frame = DataFrame(executeResult) join(CSV.RowWriter(frame))
And this is roughly the result:
date,gascons,irradiation,rain,temperature,windspeed,ph,_label 2004-01-01T00:00:00.0,53875.51,0.0,0.5,0.0,0.0,0.0,0.0 2004-01-01T01:00:00.0,51297.24,0.0,0.3,0.8,5.5,0.0,0.0 2004-01-01T02:00:00.0,51010.4,0.0,0.5,0.6,6.3,0.0,0.0
The problem is that “T” in the column with type Dates.DateTime. The resulting CSV should look like this:
date,gascons,irradiation,rain,temperature,windspeed,ph,_label 2004-01-01 00:00:00.0,53875.51,0.0,0.5,0.0,0.0,0.0,0.0 2004-01-01 01:00:00.0,51297.24,0.0,0.3,0.8,5.5,0.0,0.0 2004-01-01 02:00:00.0,51010.4,0.0,0.5,0.6,6.3,0.0,0.0
I achieve it easily, using
replace(join(CSV.RowWriter(frame)), "T" => " ") instead of the last line in the code above, but this would work for me only because all other columns are numeric. I also think this is not an efficient solution esp. for large input table (huge string with many T’s to replace). Could I somehow ask DataFrame to supply Dates.DateTime column in a different format?