sws-spark-dissemination-helper 0.0.161__py3-none-any.whl → 0.0.163__py3-none-any.whl

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.
@@ -510,6 +510,10 @@ class SWSEasyIcebergSparkHelper:
510
510
  )
511
511
 
512
512
  def _gen_denormalied_data_sql(self) -> DataFrame:
513
+ self._gen_denormalized_observation_sql()
514
+ self._gen_denormalized_metadata_sql()
515
+ self._gen_grouped_metadata_sql()
516
+
513
517
  return self.spark.sql(
514
518
  f"""
515
519
  SELECT
@@ -271,6 +271,31 @@ class SWSGoldIcebergSparkHelper:
271
271
 
272
272
  return df
273
273
 
274
+ def write_gold_faostat_data_to_iceberg_and_csv(self, df: DataFrame) -> DataFrame:
275
+ """The expected input to this function is the output of the sws disseminated function"""
276
+ df.writeTo(self.iceberg_tables.GOLD_FAOSTAT.iceberg_id).createOrReplace()
277
+
278
+ logging.info(
279
+ f"Gold FAOSTAT table written to {self.iceberg_tables.GOLD_FAOSTAT.iceberg_id}"
280
+ )
281
+
282
+ self.spark.sql(
283
+ f"ALTER TABLE {self.iceberg_tables.GOLD_FAOSTAT.iceberg_id} CREATE OR REPLACE TAG `{self.tag_name}`"
284
+ )
285
+
286
+ logging.info(f"gold FAOSTAT tag '{self.tag_name}' created")
287
+
288
+ df_1 = df.coalesce(1)
289
+
290
+ save_cache_csv(
291
+ df=df_1,
292
+ bucket=self.bucket,
293
+ prefix=self.iceberg_tables.GOLD_FAOSTAT.csv_prefix,
294
+ tag_name=self.tag_name,
295
+ )
296
+
297
+ return df
298
+
274
299
  def write_gold_sws_validated_sws_dissemination_tag(
275
300
  self, df: DataFrame, tags: Tags
276
301
  ) -> DataFrame:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sws-spark-dissemination-helper
3
- Version: 0.0.161
3
+ Version: 0.0.163
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>
@@ -1,13 +1,13 @@
1
1
  sws_spark_dissemination_helper/SWSBronzeIcebergSparkHelper.py,sha256=ocuau0WtpyRwui0qwdQ_Rxh4nYPOyZoHpGKaWRa6B3Q,28868
2
2
  sws_spark_dissemination_helper/SWSDatatablesExportHelper.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- sws_spark_dissemination_helper/SWSEasyIcebergSparkHelper.py,sha256=Ko_gUE4ar2iR1zvIXiyq_bvfLVVjDrHwMJpef8CWipk,26235
4
- sws_spark_dissemination_helper/SWSGoldIcebergSparkHelper.py,sha256=RcpU8znoyNOfJMLFwrgi7S-BKkzgqh25o2wPLNIxLYc,21246
3
+ sws_spark_dissemination_helper/SWSEasyIcebergSparkHelper.py,sha256=abNk2rsBvDcHESczU07Ouc731HH69ypFEXA0PuvxOYM,26372
4
+ sws_spark_dissemination_helper/SWSGoldIcebergSparkHelper.py,sha256=cHEKA4whB4tVzZrsRoGkbdSDRgdfZA77xifYvA2XZMU,22091
5
5
  sws_spark_dissemination_helper/SWSPostgresSparkReader.py,sha256=KpG8gp8Ai9pHDiKhUOTcXWxxmFGeKEE3XKlI_Y-SveU,18453
6
6
  sws_spark_dissemination_helper/SWSSilverIcebergSparkHelper.py,sha256=qioLv3SlJEfk0LzTiwfXRtZXVImPOJUeh9k1XwHC-pA,26225
7
7
  sws_spark_dissemination_helper/__init__.py,sha256=42TPbk7KxAud_qY3Sr_F4F7VjyofUlxEJkUXAFQsjRo,327
8
8
  sws_spark_dissemination_helper/constants.py,sha256=zviO6huxWTWonHv4v2M8zKr7HXCDMBGqjHx-eTfGT2A,13487
9
9
  sws_spark_dissemination_helper/utils.py,sha256=G7lQqNRrvqZpgm9WmddD7fWsI8IVn09x1p3cV3458EA,21963
10
- sws_spark_dissemination_helper-0.0.161.dist-info/METADATA,sha256=62_Bd5pfNPWI4hWnflkj1HbyL33bdG_c8GbGp7SLY3U,2824
11
- sws_spark_dissemination_helper-0.0.161.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
12
- sws_spark_dissemination_helper-0.0.161.dist-info/licenses/LICENSE,sha256=zFzeb_j_6pXEHwH8Z0OpIkKFJk7vmhZjdem-K0d4zU4,1073
13
- sws_spark_dissemination_helper-0.0.161.dist-info/RECORD,,
10
+ sws_spark_dissemination_helper-0.0.163.dist-info/METADATA,sha256=j3TwgkmurtYUIOg6LQ83EelFI88FyUTK1g4hOTsareU,2824
11
+ sws_spark_dissemination_helper-0.0.163.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
12
+ sws_spark_dissemination_helper-0.0.163.dist-info/licenses/LICENSE,sha256=zFzeb_j_6pXEHwH8Z0OpIkKFJk7vmhZjdem-K0d4zU4,1073
13
+ sws_spark_dissemination_helper-0.0.163.dist-info/RECORD,,