Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISO 8601 date should accept 24-hr times #2133

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion soda/core/soda/execution/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}$",
Expand Down
8 changes: 8 additions & 0 deletions soda/core/tests/data_source/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
"",
Expand Down Expand Up @@ -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": [
"",
Expand All @@ -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",
],
},
}
Expand Down
2 changes: 1 addition & 1 deletion soda/mysql/soda/data_sources/mysql_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)?)? *$",
}
)

Expand Down
Loading