def update_unregistered_devices(unregistered):
'''
Update data for unregistered Android devices.
Unregistered device will not receive notifications and will be deleted when number of devices exceeds maximum.
'''
global ENGINE
binding = [{"p_{}".format(k): v for k, v in u.items()} for u in unregistered]
device_table = model.metadata.tables['device']
stmt = update(device_table).\
values(unregistered_ts=func.now()).\
where(and_(device_table.c.login_id == bindparam('p_login_id'),
func.coalesce(device_table.c.device_token_new, device_table.c.device_token) == bindparam('p_device_token')))
ENGINE.execute(stmt, binding)
评论列表
文章目录