sws-spark-dissemination-helper 0.0.141__tar.gz → 0.0.143__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 (18) hide show
  1. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/PKG-INFO +1 -1
  2. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/pyproject.toml +1 -1
  3. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/src/sws_spark_dissemination_helper/constants.py +28 -5
  4. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/.gitignore +0 -0
  5. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/LICENSE +0 -0
  6. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/README.md +0 -0
  7. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/old_requirements.txt +0 -0
  8. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/requirements.txt +0 -0
  9. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/src/sws_spark_dissemination_helper/SWSBronzeIcebergSparkHelper.py +0 -0
  10. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/src/sws_spark_dissemination_helper/SWSDatatablesExportHelper.py +0 -0
  11. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/src/sws_spark_dissemination_helper/SWSEasyIcebergSparkHelper.py +0 -0
  12. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/src/sws_spark_dissemination_helper/SWSGoldIcebergSparkHelper.py +0 -0
  13. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/src/sws_spark_dissemination_helper/SWSPostgresSparkReader.py +0 -0
  14. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/src/sws_spark_dissemination_helper/SWSSilverIcebergSparkHelper.py +0 -0
  15. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/src/sws_spark_dissemination_helper/__init__.py +0 -0
  16. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/src/sws_spark_dissemination_helper/utils.py +0 -0
  17. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/tests/__init__.py +0 -0
  18. {sws_spark_dissemination_helper-0.0.141 → sws_spark_dissemination_helper-0.0.143}/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.141
3
+ Version: 0.0.143
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.141"
7
+ version = "0.0.143"
8
8
  dependencies = [
9
9
  "annotated-types==0.7.0",
10
10
  "boto3==1.36.18",
@@ -1,3 +1,5 @@
1
+ from typing import List
2
+
1
3
  from pyspark.sql.functions import col, lit
2
4
 
3
5
  SPARK_POSTGRES_DRIVER = "org.postgresql.Driver"
@@ -34,10 +36,14 @@ class DomainFilters:
34
36
  class DatasetDatatables:
35
37
 
36
38
  class __SWSDatatable:
37
- def __init__(self, id: str, name: str, schema: str):
39
+ def __init__(
40
+ self, id: str, name: str, schema: str, join_columns: List[str] = []
41
+ ):
38
42
  self.id = id
43
+ self.iceberg_id = f"{IcebergDatabases.BRONZE_DATABASE}{id.split('.')[1]}"
39
44
  self.name = name
40
45
  self.schema = schema
46
+ self.join_columns = join_columns
41
47
 
42
48
  # Aggregation Tables
43
49
  AGGREGATES_COMPOSITION = __SWSDatatable(
@@ -50,22 +56,37 @@ class DatasetDatatables:
50
56
  name="Aggregation - Aggregates per elements",
51
57
  schema=f"{DATATABLE_COLUMNS_SCHEMA}, domain STRING, element STRING, aggregation_type STRING, code STRING",
52
58
  )
53
-
59
+
54
60
  # Dissemination Tables
55
61
  DISSEMINATION_TYPE_LIST = __SWSDatatable(
56
62
  id="datatables.dissemination_{type}_list",
57
63
  name="Dissemination - {type} list",
58
64
  schema=f"{DATATABLE_COLUMNS_SCHEMA}, domain STRING, code STRING, name STRING, aggregation_type STRING, dissemination BOOLEAN, aggregation BOOLEAN",
65
+ join_columns=["domain", "code"],
59
66
  )
60
67
  DISSEMINATION_EXCEPTIONS = __SWSDatatable(
61
68
  id="datatables.dissemination_exception",
62
69
  name="Dissemination - Exceptions",
63
70
  schema=f"{DATATABLE_COLUMNS_SCHEMA}, domain STRING, dim1_code STRING, dim2_code STRING, dim3_code STRING, dim4_code STRING, dim5_code STRING, dim6_code STRING, dim7_code STRING, status_flag STRING, method_flag STRING, dissemination BOOLEAN, aggregation BOOLEAN, note STRING",
71
+ join_columns=[
72
+ "domain",
73
+ " dim1_code",
74
+ " dim2_code",
75
+ " dim3_code",
76
+ " dim4_code",
77
+ " dim5_code",
78
+ " dim6_code",
79
+ " dim7_code",
80
+ " status_flag",
81
+ " method_flag",
82
+ ],
64
83
  )
84
+ # TODO Deprecate
65
85
  DISSEMINATION_ITEM_LIST_FAOSTAT = __SWSDatatable(
66
86
  id="datatables.dissemination_item_list_faostat",
67
87
  name="Dissemination - Item list - FAOSTAT",
68
88
  schema=f"{DATATABLE_COLUMNS_SCHEMA}, domain STRING, code STRING, name STRING, aggregation_type STRING, dissemination BOOLEAN, aggregation BOOLEAN",
89
+ join_columns=["domain", "code"],
69
90
  )
70
91
 
71
92
  # Mapping Tables
@@ -73,19 +94,23 @@ class DatasetDatatables:
73
94
  id="datatables.aggregates_mapping_domains_id",
74
95
  name="Mapping - Domains ID",
75
96
  schema=f"{DATATABLE_COLUMNS_SCHEMA}, domain STRING, domain_name STRING, sws_source_id STRING, sws_destination_id STRING",
97
+ join_columns=["domain", "sws_source_id"],
76
98
  )
77
99
  MAPPING_CODELIST_TYPE = __SWSDatatable(
78
100
  id="datatables.mapping_codelist_type",
79
101
  name="Mapping Codelist type",
80
102
  schema=f"{DATATABLE_COLUMNS_SCHEMA}, domain STRING, col_name STRING, col_type STRING",
103
+ join_columns=["domain", "col_name"],
81
104
  )
82
105
  MAPPING_CODE_CORRECTION = __SWSDatatable(
83
106
  id="datatables.aggregates_mapping_code_correction",
84
107
  name="Mapping - Code correction",
85
108
  schema=f"{DATATABLE_COLUMNS_SCHEMA}, domain STRING, old_code STRING, new_code STRING, var_type STRING, delete BOOLEAN, multiplier FLOAT, mapping_type STRING",
109
+ join_columns=["domain", "old_code", "var_type", "mapping_type"],
86
110
  )
87
111
 
88
112
  # Non-SWS Sources Tables
113
+ # TODO To deprecate
89
114
  FAOSTAT_CODE_MAPPING = __SWSDatatable(
90
115
  id="datatables.faostat_code_mapping",
91
116
  name="FAOSTAT Code Mapping",
@@ -223,9 +248,7 @@ class IcebergTables:
223
248
  self.SILVER = self._create_iceberg_table("SILVER", prefix=domain)
224
249
 
225
250
  # GOLD tables with specific suffixes
226
- self.GOLD_SWS = self._create_iceberg_table(
227
- "GOLD", prefix=domain, suffix="sws"
228
- )
251
+ self.GOLD_SWS = self._create_iceberg_table("GOLD", prefix=domain, suffix="sws")
229
252
  self.GOLD_SDMX = self._create_iceberg_table(
230
253
  "GOLD", prefix=domain, suffix="sdmx_disseminated"
231
254
  )