Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcom-tp-etl-transformation-pipelines
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
general
bcom-tp-etl-transformation-pipelines
Commits
a9cd887b
Commit
a9cd887b
authored
Aug 08, 2023
by
Erly Villaroel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modificacion del archivo Generation.py
parent
0b05fe09
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
2 deletions
+50
-2
Generation.py
dags/components/Generation.py
+15
-1
procedure_prueba.json
dags/procedure_prueba.json
+35
-1
No files found.
dags/components/Generation.py
View file @
a9cd887b
...
@@ -134,6 +134,16 @@ def get_generate_from_xcom(**kwargs):
...
@@ -134,6 +134,16 @@ def get_generate_from_xcom(**kwargs):
final_outputs
=
[]
final_outputs
=
[]
conf
=
task
.
xcom_pull
(
task_ids
=
"VALIDATE_TRANSFORMATION"
,
key
=
"CONTROL-CONFIG"
)
conf
=
task
.
xcom_pull
(
task_ids
=
"VALIDATE_TRANSFORMATION"
,
key
=
"CONTROL-CONFIG"
)
tasks
=
get_tasks_from_control
(
conf
,
"generator"
)
tasks
=
get_tasks_from_control
(
conf
,
"generator"
)
tasks_with_save
=
[]
definition
=
task
.
xcom_pull
(
task_ids
=
"SCRIPTS-EXTRACTOR"
,
key
=
"EXTRACTION-DEFINITION-JSON"
)
#LOGICA - TABLAS QUE SI TIENEN EL PARAMETRO SAVE_OUTPUT
for
i
in
range
(
len
(
definition
)):
if
definition
[
i
][
"save_output"
]
==
True
:
tasks_with_save
.
append
(
definition
[
i
][
"identifier"
])
#print(tasks_with_save)
success_tasks
=
tasks
[
"tasks"
]
success_tasks
=
tasks
[
"tasks"
]
success_tasks
=
[
item
[
1
]
for
item
in
success_tasks
]
success_tasks
=
[
item
[
1
]
for
item
in
success_tasks
]
logger
.
info
(
f
"GENERADORES QUE FUERON EXITOSOS (TABLAS): {success_tasks}"
)
logger
.
info
(
f
"GENERADORES QUE FUERON EXITOSOS (TABLAS): {success_tasks}"
)
...
@@ -143,10 +153,14 @@ def get_generate_from_xcom(**kwargs):
...
@@ -143,10 +153,14 @@ def get_generate_from_xcom(**kwargs):
if
not
key
.
startswith
(
OperationTypeEnum
.
SELECT
.
value
)
and
not
key
.
startswith
(
OperationTypeEnum
.
PROCEDURE
.
value
):
if
not
key
.
startswith
(
OperationTypeEnum
.
SELECT
.
value
)
and
not
key
.
startswith
(
OperationTypeEnum
.
PROCEDURE
.
value
):
continue
continue
xcom_outputs
=
task
.
xcom_pull
(
task_ids
=
"SCRIPTS-EXTRACTOR"
,
key
=
key
)
xcom_outputs
=
task
.
xcom_pull
(
task_ids
=
"SCRIPTS-EXTRACTOR"
,
key
=
key
)
logger
.
info
(
f
"Trayendo tablas {xcom_outputs}"
)
logger
.
info
(
f
"Trayendo tablas {xcom_outputs}"
)
for
select
in
xcom_outputs
:
for
select
in
xcom_outputs
:
if
tasks
[
"reset"
]
or
tasks
[
"status"
]
==
ProcessStatusEnum
.
SUCCESS
.
value
or
select
not
in
success_tasks
:
tablename
=
select_multiple
(
select
)[
"tablename"
]
#print("IMPRIMIR", tablename)
if
(
tasks
[
"reset"
]
or
tasks
[
"status"
]
==
ProcessStatusEnum
.
SUCCESS
.
value
or
select
not
in
success_tasks
)
and
tablename
in
tasks_with_save
:
final_outputs
.
append
(
select
)
final_outputs
.
append
(
select
)
#print(final_outputs)
logger
.
info
(
f
"Final outputs: {final_outputs}"
)
logger
.
info
(
f
"Final outputs: {final_outputs}"
)
Variable
.
set
(
key
=
'GENERATES'
,
value
=
final_outputs
,
serialize_json
=
True
)
Variable
.
set
(
key
=
'GENERATES'
,
value
=
final_outputs
,
serialize_json
=
True
)
if
len
(
final_outputs
)
>
0
:
if
len
(
final_outputs
)
>
0
:
...
...
dags/procedure_prueba.json
View file @
a9cd887b
[
[
{
{
"identifier"
:
"ESTUDIANTES"
,
"identifier"
:
"ESTUDIANTES_11"
,
"fields"
:
[
{
"name"
:
"ID"
,
"datatype"
:
"NUMBER"
,
"decimal_precision"
:
0
},
{
"name"
:
"Nombre"
,
"datatype"
:
"TEXT"
,
"maxLength"
:
50
},
{
"name"
:
"Apellido"
,
"datatype"
:
"TEXT"
,
"maxLength"
:
50
},
{
"name"
:
"Edad"
,
"datatype"
:
"NUMBER"
,
"decimal_precision"
:
0
},
{
"name"
:
"CorreoElectronico"
,
"datatype"
:
"TEXT"
,
"maxLength"
:
100
}
],
"indexes"
:
[
"ID"
],
"save_output"
:
true
},
{
"identifier"
:
"ESTUDIANTES_1"
,
"fields"
:
[
"fields"
:
[
{
{
"name"
:
"ID"
,
"name"
:
"ID"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment