sws-spark-dissemination-helper 0.0.158__tar.gz → 0.0.160__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/PKG-INFO +1 -1
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/pyproject.toml +1 -1
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/src/sws_spark_dissemination_helper/SWSBronzeIcebergSparkHelper.py +1 -1
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/src/sws_spark_dissemination_helper/SWSGoldIcebergSparkHelper.py +51 -2
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/src/sws_spark_dissemination_helper/constants.py +6 -0
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/.gitignore +0 -0
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/LICENSE +0 -0
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/README.md +0 -0
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/src/sws_spark_dissemination_helper/SWSDatatablesExportHelper.py +0 -0
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/src/sws_spark_dissemination_helper/SWSEasyIcebergSparkHelper.py +0 -0
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/src/sws_spark_dissemination_helper/SWSPostgresSparkReader.py +0 -0
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/src/sws_spark_dissemination_helper/SWSSilverIcebergSparkHelper.py +0 -0
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/src/sws_spark_dissemination_helper/__init__.py +0 -0
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/src/sws_spark_dissemination_helper/utils.py +0 -0
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/tests/__init__.py +0 -0
- {sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/tests/test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sws-spark-dissemination-helper
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.160
|
|
4
4
|
Summary: A Python helper package providing streamlined Spark functions for efficient data dissemination processes
|
|
5
5
|
Project-URL: Repository, https://github.com/un-fao/fao-sws-it-python-spark-dissemination-helper
|
|
6
6
|
Author-email: Daniele Mansillo <danielemansillo@gmail.com>
|
|
@@ -687,7 +687,7 @@ class SWSBronzeIcebergSparkHelper:
|
|
|
687
687
|
else:
|
|
688
688
|
self.disseminated_tag_df = self.df_bronze
|
|
689
689
|
|
|
690
|
-
if not from_tag and len(dimensions) != 0:
|
|
690
|
+
if not from_tag and dimensions is not None and len(dimensions) != 0:
|
|
691
691
|
for dimension_name, codes in dimensions.items():
|
|
692
692
|
logging.info(f"dimension_name: {dimension_name}")
|
|
693
693
|
logging.info(f"codes: {codes}")
|
|
@@ -496,8 +496,8 @@ class SWSGoldIcebergSparkHelper:
|
|
|
496
496
|
logging.debug(f"Tag with Added Iceberg Table: {tag}")
|
|
497
497
|
|
|
498
498
|
new_diss_table = BaseDisseminatedTagTable(
|
|
499
|
-
id=f"{self.domain_code.lower()}
|
|
500
|
-
name=f"{self.domain_code} gold
|
|
499
|
+
id=f"{self.domain_code.lower()}_gold_sws_csv",
|
|
500
|
+
name=f"{self.domain_code} gold SWS csv",
|
|
501
501
|
description="Gold table containing the tag data without any processing cached in csv",
|
|
502
502
|
layer=TableLayer.GOLD,
|
|
503
503
|
private=True,
|
|
@@ -515,3 +515,52 @@ class SWSGoldIcebergSparkHelper:
|
|
|
515
515
|
logging.debug(f"Tag with Added csv Table: {tag}")
|
|
516
516
|
|
|
517
517
|
return df
|
|
518
|
+
|
|
519
|
+
def write_gold_faostat_dissemination_tag(
|
|
520
|
+
self, df: DataFrame, tags: Tags
|
|
521
|
+
) -> DataFrame:
|
|
522
|
+
# Get or create a new tag
|
|
523
|
+
tag = get_or_create_tag(tags, self.dataset_id, self.tag_name, self.tag_name)
|
|
524
|
+
logging.debug(f"Tag: {tag}")
|
|
525
|
+
|
|
526
|
+
new_iceberg_table = BaseDisseminatedTagTable(
|
|
527
|
+
id=f"{self.domain_code.lower()}_gold_faostat_iceberg",
|
|
528
|
+
name=f"{self.domain_code} gold FAOSTAT Iceberg",
|
|
529
|
+
description="Gold table containing the tag data in FAOSTAT format",
|
|
530
|
+
layer=TableLayer.GOLD,
|
|
531
|
+
private=True,
|
|
532
|
+
type=TableType.ICEBERG,
|
|
533
|
+
database=IcebergDatabases.GOLD_DATABASE,
|
|
534
|
+
table=self.iceberg_tables.GOLD_FAOSTAT.table,
|
|
535
|
+
path=self.iceberg_tables.GOLD_FAOSTAT.path,
|
|
536
|
+
structure={"columns": df.schema.jsonValue()["fields"]},
|
|
537
|
+
)
|
|
538
|
+
tag = upsert_disseminated_table(
|
|
539
|
+
sws_tags=tags,
|
|
540
|
+
tag=tag,
|
|
541
|
+
dataset_id=self.dataset_id,
|
|
542
|
+
tag_name=self.tag_name,
|
|
543
|
+
table=new_iceberg_table,
|
|
544
|
+
)
|
|
545
|
+
logging.debug(f"Tag with Added Iceberg Table: {tag}")
|
|
546
|
+
|
|
547
|
+
new_diss_table = BaseDisseminatedTagTable(
|
|
548
|
+
id=f"{self.domain_code.lower()}_gold_faosta_csv",
|
|
549
|
+
name=f"{self.domain_code} gold FAOSTAT csv",
|
|
550
|
+
description="Gold table containing the tag data in FAOSTAT format in csv",
|
|
551
|
+
layer=TableLayer.GOLD,
|
|
552
|
+
private=True,
|
|
553
|
+
type=TableType.CSV,
|
|
554
|
+
path=self.iceberg_tables.GOLD_FAOSTAT.csv_path,
|
|
555
|
+
structure={"columns": df.schema.jsonValue()["fields"]},
|
|
556
|
+
)
|
|
557
|
+
tag = upsert_disseminated_table(
|
|
558
|
+
sws_tags=tags,
|
|
559
|
+
tag=tag,
|
|
560
|
+
dataset_id=self.dataset_id,
|
|
561
|
+
tag_name=self.tag_name,
|
|
562
|
+
table=new_diss_table,
|
|
563
|
+
)
|
|
564
|
+
logging.debug(f"Tag with Added csv Table: {tag}")
|
|
565
|
+
|
|
566
|
+
return df
|
|
@@ -274,6 +274,12 @@ class IcebergTables:
|
|
|
274
274
|
self.GOLD_PRE_SDMX = self._create_iceberg_table(
|
|
275
275
|
"GOLD", prefix=domain, suffix="pre_sdmx"
|
|
276
276
|
)
|
|
277
|
+
self.GOLD_FAOSTAT = self._create_iceberg_table(
|
|
278
|
+
"GOLD", prefix=domain, suffix="faostat"
|
|
279
|
+
)
|
|
280
|
+
self.GOLD_FAOSTAT_UNFILTERED = self._create_iceberg_table(
|
|
281
|
+
"GOLD", prefix=domain, suffix="faostat_unfiltered"
|
|
282
|
+
)
|
|
277
283
|
|
|
278
284
|
def _create_iceberg_table(
|
|
279
285
|
self, level: str, prefix: str = "", suffix: str = ""
|
{sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/.gitignore
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/tests/__init__.py
RENAMED
|
File without changes
|
{sws_spark_dissemination_helper-0.0.158 → sws_spark_dissemination_helper-0.0.160}/tests/test.py
RENAMED
|
File without changes
|