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 417631d commit 77190c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 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))
if not isinstance(val, (bson.min_key.MinKey, bson.max_key.MaxKey, bson.binary.Binary))
}


Expand Down Expand Up @@ -148,6 +148,13 @@ def transform_value(value: Any, path) -> Any:
}

if isinstance(value, tuple(conversion.keys())):
try:
a = conversion[type(value)](value, path)
except Exception as e:
print(f'======>>> {e}')
print(f'-=-=-=->> {conversion[type(value)]}')
print(f'----->>> {type(value)} , {value}, {path}')
raise e
return conversion[type(value)](value, path)

return value
Expand Down
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': uuid.uuid4(),
'uuid': str(uuid.uuid4()),
'ts': Timestamp(12030, 500),
},
{
'date': datetime.utcnow(),
'id': 1002,
'uuid': uuid.uuid4(),
'uuid': str(uuid.uuid4()),
'regex': bson.Regex(r'^[A-Z]\\w\\d{2,6}.*$'),
},
{
'uuid': uuid.uuid4(),
'uuid': str(uuid.uuid4()),
'id': 1003,
'decimal': bson.Decimal128(
decimal.Decimal('5.64547548425446546546644')
Expand Down

0 comments on commit 77190c0

Please sign in to comment.