Creating objects
Create objects within your Baseten Postgres tables.
Adding a single object
Let's say that we want to create a new RestaurantPhotoLabel
in a Code block with a block_input
of:
Creating a RestaurantPhotoLabel
inside your Code block will look like this:
(we’ll be referencing this photo
created a couple more times in this documentation)
session.add(...)
is necessary, otherwise you’ve only created an object in memory and never committed it to the database.
Adding multiple objects
If you want to create more than one object without having to run subsequent session.add(...)
commands, look no further!
Putting this in context (pun intended), running:
returns the following:
Learn more about adding and updating objects using SQLAlchemy.
Last updated