uranusjr commented on a change in pull request #17080:
URL: https://github.com/apache/airflow/pull/17080#discussion_r672173893
##########
File path: airflow/providers/mysql/operators/mysql.py
##########
@@ -67,6 +70,11 @@ def __init__(
self.parameters = parameters
self.database = database
+ def prepare_template(self) -> None:
+ """Parse JSON template file for attribute parameter."""
+ if isinstance(self.parameters, str):
+ self.parameters = ast.literal_eval(self.parameters)
Review comment:
If the content is JSON, shouldn’t this use `json.loads()`?
##########
File path: airflow/providers/mysql/operators/mysql.py
##########
@@ -67,6 +70,11 @@ def __init__(
self.parameters = parameters
self.database = database
+ def prepare_template(self) -> None:
+ """Parse JSON template file for attribute parameter."""
+ if isinstance(self.parameters, str):
+ self.parameters = ast.literal_eval(self.parameters)
Review comment:
Re-reading `MySqlOperator`, `parameters` isn’t actually always JSON, so
`ast.literal_eval` is correct here. Instead, please remove “JSON” from the
docstring.
--
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]