def select_record_count(self, resource_name, timestamp):
"""Select the record count from a snapshot table.
Args:
resource_name (str): String of the resource name, which is
embedded in the table name.
timestamp (str): String of timestamp, formatted as
YYYYMMDDTHHMMSSZ.
Returns:
int: Integer of the record count in a snapshot table.
Raises:
MySQLError: When an error has occured while executing the query.
"""
try:
record_count_sql = select_data.RECORD_COUNT.format(
resource_name, timestamp)
cursor = self.conn.cursor()
cursor.execute(record_count_sql)
return cursor.fetchone()[0]
except (DataError, IntegrityError, InternalError, NotSupportedError,
OperationalError, ProgrammingError) as e:
raise MySQLError(resource_name, e)
评论列表
文章目录