Skip to content

Commit 1d6da61

Browse files
committed
Fix overwriting for not enforced configs #450
1 parent af9ccf6 commit 1d6da61

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

awswrangler/_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,10 @@ def wrapper(*args_raw: Any, **kwargs: Any) -> Any:
347347
value: _ConfigValueType = config[name]
348348
if name not in args:
349349
_logger.debug("Applying default config argument %s with value %s.", name, value)
350+
args[name] = value
350351
elif _CONFIG_ARGS[name].enforced is True:
351352
_logger.debug("Applying ENFORCED config argument %s with value %s.", name, value)
352-
args[name] = value
353+
args[name] = value
353354
for name, param in signature.parameters.items():
354355
if param.kind == param.VAR_KEYWORD and name in args:
355356
if isinstance(args[name], dict) is False:

tests/test_config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ def test_basics(path, glue_database, glue_table, workgroup0, workgroup1):
4545
# Testing configured database
4646
wr.catalog.create_parquet_table(**args)
4747

48+
# Configuring default database with wrong value
49+
wr.config.database = "missing_database"
50+
with pytest.raises(boto3.client("glue").exceptions.EntityNotFoundException):
51+
wr.catalog.create_parquet_table(**args)
52+
53+
# Overwriting configured database
54+
wr.catalog.create_parquet_table(database=glue_database, **args)
55+
4856
# Testing configured s3 block size
4957
size = 1 * 2 ** 20 # 1 MB
5058
wr.config.s3_block_size = size

0 commit comments

Comments
 (0)