Skip to content

Commit

Permalink
TDL-22041 Fix Empty Projection Handling (#49)
Browse files Browse the repository at this point in the history
* Fix empty projection conditional, changelog + version bump

* Fix pylint disable

* Make pylint happy

* fix unittest


Co-authored by: Bryant Gray <[email protected]>
Co-authored by: Leslie VanDeMark <[email protected]>
  • Loading branch information
dsprayberry authored Feb 28, 2023
1 parent 9059540 commit ad49ea4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 1.2.2
* Fix empty string projection filter [#49](https://github.com/singer-io/tap-dynamodb/pull/49)

## 1.2.1
* Reduce logging by only logging once at the start of a full-table scan [#48](https://github.com/singer-io/tap-dynamodb/pull/48)

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.DEFAULT_GOAL := lint

lint-tests:
pylint tests -d broad-except,chained-comparison,empty-docstring,fixme,invalid-name,line-too-long,missing-class-docstring,missing-function-docstring,missing-module-docstring,no-else-raise,no-else-return,too-few-public-methods,too-many-arguments,too-many-branches,too-many-lines,too-many-locals,ungrouped-imports,wrong-spelling-in-comment,wrong-spelling-in-docstring,duplicate-code,no-name-in-module,import-error,consider-using-f-string
pylint tests -d broad-except,broad-exception-caught,broad-exception-raised,chained-comparison,empty-docstring,fixme,invalid-name,line-too-long,missing-class-docstring,missing-function-docstring,missing-module-docstring,no-else-raise,no-else-return,too-few-public-methods,too-many-arguments,too-many-branches,too-many-lines,too-many-locals,ungrouped-imports,wrong-spelling-in-comment,wrong-spelling-in-docstring,duplicate-code,no-name-in-module,import-error,consider-using-f-string

lint-code:
pylint tap_dynamodb -d broad-except,chained-comparison,empty-docstring,fixme,invalid-name,line-too-long,missing-class-docstring,missing-function-docstring,missing-module-docstring,no-else-raise,no-else-return,too-few-public-methods,too-many-arguments,too-many-branches,too-many-lines,too-many-locals,ungrouped-imports,wrong-spelling-in-comment,wrong-spelling-in-docstring,raise-missing-from,consider-using-f-string
pylint tap_dynamodb -d broad-except,broad-exception-caught,broad-exception-raised,chained-comparison,empty-docstring,fixme,invalid-name,line-too-long,missing-class-docstring,missing-function-docstring,missing-module-docstring,no-else-raise,no-else-return,too-few-public-methods,too-many-arguments,too-many-branches,too-many-lines,too-many-locals,ungrouped-imports,wrong-spelling-in-comment,wrong-spelling-in-docstring,raise-missing-from,consider-using-f-string

lint: lint-code lint-tests
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name="tap-dynamodb",
version="1.2.1",
version="1.2.2",
description="Singer.io tap for extracting data",
author="Stitch",
url="http://singer.io",
Expand Down
2 changes: 1 addition & 1 deletion tap_dynamodb/sync_strategies/log_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def sync(config, state, stream):
md_map = metadata.to_map(stream['metadata'])
projection = metadata.get(md_map, (), 'tap-mongodb.projection')
expression = metadata.get(md_map, (), 'tap-dynamodb.expression-attributes')
if projection is not None:
if projection is not None and projection != '':
projection = [x.strip().split('.') for x in projection.split(',')]
if expression:
# decode the expression in jsonified object.
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/test_expression_attributes_log_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_sync_without_projection(self, mock_deserializer, mock_sync_shard, mock_
"""Test expression attribute with empty string passed in `projection` field."""
res = sync(CONFIG, STATE, STREAM)

mock_sync_shard.assert_called_with({'SequenceNumberRange': {'EndingSequenceNumber': 'dummy_no'}, 'ShardId': 'dummy_id'}, {}, client, 'dummy_arn', [['']], {}, 'GoogleDocs', {}, {})
mock_sync_shard.assert_called_with({'SequenceNumberRange': {'EndingSequenceNumber': 'dummy_no'}, 'ShardId': 'dummy_id'}, {}, client, 'dummy_arn', '', {}, 'GoogleDocs', {}, {})

@patch('singer.metadata.get', side_effect =["#tst[4].#n, #tst[4].#a, Test", "{\"#tst\": \"test1\", \"#n\": \"Name\", \"#a\": \"Age\"}"])
@patch('tap_dynamodb.sync_strategies.log_based.sync_shard', return_value = 1)
Expand Down

0 comments on commit ad49ea4

Please sign in to comment.