-
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.
Revert "new: update seeds new plants (makassar, valteina and fontivso…
…lar) (et/somenergia-jardiner!26)" This reverts commit b416d3a
- Loading branch information
1 parent
b416d3a
commit 3be1953
Showing
26 changed files
with
833 additions
and
234 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,11 +1,13 @@ | ||
[sqlfluff] | ||
exclude_rules = layout.indent, layout.cte_bracket, layout.select_targets, LT05 | ||
exclude_rules = layout.indent, layout.cte_bracket, layout.select_targets | ||
# set max_line_length to whatever you set in sqlfmt | ||
max_line_length = 120 | ||
# don't check for line length, let sqlfmt do that | ||
exclude_rules = LT05 | ||
|
||
[sqlfluff:rules] | ||
capitalisation_policy = lower | ||
extended_capitalisation_policy = lower | ||
|
||
[sqlfluff:rules:convention.terminator] | ||
multiline_newline = True | ||
multiline_newline = True |
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
4 changes: 2 additions & 2 deletions
4
...rdiner/models/jardiner/intermediate/dset/int_signal_device_relation__distinct_devices.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,5 +1,5 @@ | ||
{{ config(materialized="table") }} | ||
|
||
select distinct plant, plant_uuid, device, device_uuid, device_type, device_parent | ||
from {{ ref('raw_gestio_actius__signal_denormalized') }} | ||
select distinct plant, device, device_uuid, device_type, device_parent | ||
from {{ ref("seed_signals__with_devices") }} | ||
order by plant, device |
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
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
53 changes: 2 additions & 51 deletions
53
dbt_jardiner/models/jardiner/raw/gestio_actius/_raw_gestio_actius__models.yaml
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,57 +1,8 @@ | ||
version: 2 | ||
|
||
models: | ||
|
||
- name: raw_gestio_actius_production_target | ||
description: > | ||
Conté la taula incremental que es crea mitjançant el snapshot (al schema lake) | ||
que llegueix la source del drive importada per airbyte (al schema airbyte_imported) | ||
- name: raw_gestio_actius__signals__denormalized | ||
description: > | ||
Taula amb la llista de devices, els seus uuids i si tenen un parent. | ||
Conté la relació entre signal_description de l'API de DSET (un UUID | ||
imputat per nosaltres en el document de maping que se'ls envia) amb un device_uuid | ||
també imputat per nosaltres que es correspon amb la columna homònima de la taula | ||
d'aparell que correspongui ja sigui inverter, string, sensor, plant, etc. | ||
Aquesta taula equival al 'seed' data/seed_signals__with_devices.csv que es carrega | ||
a la taula utilitzant l'script scripts/file_to_sql.py. | ||
Exemple del maping enviat per [Llanillos](https://docs.google.com/spreadsheets/d/1op_WHvGZNyDdkBD7EOXK-CPU5-aGjK3r/edit#gid=629299947) | ||
columns: | ||
- name: signal_id | ||
description: id intern de la db | ||
- name: plant_uuid | ||
description: uuid4 de la planta | ||
- name: plant | ||
description: nom de la planta | ||
- name: signal | ||
description: nom del senyal | ||
- name: metric | ||
description: nom de la metrica | ||
- name: device | ||
description: nom del device | ||
- name: device_type | ||
description: tipus de device | ||
tests: | ||
- accepted_values: | ||
values: | ||
["meter", "inverter", "sensor", "plant", "string", "module"] | ||
- name: device_parent | ||
description: device parent del device. e.g. un string té l'inversor1 com a pare | ||
- name: signal_uuid | ||
description: | ||
UUID del senyal present a la columns signal_UUID del maping. Es assignada manualment amb | ||
cada nou mapeig de GA. | ||
tests: | ||
- unique | ||
- name: device_uuid | ||
description: | ||
Imputat per nosaltres que es correspon amb la columna homònima de la | ||
taula d'aparell que correspongui ja sigui inverter, string, sensor, plant, etc. | ||
tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
config: | ||
severity: error | ||
combination_of_columns: | ||
- plant_uuid | ||
- device_uuid | ||
- signal_uuid | ||
que llegueix la source del drive importada per airbyte (al schema airbyte_imported) |
20 changes: 0 additions & 20 deletions
20
dbt_jardiner/models/jardiner/raw/gestio_actius/raw_gestio_actius__signal_denormalized.sql
This file was deleted.
Oops, something went wrong.
61 changes: 30 additions & 31 deletions
61
dbt_jardiner/models/jardiner/raw/gestio_actius/raw_gestio_actius_plant_parameters.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,35 +1,34 @@ | ||
{{ config(materialized="view") }} | ||
{{ config(materialized='view') }} | ||
|
||
with | ||
current_data as ( | ||
select | ||
plant_id::numeric, | ||
plant_uuid::uuid, | ||
case | ||
when planta = 'Vallehermoso' then 'Alcolea' | ||
when planta = 'Tahal' then 'Terborg' | ||
else planta | ||
end as plant_name, | ||
latitud::numeric as latitude, | ||
longitut::numeric as longitude, | ||
municipi as municipality, | ||
provincia as province, | ||
tecnologia as technology, | ||
data_connexio::date as connection_date, | ||
potencia_nominal_kw::numeric as nominal_power_kw, | ||
potencia_pic_kw::numeric as peak_power_kw, | ||
"owner", | ||
n_strings_plant::numeric, | ||
n_modules_string::numeric, | ||
n_strings_inverter::numeric, | ||
esquema_unifilar, | ||
layout, | ||
data_actualitzacio::date as gestio_actius_updated_at, | ||
dbt_updated_at::date as dbt_updated_at, | ||
dbt_valid_from::date as dbt_valid_from, | ||
coalesce(dbt_valid_to::date, '2050-01-01'::date)::date as dbt_valid_to | ||
from {{ ref("snapshot_plant_parameters") }} as pl | ||
) | ||
with current_data as ( | ||
SELECT | ||
plant_id::numeric, | ||
case | ||
when planta = 'Vallehermoso' then 'Alcolea' | ||
when planta = 'Tahal' then 'Terborg' | ||
else planta | ||
end as plant, | ||
latitud::numeric as latitude, | ||
longitut::numeric as longitude, | ||
municipi as municipality, | ||
provincia as province, | ||
tecnologia as technology, | ||
data_connexio::date as connection_date, | ||
potencia_nominal_kw::numeric as nominal_power_kw, | ||
potencia_pic_kw::numeric as peak_power_kw, | ||
owner, | ||
n_strings_plant::numeric, | ||
n_modules_string::numeric, | ||
n_strings_inverter::numeric, | ||
is_tilted::boolean, | ||
esquema_unifilar, | ||
layout, | ||
data_actualitzacio::date as gestio_actius_updated_at, | ||
dbt_updated_at::date as dbt_updated_at, | ||
dbt_valid_from::date as dbt_valid_from, | ||
coalesce(dbt_valid_to::date, '2050-01-01'::date)::date as dbt_valid_to | ||
FROM {{ ref('snapshot_plant_parameters') }} as pl | ||
) | ||
select * | ||
from current_data | ||
where dbt_valid_from::date <= current_date and current_date < dbt_valid_to::date |
32 changes: 32 additions & 0 deletions
32
dbt_jardiner/models/jardiner/raw/misc/_raw_misc__models.yaml
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,32 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: raw_devices__with_signals | ||
description: > | ||
Taula amb la llista de devices, els seus uuids i si tenen un parent. | ||
columns: | ||
- name: plant | ||
description: nom de la planta | ||
- name: signal | ||
description: nom del senyal | ||
- name: metric | ||
description: nom de la metrica | ||
- name: device | ||
description: nom del device | ||
- name: device_type | ||
description: tipus de device | ||
- name: device_parent | ||
description: uuid del pare de un aparell, si en té | ||
- name: signal_uuid | ||
description: uuid4 del senyal | ||
tests: | ||
- unique | ||
- name: device_uuid | ||
description: uuid4 del device | ||
tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
config: | ||
severity: error | ||
combination_of_columns: | ||
- device_uuid | ||
- signal_uuid |
Oops, something went wrong.