uranusjr commented on code in PR #69064:
URL: https://github.com/apache/airflow/pull/69064#discussion_r3484451528


##########
airflow-core/src/airflow/migrations/versions/0055_3_0_0_remove_pickled_data_from_dagrun_table.py:
##########
@@ -95,7 +118,12 @@ def upgrade():
 
                 try:
                     original_data = pickle.loads(pickle_data)
-                    json_data = json.dumps(original_data)
+                    # Sanitize values legal in pickle but illegal in strict 
JSON/JSONB so the
+                    # row is preserved instead of dropped by the except below:
+                    #   * NaN / Infinity / -Infinity  -> quoted strings (see 
_json_safe).
+                    #   * the U+0000 (NUL) escape that json.dumps emits for 
null bytes -> stripped
+                    #     (PostgreSQL JSON/JSONB cannot store it and it cannot 
be quoted/kept).
+                    json_data = 
json.dumps(_json_safe(original_data)).replace('\\u0000', '')

Review Comment:
   The same issue exists in 0049 for the SQL commands.



-- 
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]

Reply via email to