pdb_mapping/pdb_full_region_table.py
def qc_checks():
    """
    Execute quality control checks before we update the table
    """
    conn = RfamDB.connect(db_config=DB_CONFIG)
    cursor = conn.cursor()
    try:
        cursor.execute("SELECT COUNT(*) FROM pdb_full_region_temp;")
        num_rows_pdb_temp = cursor.fetchone()[0]
        cursor.execute("SELECT COUNT(*) FROM pdb_full_region;")
        num_rows_pdb = cursor.fetchone()[0]
        try:
            if num_rows_pdb_temp - num_rows_pdb > 100:
                raise CheckRowsError(num_rows_pdb, num_rows_pdb_temp)
            if num_rows_pdb_temp < 10000:
                raise CheckRowsError(num_rows_pdb, num_rows_pdb_temp)
        except CheckRowsError:
            logging.exception("Do not rename tables until error is resolved.")
            raise
        except Exception as e:
            logging.exception(e)

    except mysql.connector.Error as e:
        logging.debug("MySQL error has occurred: {0}".format(e))
        raise 

    finally:
        cursor.close()
        conn.close()

    Execute quality control checks before we update the table
    
Execute quality control checks before we update the table
Execute quality control checks before we update the table
def qc_checks():
    conn = RfamDB.connect(db_config=DB_CONFIG)
    cursor = conn.cursor()
    try:
        cursor.execute("SELECT COUNT(*) FROM pdb_full_region_temp;")
        num_rows_pdb_temp = cursor.fetchone()[0]
        cursor.execute("SELECT COUNT(*) FROM pdb_full_region;")
        num_rows_pdb = cursor.fetchone()[0]
        try:
            if num_rows_pdb_temp - num_rows_pdb > 100:
                raise CheckRowsError(num_rows_pdb, num_rows_pdb_temp)
            if num_rows_pdb_temp < 10000:
                raise CheckRowsError(num_rows_pdb, num_rows_pdb_temp)
        except CheckRowsError:
            logging.exception("Do not rename tables until error is resolved.")
            raise
        except Exception as e:
            logging.exception(e)
    except mysql.connector.Error as e:
        logging.debug("MySQL error has occurred: {0}".format(e))
        raise 
    finally:
        cursor.close()
        conn.close()
def qc_checks ( ) : conn = RfamDB . connect ( db_config = DB_CONFIG ) cursor = conn . cursor ( ) try : cursor . execute ( "SELECT COUNT(*) FROM pdb_full_region_temp;" ) num_rows_pdb_temp = cursor . fetchone ( ) [ 0 ] cursor . execute ( "SELECT COUNT(*) FROM pdb_full_region;" ) num_rows_pdb = cursor . fetchone ( ) [ 0 ] try : if num_rows_pdb_temp - num_rows_pdb > 100 : raise CheckRowsError ( num_rows_pdb , num_rows_pdb_temp ) if num_rows_pdb_temp < 10000 : raise CheckRowsError ( num_rows_pdb , num_rows_pdb_temp ) except CheckRowsError : logging . exception ( "Do not rename tables until error is resolved." ) raise except Exception as e : logging . exception ( e ) except mysql . connector . Error as e : logging . debug ( "MySQL error has occurred: {0}" . format ( e ) ) raise finally : cursor . close ( ) conn . close ( )
Execute quality control checks before we update the table
Execute quality control checks before we update the table
"""
    Execute quality control checks before we update the table
    """