def get_logs_with_no_nodes_number(schema_editor):
    """ Get the number of the log records that don't correspond to a node """
    with schema_editor.connection.cursor() as cursor:
        cursor.execute(
            """
            SELECT COUNT(*) FROM db_dblog
            WHERE
                (db_dblog.objname LIKE 'node.%') AND NOT EXISTS
                (SELECT 1 FROM db_dbnode WHERE db_dbnode.id = db_dblog.objpk LIMIT 1)
            """
            )
        return cursor.fetchall()[0][0]
