sws-spark-dissemination-helper 0.0.153__tar.gz → 0.0.154__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.153 → sws_spark_dissemination_helper-0.0.154}/PKG-INFO +1 -1
  2. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/pyproject.toml +1 -1
  3. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/src/sws_spark_dissemination_helper/SWSBronzeIcebergSparkHelper.py +30 -0
  4. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/.gitignore +0 -0
  5. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/LICENSE +0 -0
  6. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/README.md +0 -0
  7. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/src/sws_spark_dissemination_helper/SWSDatatablesExportHelper.py +0 -0
  8. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/src/sws_spark_dissemination_helper/SWSEasyIcebergSparkHelper.py +0 -0
  9. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/src/sws_spark_dissemination_helper/SWSGoldIcebergSparkHelper.py +0 -0
  10. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/src/sws_spark_dissemination_helper/SWSPostgresSparkReader.py +0 -0
  11. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/src/sws_spark_dissemination_helper/SWSSilverIcebergSparkHelper.py +0 -0
  12. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/src/sws_spark_dissemination_helper/__init__.py +0 -0
  13. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/src/sws_spark_dissemination_helper/constants.py +0 -0
  14. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/src/sws_spark_dissemination_helper/utils.py +0 -0
  15. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/tests/__init__.py +0 -0
  16. {sws_spark_dissemination_helper-0.0.153 → sws_spark_dissemination_helper-0.0.154}/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.153
3
+ Version: 0.0.154
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.153"
7
+ version = "0.0.154"
8
8
  dependencies = [
9
9
  "annotated-types==0.7.0",
10
10
  "boto3>=1.36.18",
@@ -339,6 +339,36 @@ class SWSBronzeIcebergSparkHelper:
339
339
 
340
340
  df_obs_denorm = self.spark.sql(final_query)
341
341
 
342
+ df_element_uom = self._prepare_element_uom()
343
+
344
+ dfs_dimension_w_validity = self._convert_dim_start_end_date_to_data()
345
+
346
+ # Join all the dimension codelists
347
+ for dimension_column, df_dimension in zip(
348
+ self.dim_columns_w_time, dfs_dimension_w_validity
349
+ ):
350
+ df_obs_denorm = (
351
+ df_obs_denorm.alias("o")
352
+ .join(
353
+ F.broadcast(df_dimension.withColumnRenamed("id", "join_id")).alias(
354
+ "d"
355
+ ),
356
+ col(f"{dimension_column}") == col("d.join_id"),
357
+ )
358
+ .drop(f"{dimension_column}", "join_id")
359
+ .withColumnRenamed("code", dimension_column)
360
+ )
361
+
362
+ df_obs_denorm = (
363
+ df_obs_denorm.alias("d")
364
+ .join(
365
+ F.broadcast(df_element_uom).alias("e"),
366
+ col(f"d.{self.element_column}") == col("e.element_code"),
367
+ "left",
368
+ )
369
+ .drop("element_code")
370
+ )
371
+
342
372
  return df_obs_denorm
343
373
 
344
374
  def _gen_denormalized_observation_sql_from_tag(self) -> DataFrame: