From 58c568accc8c7588eaafc418467f40bbf8ed0b95 Mon Sep 17 00:00:00 2001 From: d116626 Date: Fri, 20 Sep 2024 15:57:22 -0300 Subject: [PATCH 1/5] feat: add models to integrate ergon with sms for auth --- queries/dbt_project.yml | 5 +- .../funcionarios_ativos.sql | 109 ++++++++++++++++++ .../funcionarios_ergon_sms.sql | 59 ++++++++++ 3 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 queries/models/recursos_humanos_ergon_saude/funcionarios_ativos.sql create mode 100644 queries/models/recursos_humanos_ergon_saude/funcionarios_ergon_sms.sql diff --git a/queries/dbt_project.yml b/queries/dbt_project.yml index 4117865..a76c514 100644 --- a/queries/dbt_project.yml +++ b/queries/dbt_project.yml @@ -53,4 +53,7 @@ models: +schema: recursos_humanos_ergon_pericia_medica porte_empresa: +materialized: table - +schema: porte_empresa \ No newline at end of file + +schema: porte_empresa + recursos_humanos_ergon_saude + +materialized: table + +schema: recursos_humanos_ergon_saude \ No newline at end of file diff --git a/queries/models/recursos_humanos_ergon_saude/funcionarios_ativos.sql b/queries/models/recursos_humanos_ergon_saude/funcionarios_ativos.sql new file mode 100644 index 0000000..6ddf9c4 --- /dev/null +++ b/queries/models/recursos_humanos_ergon_saude/funcionarios_ativos.sql @@ -0,0 +1,109 @@ +WITH funcionarios AS ( + SELECT + f.id_vinculo AS id_funcionario, + LPAD(f.id_cpf, 11, '0') AS cpf, -- Adiciona zero à esquerda caso o CPF tenha menos de 11 dígitos + f.nome + FROM `rj-smfp.recursos_humanos_ergon.funcionario` f + -- WHERE LPAD(f.id_cpf, 11, '0') = '' +), + +provimento AS ( + SELECT + p.id_funcionario, + p.id_vinculo, + p.data_inicio AS provimento_inicio, + p.data_fim AS provimento_fim, + p.id_setor, + p.id_cargo, + p.empresa_vinculo AS id_empresa + FROM `rj-smfp.recursos_humanos_ergon.provimento` p + -- QUALIFY ROW_NUMBER() OVER (PARTITION BY id_funcionario ORDER BY id_vinculo DESC, data_inicio DESC) = 1 +), + +setor AS ( + SELECT + id_setor, + data_inicio AS setor_inicio, + data_fim AS setor_fim, + id_setor_pai, + nome AS setor_nome, + sigla AS setor_sigla, + id_secretaria -- SAUDE 1800 (consultar SICI) + FROM `rj-smfp.recursos_humanos_ergon.setor` + -- WHERE data_fim IS NULL + QUALIFY ROW_NUMBER() OVER (PARTITION BY id_setor ORDER BY data_inicio DESC) = 1 +), + +cargo AS ( + SELECT + id_cargo, + nome AS cargo_nome, + categoria AS cargo_categoria, + subcategoria AS cargo_subcategoria + FROM `rj-smfp.recursos_humanos_ergon.cargo` + -- WHERE data_fim IS NULL +), + +vacancia_vinculo AS ( + SELECT + id_funcionario, + id_vinculo, + data_vacancia + FROM `rj-smfp.recursos_humanos_ergon.vinculo` + QUALIFY ROW_NUMBER() OVER (PARTITION BY id_funcionario ORDER BY id_vinculo DESC) = 1 +), + +empresa AS ( + SELECT + id_empresa, + nome_empresa AS empresa_nome, + sigla AS empresa_sigla + FROM `rj-smfp.recursos_humanos_ergon.empresas` +), + +funcionarios_saude AS ( + SELECT + f.cpf, + f.nome, + CASE + WHEN (p.provimento_fim IS NULL) AND (vv.data_vacancia IS NULL) THEN TRUE + ELSE FALSE + END AS status_ativo, + p.provimento_inicio, + p.provimento_fim, + vv.data_vacancia, + s.id_secretaria, + p.id_empresa, + s.setor_nome, + s.setor_sigla, + s.setor_inicio, + s.setor_fim, + c.cargo_nome, + c.cargo_categoria, + c.cargo_subcategoria, + emp.empresa_nome, + emp.empresa_sigla + FROM funcionarios f + LEFT JOIN provimento p + ON f.id_funcionario = p.id_funcionario + LEFT JOIN setor s + ON p.id_setor = s.id_setor + LEFT JOIN cargo c + ON p.id_cargo = c.id_cargo + LEFT JOIN vacancia_vinculo vv + ON f.id_funcionario = vv.id_funcionario + AND p.id_vinculo = vv.id_vinculo + LEFT JOIN empresa emp + ON p.id_empresa = emp.id_empresa + WHERE + -- (p.provimento_fim IS NULL) + -- AND (vv.data_vacancia IS NULL) AND + ( + s.id_secretaria = '1800' + OR p.id_empresa IN ('32','80','81','82','83','84','85','86','87','88','89','90','92','95','97') + ) +) + + +SELECT * FROM funcionarios_saude +WHERE status_ativo \ No newline at end of file diff --git a/queries/models/recursos_humanos_ergon_saude/funcionarios_ergon_sms.sql b/queries/models/recursos_humanos_ergon_saude/funcionarios_ergon_sms.sql new file mode 100644 index 0000000..6cb85a1 --- /dev/null +++ b/queries/models/recursos_humanos_ergon_saude/funcionarios_ergon_sms.sql @@ -0,0 +1,59 @@ +WITH all_cpf AS ( + SELECT + DISTINCT + cpf + FROM ( + SELECT + cpf, + 'sms' AS origin + FROM `rj-sms.saude_dados_mestres.profissional_saude` + WHERE cpf IS NOT NULL + UNION ALL + SELECT + cpf, + 'ergon' AS origin + FROM `rj-smfp.recursos_humanos_ergon_saude.funcionarios_ativos` + WHERE cpf IS NOT NULL + ) +), + +funcionarios AS ( + SELECT + cpf.cpf, + ps.cpf AS cpf_sms, + ps.nome AS nome_sms, + fa.cpf AS cpf_ergon, + fa.nome AS nome_ergon + FROM all_cpf cpf + LEFT JOIN `rj-sms.saude_dados_mestres.profissional_saude` ps + ON cpf.cpf = ps.cpf + LEFT JOIN `rj-smfp.recursos_humanos_ergon_saude.funcionarios_ativos` fa + ON cpf.cpf = fa.cpf +), + +funcionarios_check AS ( + SELECT + cpf, + cpf_sms, + cpf_ergon, + nome_sms, + nome_ergon, + CASE + WHEN cpf_sms IS NOT NULL AND cpf_ergon IS NOT NULL THEN 'both' + WHEN cpf_sms IS NOT NULL THEN 'sms' + WHEN cpf_ergon IS NOT NULL THEN 'ergon' + ELSE 'none' + END AS check + FROM funcionarios +) + + +-- SELECT * +-- FROM funcionarios_check + +SELECT + check, + COUNT(*) AS count +FROM funcionarios_check +GROUP BY 1 +ORDER BY 2 \ No newline at end of file From 932d170c51a125271492e345b4ef669fde2b14d2 Mon Sep 17 00:00:00 2001 From: d116626 Date: Fri, 4 Oct 2024 12:08:52 -0300 Subject: [PATCH 2/5] chore: add funcionarios_ativos saude to materialization --- pipelines/ergon/__init__.py | 1 + .../materializa_funcionarios_saude/flows.py | 42 +++++ .../schedules.py | 28 +++ pipelines/templates/run_dbt_model/flows.py | 2 +- queries/dbt_project.yml | 2 +- .../funcionarios_ativos.sql | 169 ++++++++++-------- .../funcionarios_ergon_sms.sql | 25 ++- 7 files changed, 193 insertions(+), 76 deletions(-) create mode 100644 pipelines/ergon/materializa_funcionarios_saude/flows.py create mode 100644 pipelines/ergon/materializa_funcionarios_saude/schedules.py diff --git a/pipelines/ergon/__init__.py b/pipelines/ergon/__init__.py index 4596fd1..4f6de39 100644 --- a/pipelines/ergon/__init__.py +++ b/pipelines/ergon/__init__.py @@ -2,3 +2,4 @@ ## from pipelines.ergon.dump_db_ergon.flows import * # noqa from pipelines.ergon.dump_db_ergon_pericia_medica.flows import * # noqa +from pipelines.ergon.materializa_funcionarios_saude.flows import * # noqa diff --git a/pipelines/ergon/materializa_funcionarios_saude/flows.py b/pipelines/ergon/materializa_funcionarios_saude/flows.py new file mode 100644 index 0000000..8702df9 --- /dev/null +++ b/pipelines/ergon/materializa_funcionarios_saude/flows.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +""" +DBT-related flows for EGPWeb Dashboard de Metas +""" + +from copy import deepcopy + +from prefect.run_configs import KubernetesRun +from prefect.storage import GCS +from prefeitura_rio.pipelines_templates.run_dbt_model.flows import ( + templates__run_dbt_model__flow, +) +from prefeitura_rio.pipelines_utils.prefect import set_default_parameters +from prefeitura_rio.pipelines_utils.state_handlers import ( + handler_initialize_sentry, + handler_inject_bd_credentials, +) + +from pipelines.constants import constants +from pipelines.ergon.materializa_funcionarios_saude.schedules import ( + smfp_funcionarios_saude_daily_update_schedule, +) + +run_dbt_smfp_funcionarios_saude = deepcopy(templates__run_dbt_model__flow) +run_dbt_smfp_funcionarios_saude.name = "SMFP: Ergon Funcionarios Ativos SMS - Materializar tabelas" +run_dbt_smfp_funcionarios_saude.state_handlers = [ + handler_inject_bd_credentials, + handler_initialize_sentry, +] +run_dbt_smfp_funcionarios_saude.storage = GCS(constants.GCS_FLOWS_BUCKET.value) +run_dbt_smfp_funcionarios_saude.run_config = KubernetesRun(image=constants.DOCKER_IMAGE.value) + +smfp_funcionarios_saude_default_parameters = { + "dataset_id": "recursos_humanos_ergon_saude", + "table_id": "funcionarios_ativos", +} +run_dbt_smfp_funcionarios_saude = set_default_parameters( + run_dbt_smfp_funcionarios_saude, + default_parameters=smfp_funcionarios_saude_default_parameters, +) + +run_dbt_smfp_funcionarios_saude.schedule = smfp_funcionarios_saude_daily_update_schedule diff --git a/pipelines/ergon/materializa_funcionarios_saude/schedules.py b/pipelines/ergon/materializa_funcionarios_saude/schedules.py new file mode 100644 index 0000000..583e62f --- /dev/null +++ b/pipelines/ergon/materializa_funcionarios_saude/schedules.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +""" +Schedules for the database dump pipeline +""" + +from datetime import datetime, timedelta + +import pytz +from prefect.schedules import Schedule +from prefect.schedules.clocks import IntervalClock +from prefeitura_rio.pipelines_utils.io import untuple_clocks as untuple + +from pipelines.constants import constants + +smfp_funcionarios_saude_clocks = IntervalClock( + interval=timedelta(days=1), + start_date=datetime(2021, 11, 23, 14, 0, tzinfo=pytz.timezone("America/Sao_Paulo")), + labels=[ + constants.RJ_SMFP_AGENT_LABEL.value, + ], + parameter_defaults={ + "dataset_id": "recursos_humanos_ergon_saude", + "table_id": "funcionarios_ativos", + }, +) +smfp_funcionarios_saude_daily_update_schedule = Schedule( + clocks=untuple(smfp_funcionarios_saude_clocks) +) diff --git a/pipelines/templates/run_dbt_model/flows.py b/pipelines/templates/run_dbt_model/flows.py index 80093ab..c54e77f 100644 --- a/pipelines/templates/run_dbt_model/flows.py +++ b/pipelines/templates/run_dbt_model/flows.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -MATERIALIZA MODELOS DO DBT...... +MATERIALIZA MODELOS DO DBT....... """ from copy import deepcopy diff --git a/queries/dbt_project.yml b/queries/dbt_project.yml index a76c514..5078dc1 100644 --- a/queries/dbt_project.yml +++ b/queries/dbt_project.yml @@ -54,6 +54,6 @@ models: porte_empresa: +materialized: table +schema: porte_empresa - recursos_humanos_ergon_saude + recursos_humanos_ergon_saude: +materialized: table +schema: recursos_humanos_ergon_saude \ No newline at end of file diff --git a/queries/models/recursos_humanos_ergon_saude/funcionarios_ativos.sql b/queries/models/recursos_humanos_ergon_saude/funcionarios_ativos.sql index 6ddf9c4..852473d 100644 --- a/queries/models/recursos_humanos_ergon_saude/funcionarios_ativos.sql +++ b/queries/models/recursos_humanos_ergon_saude/funcionarios_ativos.sql @@ -1,47 +1,60 @@ + +{{ + config( + materialized="table", + partition_by={ + "field": "cpf_particao", + "data_type": "int64", + "range": {"start": 0, "end": 100000000000, "interval": 34722222}, + }, + ) +}} + + WITH funcionarios AS ( - SELECT - f.id_vinculo AS id_funcionario, - LPAD(f.id_cpf, 11, '0') AS cpf, -- Adiciona zero à esquerda caso o CPF tenha menos de 11 dígitos - f.nome - FROM `rj-smfp.recursos_humanos_ergon.funcionario` f - -- WHERE LPAD(f.id_cpf, 11, '0') = '' + SELECT + f.id_vinculo AS id_funcionario, + LPAD(f.id_cpf, 11, '0') AS cpf, -- Adiciona zero à esquerda caso o CPF tenha menos de 11 dígitos + f.nome + FROM `rj-smfp.recursos_humanos_ergon.funcionario` f + -- WHERE LPAD(f.id_cpf, 11, '0') = '' ), provimento AS ( - SELECT - p.id_funcionario, - p.id_vinculo, - p.data_inicio AS provimento_inicio, - p.data_fim AS provimento_fim, - p.id_setor, - p.id_cargo, - p.empresa_vinculo AS id_empresa - FROM `rj-smfp.recursos_humanos_ergon.provimento` p - -- QUALIFY ROW_NUMBER() OVER (PARTITION BY id_funcionario ORDER BY id_vinculo DESC, data_inicio DESC) = 1 + SELECT + p.id_funcionario, + p.id_vinculo, + p.data_inicio AS provimento_inicio, + p.data_fim AS provimento_fim, + p.id_setor, + p.id_cargo, + p.empresa_vinculo AS id_empresa + FROM `rj-smfp.recursos_humanos_ergon.provimento` p + -- QUALIFY ROW_NUMBER() OVER (PARTITION BY id_funcionario ORDER BY id_vinculo DESC, data_inicio DESC) = 1 ), setor AS ( - SELECT - id_setor, - data_inicio AS setor_inicio, - data_fim AS setor_fim, - id_setor_pai, - nome AS setor_nome, - sigla AS setor_sigla, - id_secretaria -- SAUDE 1800 (consultar SICI) - FROM `rj-smfp.recursos_humanos_ergon.setor` - -- WHERE data_fim IS NULL - QUALIFY ROW_NUMBER() OVER (PARTITION BY id_setor ORDER BY data_inicio DESC) = 1 + SELECT + id_setor, + data_inicio AS setor_inicio, + data_fim AS setor_fim, + id_setor_pai, + nome AS setor_nome, + sigla AS setor_sigla, + id_secretaria -- SAUDE 1800 (consultar SICI) + FROM `rj-smfp.recursos_humanos_ergon.setor` + -- WHERE data_fim IS NULL + QUALIFY ROW_NUMBER() OVER (PARTITION BY id_setor ORDER BY data_inicio DESC) = 1 ), cargo AS ( - SELECT - id_cargo, - nome AS cargo_nome, - categoria AS cargo_categoria, - subcategoria AS cargo_subcategoria - FROM `rj-smfp.recursos_humanos_ergon.cargo` - -- WHERE data_fim IS NULL + SELECT + id_cargo, + nome AS cargo_nome, + categoria AS cargo_categoria, + subcategoria AS cargo_subcategoria, + FROM `rj-smfp.recursos_humanos_ergon.cargo` + -- WHERE data_fim IS NULL ), vacancia_vinculo AS ( @@ -57,53 +70,67 @@ empresa AS ( SELECT id_empresa, nome_empresa AS empresa_nome, - sigla AS empresa_sigla + sigla AS empresa_sigla, + CNPJ AS empresa_cnpj FROM `rj-smfp.recursos_humanos_ergon.empresas` ), -funcionarios_saude AS ( + +secretaria AS ( SELECT - f.cpf, - f.nome, - CASE - WHEN (p.provimento_fim IS NULL) AND (vv.data_vacancia IS NULL) THEN TRUE - ELSE FALSE - END AS status_ativo, - p.provimento_inicio, - p.provimento_fim, - vv.data_vacancia, - s.id_secretaria, - p.id_empresa, - s.setor_nome, - s.setor_sigla, - s.setor_inicio, - s.setor_fim, - c.cargo_nome, - c.cargo_categoria, - c.cargo_subcategoria, - emp.empresa_nome, - emp.empresa_sigla + id_unidade_administrativa AS id_secretaria, + sigla_unidade_administrativa AS secretaria_sigla, + nome_unidade_administrativa AS secretaria_nome + FROM `rj-iplanrio.unidades_administrativas.orgaos` +), + +funcionarios_saude AS ( + SELECT + f.cpf, + f.nome, + CASE + WHEN (p.provimento_fim IS NULL) AND (vv.data_vacancia IS NULL) THEN TRUE + ELSE FALSE + END AS status_ativo, + p.provimento_inicio, + p.provimento_fim, + vv.data_vacancia, + s.id_secretaria, + sec.secretaria_sigla, + sec.secretaria_nome, + p.id_empresa, + s.setor_nome, + s.setor_sigla, + s.setor_inicio, + s.setor_fim, + c.cargo_nome, + c.cargo_categoria, + c.cargo_subcategoria, + emp.empresa_nome, + emp.empresa_sigla, + emp.empresa_cnpj, + SAFE_CAST(f.cpf AS INT64) AS cpf_particao FROM funcionarios f LEFT JOIN provimento p - ON f.id_funcionario = p.id_funcionario + ON f.id_funcionario = p.id_funcionario LEFT JOIN setor s - ON p.id_setor = s.id_setor + ON p.id_setor = s.id_setor LEFT JOIN cargo c - ON p.id_cargo = c.id_cargo + ON p.id_cargo = c.id_cargo LEFT JOIN vacancia_vinculo vv - ON f.id_funcionario = vv.id_funcionario - AND p.id_vinculo = vv.id_vinculo + ON f.id_funcionario = vv.id_funcionario + AND p.id_vinculo = vv.id_vinculo LEFT JOIN empresa emp - ON p.id_empresa = emp.id_empresa - WHERE - -- (p.provimento_fim IS NULL) - -- AND (vv.data_vacancia IS NULL) AND - ( - s.id_secretaria = '1800' - OR p.id_empresa IN ('32','80','81','82','83','84','85','86','87','88','89','90','92','95','97') - ) -) + ON p.id_empresa = emp.id_empresa + LEFT JOIN secretaria sec + ON s.id_secretaria = sec.id_secretaria + WHERE s.id_secretaria IN ('1800', '1700') + OR p.id_empresa IN ('32','80','81','82','83','84','85','86','87','88','89','97') +) SELECT * FROM funcionarios_saude -WHERE status_ativo \ No newline at end of file +WHERE status_ativo + + + diff --git a/queries/models/recursos_humanos_ergon_saude/funcionarios_ergon_sms.sql b/queries/models/recursos_humanos_ergon_saude/funcionarios_ergon_sms.sql index 6cb85a1..013ee03 100644 --- a/queries/models/recursos_humanos_ergon_saude/funcionarios_ergon_sms.sql +++ b/queries/models/recursos_humanos_ergon_saude/funcionarios_ergon_sms.sql @@ -23,7 +23,13 @@ funcionarios AS ( ps.cpf AS cpf_sms, ps.nome AS nome_sms, fa.cpf AS cpf_ergon, - fa.nome AS nome_ergon + fa.nome AS nome_ergon, + fa.id_secretaria, + fa.secretaria_nome, + fa.secretaria_sigla, + fa.id_empresa, + fa.empresa_nome, + fa.empresa_sigla FROM all_cpf cpf LEFT JOIN `rj-sms.saude_dados_mestres.profissional_saude` ps ON cpf.cpf = ps.cpf @@ -38,6 +44,12 @@ funcionarios_check AS ( cpf_ergon, nome_sms, nome_ergon, + id_secretaria, + secretaria_nome, + secretaria_sigla, + id_empresa, + empresa_nome, + empresa_sigla, CASE WHEN cpf_sms IS NOT NULL AND cpf_ergon IS NOT NULL THEN 'both' WHEN cpf_sms IS NOT NULL THEN 'sms' @@ -53,7 +65,14 @@ funcionarios_check AS ( SELECT check, + id_secretaria, + secretaria_nome, + secretaria_sigla, + id_empresa, + empresa_nome, + empresa_sigla, COUNT(*) AS count FROM funcionarios_check -GROUP BY 1 -ORDER BY 2 \ No newline at end of file +WHERE check = 'both' +GROUP BY 1,2,3,4,5,6, 7 +ORDER BY 7 \ No newline at end of file From 9cfedacab929efe041c711097da616ef848e4f5f Mon Sep 17 00:00:00 2001 From: d116626 Date: Fri, 4 Oct 2024 12:44:30 -0300 Subject: [PATCH 3/5] chore: add funcionarios_ativos saude to materialization --- .../materializa_funcionarios_saude/flows.py | 2 +- .../schedules.py | 24 ++++++++++--------- pipelines/templates/run_dbt_model/flows.py | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/pipelines/ergon/materializa_funcionarios_saude/flows.py b/pipelines/ergon/materializa_funcionarios_saude/flows.py index 8702df9..b2f8ed9 100644 --- a/pipelines/ergon/materializa_funcionarios_saude/flows.py +++ b/pipelines/ergon/materializa_funcionarios_saude/flows.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -DBT-related flows for EGPWeb Dashboard de Metas +Materialize Active SMS Employees from Ergon """ from copy import deepcopy diff --git a/pipelines/ergon/materializa_funcionarios_saude/schedules.py b/pipelines/ergon/materializa_funcionarios_saude/schedules.py index 583e62f..06bbc05 100644 --- a/pipelines/ergon/materializa_funcionarios_saude/schedules.py +++ b/pipelines/ergon/materializa_funcionarios_saude/schedules.py @@ -12,17 +12,19 @@ from pipelines.constants import constants -smfp_funcionarios_saude_clocks = IntervalClock( - interval=timedelta(days=1), - start_date=datetime(2021, 11, 23, 14, 0, tzinfo=pytz.timezone("America/Sao_Paulo")), - labels=[ - constants.RJ_SMFP_AGENT_LABEL.value, - ], - parameter_defaults={ - "dataset_id": "recursos_humanos_ergon_saude", - "table_id": "funcionarios_ativos", - }, -) +smfp_funcionarios_saude_clocks = [ + IntervalClock( + interval=timedelta(days=1), + start_date=datetime(2021, 11, 23, 14, 0, tzinfo=pytz.timezone("America/Sao_Paulo")), + labels=[ + constants.RJ_SMFP_AGENT_LABEL.value, + ], + parameter_defaults={ + "dataset_id": "recursos_humanos_ergon_saude", + "table_id": "funcionarios_ativos", + }, + ) +] smfp_funcionarios_saude_daily_update_schedule = Schedule( clocks=untuple(smfp_funcionarios_saude_clocks) ) diff --git a/pipelines/templates/run_dbt_model/flows.py b/pipelines/templates/run_dbt_model/flows.py index c54e77f..3f22c2f 100644 --- a/pipelines/templates/run_dbt_model/flows.py +++ b/pipelines/templates/run_dbt_model/flows.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -MATERIALIZA MODELOS DO DBT....... +MATERIALIZA MODELOS DO DBT......... """ from copy import deepcopy From 9ecaf5b324dbce4943a7d42eaacc4cad719f59f6 Mon Sep 17 00:00:00 2001 From: d116626 Date: Fri, 4 Oct 2024 12:51:09 -0300 Subject: [PATCH 4/5] chore: add funcionarios_ativos saude to materialization --- pipelines/ergon/materializa_funcionarios_saude/flows.py | 6 ++++-- pipelines/templates/run_dbt_model/flows.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pipelines/ergon/materializa_funcionarios_saude/flows.py b/pipelines/ergon/materializa_funcionarios_saude/flows.py index b2f8ed9..534db72 100644 --- a/pipelines/ergon/materializa_funcionarios_saude/flows.py +++ b/pipelines/ergon/materializa_funcionarios_saude/flows.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -Materialize Active SMS Employees from Ergon +Materialize Active SMS Employees from Ergon. """ from copy import deepcopy @@ -28,7 +28,9 @@ handler_initialize_sentry, ] run_dbt_smfp_funcionarios_saude.storage = GCS(constants.GCS_FLOWS_BUCKET.value) -run_dbt_smfp_funcionarios_saude.run_config = KubernetesRun(image=constants.DOCKER_IMAGE.value) +run_dbt_smfp_funcionarios_saude.run_config = KubernetesRun( + image=constants.DOCKER_IMAGE.value, labels=[constants.RJ_SMFP_AGENT_LABEL.value] +) smfp_funcionarios_saude_default_parameters = { "dataset_id": "recursos_humanos_ergon_saude", diff --git a/pipelines/templates/run_dbt_model/flows.py b/pipelines/templates/run_dbt_model/flows.py index 3f22c2f..756d8df 100644 --- a/pipelines/templates/run_dbt_model/flows.py +++ b/pipelines/templates/run_dbt_model/flows.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -MATERIALIZA MODELOS DO DBT......... +MATERIALIZA MODELOS DO DBT.......... """ from copy import deepcopy From 3527ff9e9ac2bad004d1abcc04868310346f5d38 Mon Sep 17 00:00:00 2001 From: d116626 Date: Fri, 4 Oct 2024 13:00:06 -0300 Subject: [PATCH 5/5] chore: add funcionarios_ativos saude to materialization --- pipelines/ergon/materializa_funcionarios_saude/schedules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipelines/ergon/materializa_funcionarios_saude/schedules.py b/pipelines/ergon/materializa_funcionarios_saude/schedules.py index 06bbc05..be8a7fb 100644 --- a/pipelines/ergon/materializa_funcionarios_saude/schedules.py +++ b/pipelines/ergon/materializa_funcionarios_saude/schedules.py @@ -15,7 +15,7 @@ smfp_funcionarios_saude_clocks = [ IntervalClock( interval=timedelta(days=1), - start_date=datetime(2021, 11, 23, 14, 0, tzinfo=pytz.timezone("America/Sao_Paulo")), + start_date=datetime(2021, 11, 23, 1, 0, tzinfo=pytz.timezone("America/Sao_Paulo")), labels=[ constants.RJ_SMFP_AGENT_LABEL.value, ],