"""General constants for lambda update_mappings_sme_analytics functions.""" # update vendor id and subaccount id query UPDATE_VENDOR_AND_SUBACCOUNT_SQL = """ UPDATE {db}.{schema}.sme_to_orchard_label_mapping SET vendor_id = %(vendor_id)s , subaccount_id = %(subaccount_id)s WHERE rep_owner_key = %(rep_owner_key)s AND parent_rep_owner_key = %(parent_rep_owner_key)s; """ # check that there is no current data # and data is not match with newly created vendor and subaccount CHECK_VENDOR_AND_SUBACCOUNT_SQL = """ SELECT * FROM {db}.{schema}.sme_to_orchard_label_mapping WHERE rep_owner_key = %(rep_owner_key)s AND parent_rep_owner_key = %(parent_rep_owner_key)s AND ( (vendor_id != %(vendor_id)s AND vendor_id IS NOT NULL) OR (subaccount_id != %(subaccount_id)s AND subaccount_id IS NOT NULL)); """