def _insert_gid(conn, tab, tab_src, col, name, track_id, gid, submission_id=None, source_id=None):
    cond = sql.and_(tab.c.track_id == track_id, col == gid)
    query = sql.select([tab.c.id], cond)
    id = conn.execute(query).scalar()
    if id is not None:
        update_stmt = tab.update().where(cond)
        values = {'submission_count': sql.text('submission_count+1')}
        conn.execute(update_stmt.values(**values))
    else:
        insert_stmt = tab.insert().values({
            'track_id': track_id, name: gid,
            'submission_count': 1})
        id = conn.execute(insert_stmt).inserted_primary_key[0]
        logger.debug("Added %s %s to track %d", name.upper(), gid, track_id)
    insert_stmt = tab_src.insert().values({
        name.replace('_id', '') % 'track_%s_id': id,
        'submission_id': submission_id,
        'source_id': source_id,
    })
    conn.execute(insert_stmt)
    return True
dataset/ETHPy150Open lalinsky/acoustid-server/acoustid/data/track.py/_insert_gid/swapped operands of `%`