From f8900576343457b30756b4c67d3eadaeb44a0547 Mon Sep 17 00:00:00 2001 From: David Gasquez Date: Tue, 2 Apr 2024 13:52:17 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=A5=85=20add=20groups=20[skip=20c?= =?UTF-8?q?i]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- datadex/assets/huggingface.py | 6 +++++- datadex/assets/indicators.py | 6 +++--- datadex/assets/others.py | 4 ++-- datadex/assets/spain.py | 8 ++++---- dbt/models/country_year_indicators_schema.yml | 9 +++++++++ 5 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 dbt/models/country_year_indicators_schema.yml diff --git a/datadex/assets/huggingface.py b/datadex/assets/huggingface.py index 9d6fc37..301e115 100644 --- a/datadex/assets/huggingface.py +++ b/datadex/assets/huggingface.py @@ -5,7 +5,11 @@ def create_hf_asset(dataset_name: str): - @asset(name="huggingface_" + dataset_name, ins={"data": AssetIn(dataset_name)}) + @asset( + name="huggingface_" + dataset_name, + ins={"data": AssetIn(dataset_name)}, + group_name="huggingface", + ) def hf_asset(data: pd.DataFrame, hf: HuggingFaceResource) -> None: """ Upload data to HuggingFace. diff --git a/datadex/assets/indicators.py b/datadex/assets/indicators.py index 509df78..8388823 100644 --- a/datadex/assets/indicators.py +++ b/datadex/assets/indicators.py @@ -7,7 +7,7 @@ from slugify import slugify -@asset +@asset(group_name="country_indicators") def owid_energy_data() -> pd.DataFrame: """ Raw Energy data from Our World in Data. @@ -18,7 +18,7 @@ def owid_energy_data() -> pd.DataFrame: return pd.read_csv(energy_owid_url) -@asset +@asset(group_name="country_indicators") def owid_co2_data() -> pd.DataFrame: """ Raw CO2 data from Our World in Data. @@ -29,7 +29,7 @@ def owid_co2_data() -> pd.DataFrame: return pd.read_csv(co2_owid_url) -@asset +@asset(group_name="country_indicators") def world_bank_wdi() -> pd.DataFrame: """ World Development Indicators (WDI) is the World Bank's premier compilation of cross-country comparable data on development. diff --git a/datadex/assets/others.py b/datadex/assets/others.py index 27311d5..c26a706 100644 --- a/datadex/assets/others.py +++ b/datadex/assets/others.py @@ -7,7 +7,7 @@ from ..resources import IUCNRedListAPI -@asset +@asset(group_name="others") def threatened_animal_species(iucn_redlist_api: IUCNRedListAPI) -> pd.DataFrame: """ Threatened animal species data from the IUCN Red List API. @@ -27,7 +27,7 @@ def threatened_animal_species(iucn_redlist_api: IUCNRedListAPI) -> pd.DataFrame: ) -@asset +@asset(group_name="others") def wikidata_asteroids() -> pd.DataFrame: """ Wikidata asteroids data. diff --git a/datadex/assets/spain.py b/datadex/assets/spain.py index 90bd0fd..208859a 100644 --- a/datadex/assets/spain.py +++ b/datadex/assets/spain.py @@ -9,7 +9,7 @@ from ..resources import AEMETAPI -@asset +@asset(group_name="spain_open_data") def spain_energy_demand(context: AssetExecutionContext) -> pd.DataFrame: """ Spain energy demand data. @@ -49,7 +49,7 @@ def spain_energy_demand(context: AssetExecutionContext) -> pd.DataFrame: return df -@asset +@asset(group_name="spain_open_data") def spain_ipc() -> pd.DataFrame: """ Spain IPC data from INE. Downloaded from datos.gob.es (https://datos.gob.es/es/apidata). @@ -73,7 +73,7 @@ def spain_ipc() -> pd.DataFrame: return df -@asset +@asset(group_name="spain_open_data") def spain_aemet_stations(aemet_api: AEMETAPI) -> pd.DataFrame: """ Spain AEMET stations data. @@ -84,7 +84,7 @@ def spain_aemet_stations(aemet_api: AEMETAPI) -> pd.DataFrame: return df -@asset +@asset(group_name="spain_open_data") def spain_aemet_weather_data( context: AssetExecutionContext, aemet_api: AEMETAPI ) -> pd.DataFrame: diff --git a/dbt/models/country_year_indicators_schema.yml b/dbt/models/country_year_indicators_schema.yml new file mode 100644 index 0000000..db44318 --- /dev/null +++ b/dbt/models/country_year_indicators_schema.yml @@ -0,0 +1,9 @@ +version: 2 + +models: + - name: country_year_indicators + description: "Country-year indicators" + config: + meta: + dagster: + group: country_indicators