sws-spark-dissemination-helper 0.0.94__tar.gz → 0.0.96__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.94 → sws_spark_dissemination_helper-0.0.96}/PKG-INFO +1 -1
  2. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/pyproject.toml +1 -1
  3. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/src/sws_spark_dissemination_helper/SWSBronzeIcebergSparkHelper.py +30 -0
  4. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/.gitignore +0 -0
  5. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/LICENSE +0 -0
  6. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/README.md +0 -0
  7. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/old_requirements.txt +0 -0
  8. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/requirements.txt +0 -0
  9. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/src/sws_spark_dissemination_helper/SWSGoldIcebergSparkHelper.py +0 -0
  10. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/src/sws_spark_dissemination_helper/SWSPostgresSparkReader.py +0 -0
  11. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/src/sws_spark_dissemination_helper/SWSSilverIcebergSparkHelper.py +0 -0
  12. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/src/sws_spark_dissemination_helper/__init__.py +0 -0
  13. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/src/sws_spark_dissemination_helper/constants.py +0 -0
  14. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/src/sws_spark_dissemination_helper/utils.py +0 -0
  15. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/tests/__init__.py +0 -0
  16. {sws_spark_dissemination_helper-0.0.94 → sws_spark_dissemination_helper-0.0.96}/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.94
3
+ Version: 0.0.96
4
4
  Summary: A Python helper package providing streamlined Spark functions for efficient data dissemination processes
5
5
  Project-URL: Repository, https://bitbucket.org/cioapps/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.94"
7
+ version = "0.0.96"
8
8
  dependencies = [
9
9
  "annotated-types==0.7.0",
10
10
  "boto3==1.36.18",
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ import time
2
3
  from copy import copy
3
4
  from typing import Dict, List, Tuple
4
5
 
@@ -389,6 +390,15 @@ class SWSBronzeIcebergSparkHelper:
389
390
  self.spark.sql(
390
391
  f"ALTER TABLE {self.iceberg_tables.BRONZE.iceberg_id} CREATE TAG `{self.tag_name}`"
391
392
  )
393
+ while (
394
+ self.spark.sql(
395
+ f"SELECT * FROM {self.iceberg_tables.BRONZE.iceberg_id}.refs"
396
+ )
397
+ .filter((col("type") == lit("TAG")) & (col("name") == lit(self.tag_name)))
398
+ .count()
399
+ ) == 0:
400
+ logging.info(f"Waiting for the tag {self.tag_name} to be created")
401
+ time.sleep(2)
392
402
 
393
403
  logging.info(f"bronze tag '{self.tag_name}' created")
394
404
 
@@ -448,10 +458,30 @@ class SWSBronzeIcebergSparkHelper:
448
458
  self, dimensions: Dict[str, List[str]]
449
459
  ) -> DataFrame:
450
460
 
461
+ refs = self.spark.sql(
462
+ f"SELECT * FROM {self.iceberg_tables.BRONZE.iceberg_id}.refs"
463
+ ).collect()
464
+ logging.info(f"bronze refs: {refs}")
465
+
451
466
  create_branch_query = f"ALTER TABLE {self.iceberg_tables.BRONZE.iceberg_id}.`tag_{self.tag_name}` CREATE OR REPLACE BRANCH `diss_tag_{self.tag_name}`" # AS OF VERSION `{tag_name}`
452
467
  logging.info(f"create_branch_query: {create_branch_query}")
453
468
  create_branch_query_result = self.spark.sql(create_branch_query).collect()
454
469
 
470
+ while (
471
+ self.spark.sql(
472
+ f"SELECT * FROM {self.iceberg_tables.BRONZE.iceberg_id}.refs"
473
+ )
474
+ .filter(
475
+ (col("type") == lit("BRANCH"))
476
+ & (col("name") == lit(f"diss_tag_{self.tag_name}"))
477
+ )
478
+ .count()
479
+ ) == 0:
480
+ logging.info(
481
+ f"Waiting for the branch {self.tag_name} diss_tag_{self.tag_name} to be created"
482
+ )
483
+ time.sleep(2)
484
+
455
485
  logging.info(f"result of create_branch_query: {create_branch_query_result}")
456
486
 
457
487
  self.disseminated_tag_df = self.spark.read.option(