def update_user_name(user_id, user_name): cursor = conn.cursor(pymysql.cursors.DictCursor) users = Table('users') q = users.update().set(users.user_name, user_name).where(users.user_id == int(user_id)) query = q.get_sql().replace('"', '') cursor.execute(query) cursor.close()
async def restore_deleted(self, replica_id): q = self.update().where( self.table.replica_id == replica_id ).where( self.table.status == Status.deleted, ).set( self.table.status, Status.ok ).returning('file_id') data = await self.fetch(q) if len(data): data = [d['file_id'] for d in data] files = PyPikaTable('files') q = files.update().where(files.id.isin(data)).set( files.indexed, False ).set( files.deleted, False, ) await self.exec(q)