Skip to content

Commit 68c5964

Browse files
committed
Added the T format datetime
1 parent 6875474 commit 68c5964

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/databricks/sql/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,7 @@ def datetime_parser(datetime_string):
635635
"%Y-%m-%d", # MySQL Date only
636636
"%m/%d/%Y %I:%M:%S %p", # US format MSSQL Server
637637
"%d-%b-%Y %H:%M:%S", # Oracle format
638+
"%Y-%m-%dT%H:%M:%S.%f",
638639
]
639640

640641
for fmt in formats:

tests/unit/test_util.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def get_column_table_and_description(self):
2323
("timestamp_column_2", "timestamp", None, None, None, None, None),
2424
("timestamp_column_3", "timestamp", None, None, None, None, None),
2525
("timestamp_column_4", "timestamp", None, None, None, None, None),
26+
("timestamp_column_5", "timestamp", None, None, None, None, None),
2627
("binary_column", "binary", None, None, None, None, None),
2728
("array_column", "array", None, None, None, None, None),
2829
("map_column", "map", None, None, None, None, None),
@@ -47,6 +48,7 @@ def get_column_table_and_description(self):
4748
("2021-09-30 11:27:35.123",),
4849
("03/08/2024 02:30:15 PM",),
4950
("08-Mar-2024 14:30:15",),
51+
("2024-03-16T14:30:25.123",),
5052
(b"\xde\xad\xbe\xef",),
5153
('["item1","item2"]',),
5254
('{"key1":"value1","key2":"value2"}',),
@@ -80,6 +82,7 @@ def test_convert_to_assigned_datatypes_in_column_table(self):
8082
(datetime.datetime(2021, 9, 30, 11, 27, 35, 123000), datetime.datetime),
8183
(datetime.datetime(2024, 3, 8, 14, 30, 15), datetime.datetime),
8284
(datetime.datetime(2024, 3, 8, 14, 30, 15), datetime.datetime),
85+
(datetime.datetime(2024, 3, 16, 14, 30, 25, 123000), datetime.datetime),
8386
(b"\xde\xad\xbe\xef", bytes),
8487
('["item1","item2"]', str),
8588
('{"key1":"value1","key2":"value2"}', str),

0 commit comments

Comments
 (0)