From 612203caccac0cab1a5ceb9c3dfbd964593454b8 Mon Sep 17 00:00:00 2001 From: "javier.hernandez" Date: Tue, 1 Oct 2024 15:50:43 +0200 Subject: [PATCH 1/2] Fixed load vtl to create path from string. --- src/vtlengine/API/_InternalApi.py | 6 +++++- src/vtlengine/API/__init__.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vtlengine/API/_InternalApi.py b/src/vtlengine/API/_InternalApi.py index 15ab6be7..eda766b2 100644 --- a/src/vtlengine/API/_InternalApi.py +++ b/src/vtlengine/API/_InternalApi.py @@ -197,7 +197,11 @@ def load_vtl(input: Union[str, Path]): the file. """ if isinstance(input, str): - return input + try: + test = Path(input) + except Exception: + return input + input = test if not isinstance(input, Path): raise Exception('Invalid vtl file. Input is not a Path object') if not input.exists(): diff --git a/src/vtlengine/API/__init__.py b/src/vtlengine/API/__init__.py index d536ffa4..c63806aa 100644 --- a/src/vtlengine/API/__init__.py +++ b/src/vtlengine/API/__init__.py @@ -144,7 +144,7 @@ def run(script: Union[str, Path], data_structures: Union[dict, Path, List[Union[ The data structure information is contained in the JSON file given, and establish the datatype (string, integer or number), - and the role that each component is going to have (Identifier or Measure). + and the role that each component is going to have (Identifier, Attribute or Measure). It can be a dictionary or a path to the JSON file or folder that contains it. Moreover, a csv file with the data to operate with is going to be loaded. From 2fd53dbb4d6cc8628b548b9c8abe139a7778ec92 Mon Sep 17 00:00:00 2001 From: "javier.hernandez" Date: Tue, 1 Oct 2024 15:54:50 +0200 Subject: [PATCH 2/2] Fixed load vtl to create path from string. --- src/vtlengine/API/_InternalApi.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/vtlengine/API/_InternalApi.py b/src/vtlengine/API/_InternalApi.py index eda766b2..cb990e6c 100644 --- a/src/vtlengine/API/_InternalApi.py +++ b/src/vtlengine/API/_InternalApi.py @@ -197,11 +197,10 @@ def load_vtl(input: Union[str, Path]): the file. """ if isinstance(input, str): - try: - test = Path(input) - except Exception: + if os.path.exists(input): + input = Path(input) + else: return input - input = test if not isinstance(input, Path): raise Exception('Invalid vtl file. Input is not a Path object') if not input.exists():