github-actions[bot] opened a new pull request, #71791:
URL: https://github.com/apache/airflow/pull/71791

   * Stop variables export/import from silently corrupting values
   
   `airflow variables export` writes a bare value for any variable without a
   description, while `airflow variables import` treats every dict carrying a
   "value" key as a {"value": ..., "description": ...} envelope. A variable 
whose
   own value happens to have that shape is therefore unwrapped on the way back 
in:
   its value is replaced by the inner "value" and a description is invented from
   the inner "description". Nothing warns the operator, so a round-trip through 
a
   file - the documented way to migrate variables between environments - quietly
   rewrites their data.
   
   Export also decodes the stored JSON before writing it out, which erases the
   difference between a variable holding raw text and one holding a JSON-encoded
   string. Re-importing flattens the latter, and any Dag reading it with
   deserialize_json=True starts failing on a value that is no longer valid JSON.
   
   Import's reconstruction is deterministic - strings are stored verbatim,
   everything else is JSON-encoded, and one envelope layer is unwrapped - so 
export
   alone can be made lossless. Fixing it there leaves import untouched and keeps
   hand-written import files working exactly as before.
   
   * apply suggestion
   
   ---------
   (cherry picked from commit f549b34c682bfead7b611b1b20c5ae734714ed3d)
   
   Co-authored-by: Y-C <[email protected]>
   Co-authored-by: Eason09053360 
<[email protected]>


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