-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Altera dbt_project * Cria macro `get_models_with_tags` * Insere tags de 'geolocalizacao' * Insere tags de 'identificacao' * Cria modelos de `catalogo` * Insere nova função em `dev/utils.py` * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Atualiza CHANGELOG * Atualiza CHANGELOG * Atualiza model `operadoras.sql` * Atualiza changelog --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
88cf689
commit f13d72d
Showing
23 changed files
with
172 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* https://discourse.getdbt.com/t/get-all-dbt-table-model-names-from-a-tag-inside-another-model/7703 (modificado) */ | ||
{% macro get_models_with_tags(tags) %} | ||
|
||
{% set models_with_tag = [] %} | ||
|
||
{% for model in graph.nodes.values() | selectattr("resource_type", "equalto", "model") %} | ||
|
||
{% for tag in tags %} | ||
{% if tag in model.config.tags %} | ||
{{ models_with_tag.append(model) }} | ||
{% endif %} | ||
{% endfor %} | ||
|
||
{% endfor %} | ||
|
||
{{ return(models_with_tag) }} | ||
|
||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
"data_type":"date", | ||
"granularity": "day" | ||
}, | ||
tags=['geolocalizacao'] | ||
) | ||
}} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
"data_type":"date", | ||
"granularity": "day" | ||
}, | ||
tags=['geolocalizacao'] | ||
) | ||
}} | ||
|
||
|
1 change: 1 addition & 0 deletions
1
queries/models/br_rj_riodejaneiro_bilhetagem_staging/staging_cliente.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{{ | ||
config( | ||
alias='cliente', | ||
tags=['identificacao'] | ||
) | ||
}} | ||
|
||
|
5 changes: 5 additions & 0 deletions
5
queries/models/br_rj_riodejaneiro_onibus_gps_zirix/CHANGELOG.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Changelog - br_rj_riodejaneiro_veiculos | ||
|
||
## [1.0.1] - 2024-08-02 | ||
|
||
### Alterado | ||
- Adiciona tag `geolocalizacao` aos modelos `gps_brt.sql` e `gps_sppo.sql` (https://github.com/prefeitura-rio/pipelines_rj_smtr/pull/127) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
'field': 'data', | ||
'data_type': 'date', | ||
'granularity': 'day' | ||
} | ||
}, | ||
tags=['geolocalizacao'] | ||
) | ||
}} | ||
/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
'field':"data", | ||
'data_type':'date', | ||
'granularity': 'day' | ||
} | ||
}, | ||
tags=['geolocalizacao'] | ||
) | ||
}} | ||
/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{{ | ||
config( | ||
materialized="table" | ||
materialized="table", | ||
tags=["identificacao"] | ||
) | ||
}} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{{ | ||
config( | ||
materialized='table' | ||
) | ||
materialized='table', | ||
tags=['geolocalizacao'] | ||
), | ||
}} | ||
|
||
SELECT | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% if execute %} | ||
{% set models_with_tag = get_models_with_tags(["geolocalizacao", "identificacao"]) %} | ||
{% do log("Models: \n", info=true) %} | ||
{% for model in models_with_tag %} | ||
{% do log(model.schema~"."~model.alias~"\n", info=true) %} | ||
{% endfor %} | ||
{% endif %} | ||
|
||
SELECT | ||
* | ||
FROM | ||
{{ ref("metadado_coluna") }} | ||
WHERE | ||
{% for model in models_with_tag %} | ||
{% if not loop.first %}OR {% endif %}(dataset_id = "{{ model.schema }}" | ||
AND table_id = "{{ model.alias }}") | ||
{% endfor %} | ||
|
||
OR (dataset_id = "br_rj_riodejaneiro_stpl_gps" | ||
AND table_id = "registros") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
SELECT | ||
table_catalog AS project_id, | ||
table_schema AS dataset_id, | ||
table_name AS table_id, | ||
column_name, | ||
data_type, | ||
description | ||
FROM | ||
rj-smtr.`region-US`.INFORMATION_SCHEMA.COLUMN_FIELD_PATHS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: ed_metadado_coluna | ||
description: "Catálogo de dados de geolocalização e identificação do data lake da SMTR destinados ao Escritório de Dados (GP/ED)" | ||
columns: | ||
- name: project_id | ||
description: "{{ doc('project_id') }}" | ||
- name: dataset_id | ||
description: "{{ doc('dataset_id') }}" | ||
- name: table_id | ||
description: "{{ doc('table_id') }}" | ||
- name: column_name | ||
description: "{{ doc('column_name') }}" | ||
- name: data_type | ||
description: "{{ doc('data_type') }}" | ||
- name: description | ||
description: "{{ doc('metadado_descricao') }}" | ||
- name: metadado_coluna | ||
description: "Catálogo de dados do data lake da SMTR" | ||
columns: | ||
- name: project_id | ||
description: "{{ doc('project_id') }}" | ||
- name: dataset_id | ||
description: "{{ doc('dataset_id') }}" | ||
- name: table_id | ||
description: "{{ doc('table_id') }}" | ||
- name: column_name | ||
description: "{{ doc('column_name') }}" | ||
- name: data_type | ||
description: "{{ doc('data_type') }}" | ||
- name: description | ||
description: "{{ doc('metadado_descricao') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,27 @@ | ||
{% docs consorcio %} | ||
Consórcio ao qual o serviço pertence | ||
{% enddocs %} | ||
{% enddocs %} | ||
|
||
{% docs project_id %} | ||
Nome do projeto (rj-smtr) | ||
{% enddocs %} | ||
|
||
{% docs dataset_id %} | ||
Nome do conjunto de dados | ||
{% enddocs %} | ||
|
||
{% docs table_id %} | ||
Nome da tabela | ||
{% enddocs %} | ||
|
||
{% docs column_name %} | ||
Nome da coluna | ||
{% enddocs %} | ||
|
||
{% docs data_type %} | ||
Tipo de dado da coluna | ||
{% enddocs %} | ||
|
||
{% docs metadado_descricao %} | ||
Descrição da coluna | ||
{% enddocs %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters