DBE-3763 Fix for known issues#47
Conversation
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
There was a problem hiding this comment.
Code Review
This pull request adds JSON support for MySQL and updates the _jsons_equiv utility to treat database NULL values as JSON null literals, ensuring consistent comparisons across different database backends. Feedback suggests optimizing the comparison logic by adding an early equality check after normalization to avoid unnecessary JSON parsing and updating the function's type hints to reflect that it now accepts None values.
| if a is None: | ||
| a = "null" | ||
| if b is None: | ||
| b = "null" |
There was a problem hiding this comment.
After normalizing None values to the string "null", it is more efficient to check for string equality before proceeding to parse the JSON. This avoids the overhead of two json.loads() calls when comparing a database NULL (which becomes "null") with a JSON "null" literal, which is the primary use case for this change. Additionally, since this function now explicitly handles None values, the type hints in the function signature should ideally be updated to Optional[str] to reflect this.
if a is None:
a = "null"
if b is None:
b = "null"
if a == b:
return True
No description provided.