From 1a542b802d6e647312732870d9e883543678c64d Mon Sep 17 00:00:00 2001 From: Tim Grein Date: Wed, 5 Apr 2023 15:53:35 +0200 Subject: [PATCH 1/3] Add "get_last_update_time" to MySQLClient --- connectors/sources/mysql.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/connectors/sources/mysql.py b/connectors/sources/mysql.py index dd7aeaec9..36ac07247 100644 --- a/connectors/sources/mysql.py +++ b/connectors/sources/mysql.py @@ -331,6 +331,22 @@ def generate_id(tables, row, primary_key_columns): f"{'_'.join([str(pk_value) for pk in primary_key_columns if (pk_value := row.get(pk)) is not None])}" ) + @retryable( + retries=RETRIES, + interval=RETRY_INTERVAL, + strategy=RetryStrategy.EXPONENTIAL_BACKOFF, + ) + async def get_last_update_time(self, table): + async with self.connection.cursor(aiomysql.cursors.SSCursor) as cursor: + await cursor.execute(self.queries.table_last_update_time(table)) + + result = await cursor.fetchone() + + if result is not None: + return result[0] + + return None + class MySqlDataSource(BaseDataSource): """MySQL""" From fa789d2eec62d5a0c2aaa45ab9554dd76ad3e511 Mon Sep 17 00:00:00 2001 From: Tim Grein Date: Wed, 19 Jul 2023 08:53:24 +0200 Subject: [PATCH 2/3] Deduplicate test name --- tests/sources/test_sharepoint_online.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sources/test_sharepoint_online.py b/tests/sources/test_sharepoint_online.py index 8a5659f73..7d593765b 100644 --- a/tests/sources/test_sharepoint_online.py +++ b/tests/sources/test_sharepoint_online.py @@ -513,7 +513,7 @@ async def test_call_api_with_429( patch_cancellable_sleeps.assert_awaited_with(retry_after) @pytest.mark.asyncio - async def test_call_api_with_404( + async def test_call_api_with_404_with_retry_after_header( self, microsoft_api_session, mock_responses, From bfd177b077b1de00437accb43a9f11211d958ffa Mon Sep 17 00:00:00 2001 From: Tim Grein Date: Wed, 19 Jul 2023 08:53:33 +0200 Subject: [PATCH 3/3] Revert "Add "get_last_update_time" to MySQLClient" This reverts commit 1a542b802d6e647312732870d9e883543678c64d. --- connectors/sources/mysql.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/connectors/sources/mysql.py b/connectors/sources/mysql.py index 36ac07247..dd7aeaec9 100644 --- a/connectors/sources/mysql.py +++ b/connectors/sources/mysql.py @@ -331,22 +331,6 @@ def generate_id(tables, row, primary_key_columns): f"{'_'.join([str(pk_value) for pk in primary_key_columns if (pk_value := row.get(pk)) is not None])}" ) - @retryable( - retries=RETRIES, - interval=RETRY_INTERVAL, - strategy=RetryStrategy.EXPONENTIAL_BACKOFF, - ) - async def get_last_update_time(self, table): - async with self.connection.cursor(aiomysql.cursors.SSCursor) as cursor: - await cursor.execute(self.queries.table_last_update_time(table)) - - result = await cursor.fetchone() - - if result is not None: - return result[0] - - return None - class MySqlDataSource(BaseDataSource): """MySQL"""