def get_sites(one_row: bool = False) -> dict: cursor = Db().connect().cursor(dictionary=True) cursor.execute( 'SELECT * FROM `parser_site` WHERE `parse` = 0 and `process` = 0 ') if one_row: result = cursor.fetchone() else: result = cursor.fetchall() cursor.close() return result
def __set_last_key_migration(self) -> None: cursor = Db().connect().cursor(dictionary=True) cursor.execute( "SELECT `data` FROM `settings` WHERE `id` = 'migrations'") result = cursor.fetchall() if result: self.__last_key_migration = int(result[0]['data']) else: cursor.execute( "INSERT INTO `settings` (`id`, `data`) VALUES ('migrations', '0')" ) Db().connect().commit() cursor.close()