0

SQLAlchemy ORM Mavens,

Using SQLAlchemy ORM (not CORE), how can a bulk UPDATE be configured on an unknown quantity of objects in a manner similar to a SQL UPDATE-SET-WHERE command (such as this one:)?

UPDATE items SET items.price = (items.price * 1.1) WHERE Left(item_id, 4) = "PAX-";

After hours of poring over manuals and docs...all I can find are CORE examples—and hope you'll be so kind as to offer a tip.

Many, many thanks! Planewryter

PS: Using Python 3.7 and SQLAlchemy v1.2.13 on an iMac w/macOS 10.14.1

Plane Wryter
  • 1,299
  • 1
  • 11
  • 14
  • 1
    The part of the official documentation you're looking for is [`Query.update()`](https://docs.sqlalchemy.org/en/latest/orm/query.html#sqlalchemy.orm.query.Query.update). – Ilja Everilä Nov 13 '18 at 22:20
  • Thank you, IIja! I misunderstood the correct use of the .filter() and how it precedes the .update(). Your expertise is valued and appreciated! – Plane Wryter Nov 14 '18 at 01:25

0 Answers0