Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamoDB CDC: Make MODIFY operation also propagate deleted attributes #276

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

## Unreleased
- MongoDB: Configure `MongoDBCrateDBConverter` after updating to commons-codec 0.0.18
- DynamoDB CDC: Fix `MODIFY` operation to also propagate deleted attributes

## 2024/09/22 v0.0.25
- Table Loader: Improved conditional handling of "transformation" parameter
Expand Down
2 changes: 1 addition & 1 deletion cratedb_toolkit/io/kinesis/relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

self.connection.commit()
except sa.exc.ProgrammingError as ex:
logger.warning(f"Running query failed: {ex}")
logger.exception(f"Executing query failed: {ex}")

Check warning on line 87 in cratedb_toolkit/io/kinesis/relay.py

View check run for this annotation

Codecov / codecov/patch

cratedb_toolkit/io/kinesis/relay.py#L87

Added line #L87 was not covered by tests
self.progress_bar.update()

def __del__(self):
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ docs = [
]
dynamodb = [
"boto3",
"commons-codec>=0.0.14",
"commons-codec>=0.0.19",
]
full = [
"cratedb-toolkit[cfr,cloud,datasets,io,service]",
Expand All @@ -163,11 +163,11 @@ io = [
kinesis = [
"aiobotocore<2.16",
"async-kinesis<1.2",
"commons-codec>=0.0.14",
"commons-codec>=0.0.19",
"lorrystream[carabas]>=0.0.6",
]
mongodb = [
"commons-codec[mongodb,zyp]>=0.0.18",
"commons-codec[mongodb,zyp]>=0.0.19",
"cratedb-toolkit[io]",
"orjson<4,>=3.3.1",
"pymongo<4.9,>=3.10.1",
Expand Down
2 changes: 2 additions & 0 deletions tests/io/dynamodb/test_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def test_kinesis_earliest_dynamodb_cdc_insert_update(caplog, cratedb, dynamodb):
assert cratedb.database.count_records(table_name) == 1
results = cratedb.database.run_sql(f"SELECT * FROM {table_name}", records=True) # noqa: S608
assert results[0]["data"]["list_of_objects"] == [{"foo": "bar"}, {"baz": "qux"}]
assert "tombstone" not in results[0]["data"]


def test_kinesis_latest_dynamodb_cdc_insert_update(caplog, cratedb, dynamodb):
Expand Down Expand Up @@ -104,3 +105,4 @@ def test_kinesis_latest_dynamodb_cdc_insert_update(caplog, cratedb, dynamodb):
assert cratedb.database.count_records(table_name) == 1
results = cratedb.database.run_sql(f"SELECT * FROM {table_name}", records=True) # noqa: S608
assert results[0]["data"]["list_of_objects"] == [{"foo": "bar"}, {"baz": "qux"}]
assert "tombstone" not in results[0]["data"]
2 changes: 2 additions & 0 deletions tests/io/test_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"test2": {"N": 2},
}
},
# An item that should be removed by the subsequent MODIFY operation.
"tombstone": {"S": "foo"},
},
"SizeBytes": 156,
"ApproximateCreationDateTimePrecision": "MICROSECOND",
Expand Down