diff --git a/soda/core/soda/execution/data_source.py b/soda/core/soda/execution/data_source.py index 4cb611e4d..e390daefa 100644 --- a/soda/core/soda/execution/data_source.py +++ b/soda/core/soda/execution/data_source.py @@ -86,7 +86,7 @@ def build_default_formats(): "date inverse": rf"^{s}{year}[-\./]{month}[-\./]{day}{s}$", "date iso 8601": f"^{s}" rf"{year4}-?({month2}-?{day2}|W[0-5]\d(-?[1-7])?|[0-3]\d\d)" - rf"([ T]{hour2}(:?{minute2}(:?{second2}([.,]\d+)?)?)?([+-]{hour2}:?{minute2}|Z)?)?" + rf"([ T]{hour24}(:?{minute2}(:?{second2}([.,]\d+)?)?)?([+-]{hour24}:?{minute2}|Z)?)?" f"{s}$", "time 24h": f"^{s}{hour24}:{minute}(:{second})?{s}$", "time 24h nosec": f"^{s}{hour24}:{minute}{s}$", diff --git a/soda/core/tests/data_source/test_formats.py b/soda/core/tests/data_source/test_formats.py index 54fed586f..76ff11dd3 100644 --- a/soda/core/tests/data_source/test_formats.py +++ b/soda/core/tests/data_source/test_formats.py @@ -56,6 +56,8 @@ def test_formats(data_source_fixture: DataSourceFixture): "07-04-1776", "08-15-1620", "09-20-1519", + "01-01-2100", + "01-01-1899", ], "failing_values": [ "", @@ -121,6 +123,10 @@ def test_formats(data_source_fixture: DataSourceFixture): "2020-02-08 09Z", "2020-04-30", "2020-04-30T00:00:00.000", + "2020-10-11 11:34", + "2100-01-01 14:36", + "1899-01-01 21:55", + "1623-10-11T10:10:10.0000+01:00", ], "failing_values": [ "", @@ -129,6 +135,8 @@ def test_formats(data_source_fixture: DataSourceFixture): "9999-01-01", "2000-13-01", "2000-01-32", + "2020-10-11 90:34", + "2100-01-01 14:67", ], }, } diff --git a/soda/mysql/soda/data_sources/mysql_data_source.py b/soda/mysql/soda/data_sources/mysql_data_source.py index 484f2d5e2..beda97e7f 100644 --- a/soda/mysql/soda/data_sources/mysql_data_source.py +++ b/soda/mysql/soda/data_sources/mysql_data_source.py @@ -71,7 +71,7 @@ def __init__(self, logs: Logs, data_source_name: str, data_source_properties: di "integer": r"^[[:blank:]]*[-+]?[[:blank:]]*[[:digit:]]+$", "positive integer": r"^[[:blank:]]*[+]?[[:blank:]]*[[:digit:]]+$", "negative integer": r"^[[:blank:]]*(-[[:blank:]]*[[:digit:]]+|0)[[:blank:]]*$", - "date iso 8601": r"^ *(19|20)[[:digit:]][[:digit:]]-?((0[0-9]|1[12])-?([012][0-9]|3[01])|W[0-5][[:digit:]](-?[1-7])?|[0-3][[:digit:]][[:digit:]])([ T](0[0-9]|1[012])(:?[0-5][0-9](:?[0-5][0-9]([.,][[:digit:]]+)?)?)?([+-](0[0-9]|1[012]):?[0-5][0-9]|Z)?)? *$", + "date iso 8601": r"^ *[12][[:digit:]][[:digit:]][[:digit:]]-?((0[1-9]|1[012])-?((0[1-9]|[12][0-9]|3[01]))|W[0-5][[:digit:]](-?[1-7])?|[0-3][[:digit:]][[:digit:]])([ T](0?[0-9]|[01][[:digit:]]|2[0-3])(:?[0-5][0-9](:?[0-5][0-9]([.,][[:digit:]]+)?)?)?([+-](0[0-9]|1[012]):?[0-5][0-9]|Z)?)? *$", } )