Skip to content

Commit

Permalink
Add "get_last_update_time" to MySQLClient
Browse files Browse the repository at this point in the history
  • Loading branch information
timgrein committed Sep 1, 2023
1 parent 9957aae commit 28057df
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions connectors/sources/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,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"""
Expand Down

0 comments on commit 28057df

Please sign in to comment.