sws-spark-dissemination-helper 0.0.109__tar.gz → 0.0.111__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.109 → sws_spark_dissemination_helper-0.0.111}/PKG-INFO +1 -1
  2. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/pyproject.toml +1 -1
  3. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/src/sws_spark_dissemination_helper/SWSSilverIcebergSparkHelper.py +15 -8
  4. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/.gitignore +0 -0
  5. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/LICENSE +0 -0
  6. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/README.md +0 -0
  7. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/old_requirements.txt +0 -0
  8. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/requirements.txt +0 -0
  9. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/src/sws_spark_dissemination_helper/SWSBronzeIcebergSparkHelper.py +0 -0
  10. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/src/sws_spark_dissemination_helper/SWSGoldIcebergSparkHelper.py +0 -0
  11. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/src/sws_spark_dissemination_helper/SWSPostgresSparkReader.py +0 -0
  12. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/src/sws_spark_dissemination_helper/__init__.py +0 -0
  13. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/src/sws_spark_dissemination_helper/constants.py +0 -0
  14. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/src/sws_spark_dissemination_helper/utils.py +0 -0
  15. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/tests/__init__.py +0 -0
  16. {sws_spark_dissemination_helper-0.0.109 → sws_spark_dissemination_helper-0.0.111}/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.109
3
+ Version: 0.0.111
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.109"
7
+ version = "0.0.111"
8
8
  dependencies = [
9
9
  "annotated-types==0.7.0",
10
10
  "boto3==1.36.18",
@@ -172,6 +172,10 @@ class SWSSilverIcebergSparkHelper:
172
172
  )
173
173
 
174
174
  original_col_order = df.columns
175
+ cols_to_select = df.columns
176
+ cols_to_select.remove("note")
177
+ cols_to_select.remove(f"{col_name}_start_date")
178
+ cols_to_select.remove(f"{col_name}_end_date")
175
179
 
176
180
  df = (
177
181
  df.alias("d")
@@ -188,7 +192,7 @@ class SWSSilverIcebergSparkHelper:
188
192
  .withColumn("valid_new_start_year", col("sy.new_code").isNotNull())
189
193
  .withColumn("valid_new_end_year", col("ey.new_code").isNotNull())
190
194
  .withColumn(
191
- "note",
195
+ "new_note",
192
196
  F.when(
193
197
  col("valid_new_start_year"),
194
198
  F.array_append(
@@ -201,14 +205,14 @@ class SWSSilverIcebergSparkHelper:
201
205
  col("sy.new_code"),
202
206
  ),
203
207
  ),
204
- ).otherwise(col("note")),
208
+ ).otherwise(col("d.note")),
205
209
  )
206
210
  .withColumn(
207
- "note",
211
+ "new_note",
208
212
  F.when(
209
213
  col("valid_new_end_year"),
210
214
  F.array_append(
211
- col("note"),
215
+ col("new_note"),
212
216
  F.concat(
213
217
  col("ey.note"),
214
218
  lit(" from "),
@@ -217,22 +221,25 @@ class SWSSilverIcebergSparkHelper:
217
221
  col("ey.new_code"),
218
222
  ),
219
223
  ),
220
- ).otherwise(col("note")),
224
+ ).otherwise(col("new_note")),
221
225
  )
222
226
  .withColumn(
223
- f"{col_name}_start_date",
227
+ f"new_{col_name}_start_date",
224
228
  F.when(
225
229
  col("valid_new_start_year"), F.to_date(col("sy.new_code"))
226
230
  ).otherwise(col(f"d.{col_name}_start_date")),
227
231
  )
228
232
  .withColumn(
229
- f"{col_name}_end_date",
233
+ f"new_{col_name}_end_date",
230
234
  F.when(
231
235
  col("valid_new_end_year"), F.to_date(col("ey.new_code"))
232
236
  ).otherwise(col(f"d.{col_name}_end_date")),
233
237
  )
234
238
  .selectExpr(
235
- "d.*", "note", f"{col_name}_start_date", f"{col_name}_end_date"
239
+ *cols_to_select,
240
+ col("new_note").alias("note"),
241
+ col(f"new_{col_name}_start_date").alias(f"{col_name}_start_date"),
242
+ col(f"new_{col_name}_end_date").alias(f"{col_name}_end_date"),
236
243
  )
237
244
  .select(*original_col_order)
238
245
  )