Add format_timestamps preprocessor#89
Conversation
|
@dougharris This looks fine. But why the column-specific format, rather than formatting all datetime columns? What's the usecase for selectively formatting some datetime columns differently than others? |
|
@j-bennet different columns have different uses. For example, we have a table that contains metadata about files we import for clients. Since clients update the files irregularly, when viewing the I discuss this a bit more in my comment on the issue |
|
I force pushed an update which better handles timestamp columns will null values. |
|
@dougharris I think it would be great if the column-level format would be in addition to global timestamp format. But we can start with the column-level format and go from there. |
|
As I think about it more, I like the idea of a global default for timestamp. What I currently see is |
I very much agree! |
Description
Added
format_timestamps()to preprocessors.This allows for per-column formatting for date, time, or datetime like data.
Add a
column_date_formatssection to your config file with separate lines for each column that you'd like to specify a format usingname=format. Use standard Python strftime formatting strings.This works with a related pgcli PR to address my enhancement request dbcli/pgcli#1402
Checklist
CHANGELOG.AUTHORSfile (or it's already there).pip install pre-commit && pre-commit install), and ranblackon my code.