(db)
return case_ids
Get case_ids that have duplicate indices (same identifier)
Get case_ids that have duplicate indices (same identifier)
Get case_ids that have duplicate indices ( same identifier )
def _get_case_ids_with_dupe_indices(db):
    """Get case_ids that have duplicate indices (same identifier)
    """
    case_id_with_dupes_sql = """
        SELECT case_id, identifier, count(*)
        FROM {case_index_table}
        GROUP BY case_id, identifier
        HAVING count(*) > 1
    """.format(case_index_table=CommCareCaseIndexSQL._meta.db_table)

    with CommCareCaseIndexSQL.get_cursor_for_partition_db(db) as cursor:
        log_sql(case_id_with_dupes_sql)
        cursor.execute(case_id_with_dupes_sql)
        rows_with_dupes = fetchall_as_namedtuple(cursor)
        case_ids = {row.case_id for row in rows_with_dupes}
    return case_ids
def _get_case_ids_with_dupe_indices ( db ) : case_id_with_dupes_sql = """
        SELECT case_id, identifier, count(*)
        FROM {case_index_table}
        GROUP BY case_id, identifier
        HAVING count(*) > 1
    """ . format ( case_index_table = CommCareCaseIndexSQL . _meta . db_table ) with CommCareCaseIndexSQL . get_cursor_for_partition_db ( db ) as cursor : log_sql ( case_id_with_dupes_sql ) cursor . execute ( case_id_with_dupes_sql ) rows_with_dupes = fetchall_as_namedtuple ( cursor ) case_ids = { row . case_id for row in rows_with_dupes } return case_ids