def scan_for_null_records(table, col_name, check_fkeys):
 if (col_name in table.columns):
  if check_fkeys:
   fkey_found = False
   fkeys = (table.c[col_name].foreign_keys or [])
   for fkey in fkeys:
    if (fkey.column.table.name == 'instances'):
     fkey_found = True
   if (not fkey_found):
    return
  records = len(list(table.select().where((table.c[col_name] == null())).execute()))
  if records:
   msg = (_("There are %(records)d records in the '%(table_name)s' table where the uuid or instance_uuid column is NULL. These must be manually cleaned up before the migration will pass. Consider running the 'nova-manage db null_instance_uuid_scan' command.") % {'records': records, 'table_name': table.name})
   raise exception.ValidationError(detail=msg)

def scan_for_null_records ( table , col_name , check_fkeys ) : if ( col_name in table . columns ) : if check_fkeys : fkey_found = False fkeys = ( table . c [ col_name ] . foreign_keys or [ ] ) for fkey in fkeys : if ( fkey . column . table . name == 'instances' ) : fkey_found = True if ( not fkey_found ) : return records = len ( list ( table . select ( ) . where ( ( table . c [ col_name ] == null ( ) ) ) . execute ( ) ) ) if records : msg = ( _ ( "There are %(records)d records in the '%(table_name)s' table where the uuid or instance_uuid column is NULL. These must be manually cleaned up before the migration will pass. Consider running the 'nova-manage db null_instance_uuid_scan' command." ) % { 'records' : records , 'table_name' : table . name } ) raise exception . ValidationError ( detail = msg )
queries the table looking for null instances of the given column .