Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

AP-1531 Zero-pad fixed-length binary fields #162

Merged
merged 8 commits into from
Aug 9, 2023
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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
install_requires=[
'pendulum==2.1.2',
'pipelinewise-singer-python==1.*',
'mysql-replication==0.43',
'PyMySQL==1.1.*',
'mysql-replication==0.40',
'plpygis==0.2.1',
'tzlocal==2.1',
],
Expand Down
2 changes: 1 addition & 1 deletion tap_mysql/sync_strategies/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def generate_select_sql(catalog_entry, columns):
# null bytes 0x00 and hexifying the column.
if property_format == 'binary':
escaped_columns.append(
f'hex(trim(trailing CHAR(0x00) from {escaped_col})) as {escaped_col}')
f'hex({escaped_col}) as {escaped_col}')
elif property_format == 'spatial':
escaped_columns.append(
f'ST_AsGeoJSON({escaped_col}) as {escaped_col}')
Expand Down
20 changes: 10 additions & 10 deletions tests/integration/test_tap_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1322,10 +1322,10 @@ def test_sync_messages_are_correct(self):

self.assertEqual(len(record_messages), 4)
self.assertListEqual([
{'age': 20, 'good_pk': '61'},
{'age': 30, 'good_pk': '62'},
{'age': 30, 'good_pk': '63'},
{'age': 40, 'good_pk': '64'},
{'age': 20, 'good_pk': '61000000000000000000'},
{'age': 30, 'good_pk': '62000000000000000000'},
{'age': 30, 'good_pk': '63000000000000000000'},
{'age': 40, 'good_pk': '64000000000000000000'},
], [rec.record for rec in record_messages])

# get the last state message to be fed to the next sync
Expand All @@ -1349,12 +1349,12 @@ def test_sync_messages_are_correct(self):

self.assertEqual(len(record_messages), 6)
self.assertListEqual([
{'age': 25, 'good_pk': '61'},
{'age': 35, 'good_pk': '62'},
{'age': 35, 'good_pk': '63'},
{'age': 45, 'good_pk': '64'},
{'age': 16, 'good_pk': '65'},
{'age': 5, 'good_pk': '66'},
{'age': 25, 'good_pk': '61000000000000000000'},
{'age': 35, 'good_pk': '62000000000000000000'},
{'age': 35, 'good_pk': '63000000000000000000'},
{'age': 45, 'good_pk': '64000000000000000000'},
{'age': 16, 'good_pk': '65000000000000000000'},
{'age': 5, 'good_pk': '66000000000000000000'},
], [rec.record for rec in record_messages])

def tearDown(self) -> None:
Expand Down
Loading