def _update_source(cnx, cwsource):
    """Update cw_source relation of entities to point to Eurovoc CWSource.
    """
    sql = cnx.system_sql
    sqlqs = (
        "UPDATE cw_source_relation SET eid_to=%(source)s WHERE eid_from in (SELECT _X.cw_eid FROM cw_{0} AS _X WHERE _X.cw_cwuri ILIKE '%%eurovoc%%')"
        )
    for tablename in ('Label', 'Concept', 'ConceptScheme'):
        sql(sqlqs.format(tablename), {'source': cwsource.eid})
    cnx.commit()
