* Sanitize NaN, Infinite, -Infinite causing error when saving as PostgreSQL JSON #7339 (2nd try)
* Move json nsanitaize to on the top of json_dumps
* Fix comment
This fixes the following exception:
```
UnboundLocalError: local variable 'value_is_number' referenced before assignment
File "rq/worker.py", line 1431, in perform_job
rv = job.perform()
File "rq/job.py", line 1280, in perform
self._result = self._execute()
File "rq/job.py", line 1317, in _execute
result = self.func(*self.args, **self.kwargs)
File "redash/tasks/alerts.py", line 36, in check_alerts_for_query
new_state = alert.evaluate()
File "redash/models/__init__.py", line 1002, in evaluate
new_state = next_state(op, value, threshold)
File "redash/models/__init__.py", line 928, in next_state
elif not value_is_number and op not in [OPERATORS.get("!="), OPERATORS.get("=="), OPERATORS.get("equals")]:
```
* prevent text values in payload being detected as 'set' on send.
Webex send ERROR:: Object of type set is not JSON serializable
Signed-off-by: Matt Nelson <metheos@gmail.com>
* add support for formatted QUERY_RESULT_TABLE in webex card
Signed-off-by: Matt Nelson <metheos@gmail.com>
* don't try to send to blank destinations
Signed-off-by: Matt Nelson <metheos@gmail.com>
* fix handling of the encoded QUERY_RESULTS_TABLE text
Signed-off-by: Matt Nelson <metheos@gmail.com>
* re-sort imports for ruff
Signed-off-by: Matt Nelson <metheos@gmail.com>
* change formatter to black
Signed-off-by: Matt Nelson <metheos@gmail.com>
* Add additional tests for Webex notification handling
ensure blank entries are handled for room IDs and person emails.
ensure that the API is not called when no valid destinations are provided.
ensure proper attachment formatting for alerts containing 2D arrays.
Signed-off-by: Matt Nelson <metheos@gmail.com>
* Add test for Webex notification with 1D array handling
This commit introduces a new test case to verify that the Webex
notification function correctly handles a 1D array input in the alert body.
The test ensures that the expected payload is constructed properly and that
the requests.post method is called with the correct parameters.
Signed-off-by: Matt Nelson <metheos@gmail.com>
---------
Signed-off-by: Matt Nelson <metheos@gmail.com>
* Support result reuse
* Update pyathena to 2.25.2
* Separate options
* Regenerate the Poetry lock file
---------
Co-authored-by: SeongTae Jeong <seongtaejg@gmail.com>
I've experience this on my Redash in production. I'm not sure what can cause the value to exist, but be None. I guess it depends on the SQL query.
I followed the same idea of returning a self.UNKNOWN_STATE for cases that we can't know what's happening.