From d6c0fb4d6fd646802b24c2eb4c38fba52569d3a9 Mon Sep 17 00:00:00 2001 From: Amir Mofakhar Date: Tue, 11 Jun 2024 16:54:37 +0100 Subject: [PATCH] fix e2e test for mongo to postgres --- pipelinewise/fastsync/commons/tap_mongodb.py | 3 ++- setup.py | 2 +- singer-connectors/tap-mongodb/requirements.txt | 2 +- tests/end_to_end/test_target_postgres.py | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pipelinewise/fastsync/commons/tap_mongodb.py b/pipelinewise/fastsync/commons/tap_mongodb.py index 8900f33c0..71b98cc23 100644 --- a/pipelinewise/fastsync/commons/tap_mongodb.py +++ b/pipelinewise/fastsync/commons/tap_mongodb.py @@ -41,7 +41,7 @@ def serialize_document(document: Dict) -> Dict: return { key: transform_value(val, [key]) for key, val in document.items() - if not isinstance(val, (bson.min_key.MinKey, bson.max_key.MaxKey, bson.binary.Binary)) + if not isinstance(val, (bson.min_key.MinKey, bson.max_key.MaxKey)) } @@ -139,6 +139,7 @@ def transform_value(value: Any, path) -> Any: datetime.datetime: lambda val, _: class_to_string(val, 'datetime'), bson.decimal128.Decimal128: lambda val, _: val.to_decimal(), bson.regex.Regex: lambda val, _: dict(pattern=val.pattern, flags=val.flags), + bson.binary.Binary: lambda val, _: class_to_string(val, 'bytes'), bson.code.Code: lambda val, _: dict(value=str(val), scope=str(val.scope)) if val.scope else str(val), diff --git a/setup.py b/setup.py index 930a27e08..467efd356 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ 'google-cloud-bigquery==3.11.1', 'pipelinewise-singer-python==1.*', 'python-pidfile==3.0.0', - 'pymongo==4.7.*', + 'pymongo==4.7.3', 'tzlocal>=2.0,<4.1', 'slackclient==2.9.4', 'sqlparse==0.4.4', diff --git a/singer-connectors/tap-mongodb/requirements.txt b/singer-connectors/tap-mongodb/requirements.txt index 8ce903d9d..162130640 100644 --- a/singer-connectors/tap-mongodb/requirements.txt +++ b/singer-connectors/tap-mongodb/requirements.txt @@ -1 +1 @@ -pipelinewise-tap-mongodb==1.4.0 \ No newline at end of file +pipelinewise-tap-mongodb==1.3.0 \ No newline at end of file diff --git a/tests/end_to_end/test_target_postgres.py b/tests/end_to_end/test_target_postgres.py index c128f1a6f..73267cb2f 100644 --- a/tests/end_to_end/test_target_postgres.py +++ b/tests/end_to_end/test_target_postgres.py @@ -430,17 +430,17 @@ def assert_row_counts_equal(target_schema, table, count_in_source): { 'age': randint(10, 30), 'id': 1001, - 'uuid': str(uuid.uuid4()), + 'uuid': bson.Binary.from_uuid(uuid.uuid4()), 'ts': Timestamp(12030, 500), }, { 'date': datetime.utcnow(), 'id': 1002, - 'uuid': str(uuid.uuid4()), + 'uuid': bson.Binary.from_uuid(uuid.uuid4()), 'regex': bson.Regex(r'^[A-Z]\\w\\d{2,6}.*$'), }, { - 'uuid': str(uuid.uuid4()), + 'uuid': bson.Binary.from_uuid(uuid.uuid4()), 'id': 1003, 'decimal': bson.Decimal128( decimal.Decimal('5.64547548425446546546644')