Skip to content

Commit 7fcfd97

Browse files
committed
Add "get_last_update_time" to MySQLClient
1 parent 906e758 commit 7fcfd97

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

connectors/sources/mysql.py

+16
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,22 @@ def generate_id(tables, row, primary_key_columns):
330330
f"{'_'.join([str(pk_value) for pk in primary_key_columns if (pk_value := row.get(pk)) is not None])}"
331331
)
332332

333+
@retryable(
334+
retries=RETRIES,
335+
interval=RETRY_INTERVAL,
336+
strategy=RetryStrategy.EXPONENTIAL_BACKOFF,
337+
)
338+
async def get_last_update_time(self, table):
339+
async with self.connection.cursor(aiomysql.cursors.SSCursor) as cursor:
340+
await cursor.execute(self.queries.table_last_update_time(table))
341+
342+
result = await cursor.fetchone()
343+
344+
if result is not None:
345+
return result[0]
346+
347+
return None
348+
333349

334350
class MySqlDataSource(BaseDataSource):
335351
"""MySQL"""

0 commit comments

Comments
 (0)