Skip to content

Commit

Permalink
fix: Number takes priority over date-time, if not using --datetime-fo…
Browse files Browse the repository at this point in the history
…rmat, closes #1270
  • Loading branch information
jpmckinney committed Feb 6, 2025
1 parent 0095bed commit c327a1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Unreleased
- feat: :doc:`/scripts/sql2csv` adds a :code:`--execution-option` option.
- feat: :doc:`/scripts/sql2csv` uses the ``stream_results=True`` execution option, by default, to not load all data into memory at once.
- fix: :doc:`/scripts/csvsql` uses a default value of 1 for the :code:`--min-col-len` and :code:`--col-len-multiplier` options.
- fix: For type inference, number takes priority over date-time, if not using the :code:`--datetime-format` option.

2.0.1 - July 12, 2024
---------------------
Expand Down
4 changes: 3 additions & 1 deletion csvkit/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,10 @@ def get_column_types(self):
]

# In order to parse dates like "20010101".
if self.args.date_format or self.args.datetime_format:
if self.args.datetime_format:
types.insert(-1, number_type)
elif self.args.date_format:
types.insert(-2, number_type)
else:
types.insert(1, number_type)

Expand Down

0 comments on commit c327a1b

Please sign in to comment.