Updating objects

Update objects in your Baseten Postgres table.

We can access the objects we’ve created by attribute, like the following:

label.meal

And if we’d like to modify that meal, we can simply reset it like so:

label.meal = 'a different meal that we like better'

So you could do something like this to the first object:

label = session.query(RestaurantPhotoLabel).order_by(RestaurantPhotoLabel.id).first()
label.meal = 'eggs'
label.ambiance = 'home-y'
session.add(label)

and its values would change accordingly:

<RestaurantPhotoLabel
    ...
    meal='eggs',
    ambiance='home-y'>

Learn more about adding and updating objects using SQLAlchemy.

Last updated