Skip to content

Commit 83b6c5a

Browse files
committed
BUG23590083: Fix issue while fetching date datatype from table
Fetching data from a table was giving an error while processing date column metadata. This patch fixes this bug as well as BUG23606320. Tests were changed for regression.
1 parent b5c878a commit 83b6c5a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/mysqlx/result.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,8 @@ def _map_datetime(self):
466466
self._col_type = ColumnType.DATETIME
467467
elif self._flags & DatetimeColumnFlags.TIMESTAMP > 0:
468468
self._col_type = ColumnType.TIMESTAMP
469-
raise ValueError("Datetime mapping scenario unhandled")
469+
else:
470+
raise ValueError("Datetime mapping scenario unhandled")
470471

471472
def _map_type(self):
472473
if self._proto_type == ColumnProtoType.SINT:

tests/test_mysqlx_crud.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -520,18 +520,18 @@ def test_column_metadata(self):
520520

521521
self.node_session.sql(
522522
"CREATE TABLE {0}(age INT, name VARCHAR(50), pic VARBINARY(100), "
523-
"config JSON)".format(table_name)).execute()
523+
"config JSON, created DATE)".format(table_name)).execute()
524524
self.node_session.sql(
525-
"INSERT INTO {0} VALUES (21, 'Fred', NULL, NULL)"
525+
"INSERT INTO {0} VALUES (21, 'Fred', NULL, NULL, '2008-07-26')"
526526
"".format(table_name)).execute()
527527
self.node_session.sql(
528-
"INSERT INTO {0} VALUES (28, 'Barney', NULL, NULL)"
528+
"INSERT INTO {0} VALUES (28, 'Barney', NULL, NULL, '2012-03-12')"
529529
"".format(table_name)).execute()
530530
self.node_session.sql(
531-
"INSERT INTO {0} VALUES (42, 'Wilma', NULL, NULL)"
531+
"INSERT INTO {0} VALUES (42, 'Wilma', NULL, NULL, '1975-11-11')"
532532
"".format(table_name)).execute()
533533
self.node_session.sql(
534-
"INSERT INTO {0} VALUES (67, 'Betty', NULL, NULL)"
534+
"INSERT INTO {0} VALUES (67, 'Betty', NULL, NULL, '2015-06-21')"
535535
"".format(table_name)).execute()
536536

537537
table = self.schema.get_table("test")

0 commit comments

Comments
 (0)