rusackas commented on code in PR #38490:
URL: https://github.com/apache/superset/pull/38490#discussion_r3526399112
##########
tests/unit_tests/databases/schema_tests.py:
##########
@@ -17,7 +17,7 @@
# pylint: disable=import-outside-toplevel, invalid-name, unused-argument,
redefined-outer-name
Review Comment:
Local in a test again, no annotation needed here. Resolving.
##########
tests/unit_tests/databases/schema_tests.py:
##########
@@ -17,7 +17,7 @@
# pylint: disable=import-outside-toplevel, invalid-name, unused-argument,
redefined-outer-name
-from typing import TYPE_CHECKING
+from typing import Any, TYPE_CHECKING
Review Comment:
Same, local test var. Resolving.
##########
superset/databases/schemas.py:
##########
@@ -277,6 +277,29 @@ def extra_validator(value: str) -> str:
)
]
)
+
+ metadata_cache_timeout = extra_.get("metadata_cache_timeout") or {}
+ if not isinstance(metadata_cache_timeout, dict):
+ raise ValidationError(
+ [
+ _(
+ "The metadata_cache_timeout must be a mapping from "
+ "string keys to non-negative integer values."
+ )
+ ]
+ )
+ for key in ("schema_cache_timeout", "table_cache_timeout"):
Review Comment:
Looks like the current version reads the raw value first and only defaults
to {} when the key is actually missing, then the isinstance check catches falsy
non-dicts. There's even a test covering 0/""/[]/False now. So this is handled.
Resolving.
##########
superset/databases/schemas.py:
##########
@@ -277,6 +277,29 @@ def extra_validator(value: str) -> str:
)
]
)
+
+ metadata_cache_timeout = extra_.get("metadata_cache_timeout") or {}
+ if not isinstance(metadata_cache_timeout, dict):
Review Comment:
The current validator doesn't do `or {}` anymore, it reads the raw value and
only substitutes {} when it's None, so falsy invalid types still hit the
isinstance check. Handled in the current version. Resolving.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]