Skip to content

Commit

Permalink
fix e2e test for mongo to postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
amofakhar committed Jun 11, 2024
1 parent 3ded126 commit d6c0fb4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion pipelinewise/fastsync/commons/tap_mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}


Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion singer-connectors/tap-mongodb/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pipelinewise-tap-mongodb==1.4.0
pipelinewise-tap-mongodb==1.3.0
6 changes: 3 additions & 3 deletions tests/end_to_end/test_target_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit d6c0fb4

Please sign in to comment.