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