sws-spark-dissemination-helper 0.0.151__tar.gz → 0.0.152__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.
Files changed (16) hide show
  1. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/PKG-INFO +1 -1
  2. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/pyproject.toml +1 -1
  3. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/src/sws_spark_dissemination_helper/SWSEasyIcebergSparkHelper.py +14 -13
  4. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/.gitignore +0 -0
  5. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/LICENSE +0 -0
  6. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/README.md +0 -0
  7. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/src/sws_spark_dissemination_helper/SWSBronzeIcebergSparkHelper.py +0 -0
  8. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/src/sws_spark_dissemination_helper/SWSDatatablesExportHelper.py +0 -0
  9. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/src/sws_spark_dissemination_helper/SWSGoldIcebergSparkHelper.py +0 -0
  10. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/src/sws_spark_dissemination_helper/SWSPostgresSparkReader.py +0 -0
  11. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/src/sws_spark_dissemination_helper/SWSSilverIcebergSparkHelper.py +0 -0
  12. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/src/sws_spark_dissemination_helper/__init__.py +0 -0
  13. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/src/sws_spark_dissemination_helper/constants.py +0 -0
  14. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/src/sws_spark_dissemination_helper/utils.py +0 -0
  15. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/tests/__init__.py +0 -0
  16. {sws_spark_dissemination_helper-0.0.151 → sws_spark_dissemination_helper-0.0.152}/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.151
3
+ Version: 0.0.152
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>
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "sws-spark-dissemination-helper"
7
- version = "0.0.151"
7
+ version = "0.0.152"
8
8
  dependencies = [
9
9
  "annotated-types==0.7.0",
10
10
  "boto3>=1.36.18",
@@ -511,11 +511,9 @@ class SWSEasyIcebergSparkHelper:
511
511
  .drop("m.observation_id")
512
512
  )
513
513
 
514
- def write_data_to_iceberg_and_csv(self, sql=False, from_tag=False) -> DataFrame:
514
+ def write_data_to_iceberg_and_csv(self, sql=True) -> DataFrame:
515
515
  if sql:
516
516
  self.df_denorm = self._gen_denormalied_data_sql()
517
- elif from_tag:
518
- self.df_denorm = self._gen_denormalied_data_sql_from_tag()
519
517
  else:
520
518
  self.df_denorm = self._gen_denormalied_data()
521
519
 
@@ -586,18 +584,21 @@ class SWSEasyIcebergSparkHelper:
586
584
  logging.info("Unfiltered data tags successfully written")
587
585
 
588
586
  def write_filtered_data_to_iceberg_and_csv(
589
- self, dimensions: Dict[str, List[str]]
587
+ self, dimensions: Dict[str, List[str]] = None, from_tag=False
590
588
  ) -> DataFrame:
591
589
 
592
- self.filtered_df = self.df_denorm
593
-
594
- for dimension_name, codes in dimensions.items():
595
- logging.info(f"dimension_name: {dimension_name}")
596
- logging.info(f"codes: {codes}")
597
- if len(codes) != 0:
598
- self.filtered_df = self.filtered_df.filter(
599
- col(dimension_name).isin(codes)
600
- )
590
+ if from_tag:
591
+ self.filtered_df = self._gen_denormalied_data_sql_from_tag()
592
+ else:
593
+ self.filtered_df = self.df_denorm
594
+
595
+ for dimension_name, codes in dimensions.items():
596
+ logging.info(f"dimension_name: {dimension_name}")
597
+ logging.info(f"codes: {codes}")
598
+ if len(codes) != 0:
599
+ self.filtered_df = self.filtered_df.filter(
600
+ col(dimension_name).isin(codes)
601
+ )
601
602
 
602
603
  self.filtered_df.writeTo(
603
604
  self.iceberg_tables.TABLE_FILTERED.iceberg_id