centraal-dataframework 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/PKG-INFO +2 -2
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/__init__.py +1 -1
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/email_sender.py +10 -15
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/resources.py +13 -3
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/pyproject.toml +2 -2
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/LICENSE +0 -0
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/README.md +0 -0
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/blueprints.py +0 -0
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/excepciones.py +0 -0
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/runner.py +0 -0
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/tasks.py +0 -0
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/utils.py +0 -0
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/tests/__init__.py +0 -0
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/tests/test_runner.py +0 -0
- {centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: centraal_dataframework
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Utilidades para interactuar con Azure Datalake.
|
|
5
5
|
Home-page: https://github.com/centraal-api/centraal-dataframework
|
|
6
6
|
License: Apache-2.0
|
|
@@ -18,7 +18,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
18
18
|
Provides-Extra: dev
|
|
19
19
|
Provides-Extra: doc
|
|
20
20
|
Provides-Extra: test
|
|
21
|
-
Requires-Dist: azure-datalake-utils (>=0.5.
|
|
21
|
+
Requires-Dist: azure-datalake-utils (>=0.5.8,<1.0)
|
|
22
22
|
Requires-Dist: azure-functions (>1.0,<2.0)
|
|
23
23
|
Requires-Dist: black (>=22.3.0,<23.0.0) ; extra == "test"
|
|
24
24
|
Requires-Dist: bump2version (>=1.0.1,<2.0.0) ; extra == "dev"
|
{centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/email_sender.py
RENAMED
|
@@ -17,24 +17,19 @@ def send_email_dq(url_logic_app: str, emails: List[str], excepcion: ErrorTareaCa
|
|
|
17
17
|
validation_results = result.list_validation_results(group_by=None)
|
|
18
18
|
error_msj = []
|
|
19
19
|
for res in validation_results:
|
|
20
|
-
error_msj.append(
|
|
21
|
-
",".join(
|
|
22
|
-
[
|
|
23
|
-
item["exception_info"]["exception_message"]
|
|
24
|
-
for item in res.results
|
|
25
|
-
if item["exception_info"]["exception_message"] is not None
|
|
26
|
-
]
|
|
27
|
-
)
|
|
28
|
-
)
|
|
20
|
+
error_msj.append(",".join([f'{item["result"]}' for item in res.results if item["exception_info"] is not None]))
|
|
29
21
|
|
|
30
22
|
error_msj = "<br>".join(error_msj)
|
|
31
23
|
|
|
32
24
|
body = (
|
|
33
|
-
f"Las expectativas {','.join(suites)}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
f"
|
|
37
|
-
f"
|
|
25
|
+
f"Las expectativas {','.join(suites)} <strong>Fallaron</strong>.<br><br>"
|
|
26
|
+
"<b>Detalle del resultado</b>"
|
|
27
|
+
"<ul>"
|
|
28
|
+
f"<li><i>Asset de datos,</i>: {','.join(result.list_data_asset_names())}</li>"
|
|
29
|
+
f"""<li><a href="{excepcion.url_docs}" target="_blank">Detalles de la expectativa</a></li>"""
|
|
30
|
+
f"<li><i>Resultados de Great Expectations</i>: {error_msj}</li>"
|
|
31
|
+
f"<li><i>Detalles tecnicos:</i>{detalles_tecnicos}</li>"
|
|
32
|
+
"</ul>"
|
|
38
33
|
)
|
|
39
34
|
|
|
40
35
|
_send(url_logic_app, emails, subject, body)
|
|
@@ -45,7 +40,7 @@ def send_email_error(url_logic_app: str, emails: List[str], exception: Exception
|
|
|
45
40
|
detalles_tecnicos = ''.join(traceback.TracebackException.from_exception(exception).format())
|
|
46
41
|
subject = f'¡ALERTA! Proceso de datos llamado: {tarea} FALLO'
|
|
47
42
|
# <br> es salto de linea
|
|
48
|
-
body = f"La tarea {tarea}
|
|
43
|
+
body = f"La tarea {tarea} <strong>FALLO</strong>.<br><i>Detalles tecnicos</i>:<br>{detalles_tecnicos}"
|
|
49
44
|
_send(url_logic_app, emails, subject, body)
|
|
50
45
|
|
|
51
46
|
|
{centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/resources.py
RENAMED
|
@@ -105,7 +105,15 @@ class GreatExpectationsToolKit:
|
|
|
105
105
|
self.suite = expectation_suite
|
|
106
106
|
self.check_point = check_point
|
|
107
107
|
|
|
108
|
-
def
|
|
108
|
+
def _get_sas_user_or_default(self, duration: int = None, unit: str = None, ip: str = None) -> Tuple[int, str, str]:
|
|
109
|
+
duration = int(os.environ.get("SAS_VALOR_EXPIRACION", 7)) if duration is None else duration
|
|
110
|
+
unit = os.environ.get("SAS_UNIDAD_EXPIRACION", 'day') if unit is None else unit
|
|
111
|
+
ip = os.environ.get("SAS_IP") if ip is None else ip
|
|
112
|
+
return duration, unit, ip
|
|
113
|
+
|
|
114
|
+
def _get_url(
|
|
115
|
+
self, resource_id, public: bool = False, duration: int = None, unit: str = None, ip: str = None
|
|
116
|
+
) -> str:
|
|
109
117
|
"""Obtiene url de reporte."""
|
|
110
118
|
docs_site_urls_list = self.context.get_docs_sites_urls(resource_identifier=resource_id)
|
|
111
119
|
url = docs_site_urls_list[0]["site_url"]
|
|
@@ -113,8 +121,10 @@ class GreatExpectationsToolKit:
|
|
|
113
121
|
# TODO: el valor de z13.web es un prefijo.¿se deja hardcoded o se necesita personalizacion?
|
|
114
122
|
url = url.replace("blob", "z13.web").replace("$web/", "")
|
|
115
123
|
else:
|
|
116
|
-
_, container_path = url.split(".net")
|
|
117
|
-
|
|
124
|
+
_, container_path = url.split(".net/")
|
|
125
|
+
duration, unit, ip = self._get_sas_user_or_default(duration, unit, ip)
|
|
126
|
+
dl = get_datalake()
|
|
127
|
+
url = dl.generar_url_con_sas_token(container_path, duration, unit, ip)
|
|
118
128
|
return url
|
|
119
129
|
|
|
120
130
|
def run_expectation_file_on_df(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[tool]
|
|
2
2
|
[tool.poetry]
|
|
3
3
|
name = "centraal_dataframework"
|
|
4
|
-
version = "0.1.
|
|
4
|
+
version = "0.1.3"
|
|
5
5
|
homepage = "https://github.com/centraal-api/centraal-dataframework"
|
|
6
6
|
description = "Utilidades para interactuar con Azure Datalake."
|
|
7
7
|
authors = ["centraal.studio <equipo@centraal.studio>"]
|
|
@@ -46,7 +46,7 @@ toml = {version = "^0.10.2", optional = true}
|
|
|
46
46
|
bump2version = {version = "^1.0.1", optional = true}
|
|
47
47
|
jupyter = {version = ">=1.0", optional = true}
|
|
48
48
|
azure-functions = ">1.0,<2.0"
|
|
49
|
-
azure-datalake-utils = ">=0.5.
|
|
49
|
+
azure-datalake-utils = ">=0.5.8,<1.0"
|
|
50
50
|
great-expectations = ">=0.17,<1.0"
|
|
51
51
|
python-dotenv = ">=1.0.0,<2.0"
|
|
52
52
|
|
|
File without changes
|
|
File without changes
|
{centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/blueprints.py
RENAMED
|
File without changes
|
{centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/excepciones.py
RENAMED
|
File without changes
|
{centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/runner.py
RENAMED
|
File without changes
|
{centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/tasks.py
RENAMED
|
File without changes
|
{centraal_dataframework-0.1.2 → centraal_dataframework-0.1.3}/centraal_dataframework/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|