Skip to content

Commit

Permalink
fixed issue if config is none
Browse files Browse the repository at this point in the history
  • Loading branch information
jsj authored and mrjsj committed Dec 8, 2024
1 parent ca7eace commit 269d323
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 5 additions & 1 deletion docs/usage/etl.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ df.write_parquet("source.parquet")
source_df = source_parquet("source.parquet")

# Upsert to a target table
upsert_scd_type_1(dedup_df, "target_table")
upsert_scd_type_1(
table_uri="target_table",
df=source_df,
primary_key_columns="id"
)
```


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "msfabricutils"
version = "0.3.0"
version = "0.3.1"
description = "A Python library exposes additional functionality to work with Python Notebooks in Microsoft Fabric."
authors = [
{ name = "Jimmy Jensen" },
Expand Down
12 changes: 8 additions & 4 deletions src/msfabricutils/etl/sinks/delta_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ def upsert_scd_type_1(
dynamic_audit_columns = config.get_dynamic_audit_columns() if config else []
static_audit_columns = config.get_static_audit_columns() if config else []

if exclude_columns is None:
exclude_columns = []

if isinstance(primary_key_columns, str):
primary_key_columns = [primary_key_columns]
primary_key_columns = [config.normalization_strategy(column) for column in primary_key_columns]

if config:
primary_key_columns = [
config.normalization_strategy(column) for column in primary_key_columns
]

if exclude_columns is None:
exclude_columns = []

if isinstance(exclude_columns, str):
exclude_columns = [exclude_columns]
Expand Down

0 comments on commit 269d323

Please sign in to comment.