From 862eebda8349d2f3cb3514b08d3f24d2371bd275 Mon Sep 17 00:00:00 2001 From: Augusto Herrmann Date: Thu, 22 Aug 2024 16:49:30 -0300 Subject: [PATCH] Use json values instead of Python in Airflow variables --- src/parsers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parsers.py b/src/parsers.py index 1dbd853..345e2e0 100644 --- a/src/parsers.py +++ b/src/parsers.py @@ -1,7 +1,7 @@ """Abstract and concrete classes to parse DAG configuration from a file.""" -import ast from dataclasses import dataclass +import json import textwrap from typing import List, Set, Tuple import yaml @@ -161,7 +161,7 @@ def _get_terms_params(self, search) -> Tuple[List[str], str, str]: if "from_airflow_variable" in terms: var_value = Variable.get(terms.get("from_airflow_variable")) try: - terms = ast.literal_eval(var_value) + terms = json.loads(var_value) except (ValueError, SyntaxError): terms = var_value.splitlines() elif "from_db_select" in terms: