Creating tables

Create tables in Baseten Postgres.

On the Data page, click "Add table" in the upper-right corner to launch the table creation screen. Nothing will be created until you actually save the table.

Your table name should be TitleCase with no spaces. Only letters and numbers are allowed, no special characters. If your table is called TableName in the UI, it will be table_name when making SQL queries.

The optional description field helps you document the purpose of the table. It is only shown in the UI and does not affect any SQL queries.

Every table has three default columns:

  • id, a unique integer identifier for each row

  • created_at, the datetime at which each row was created

  • modified_at, the datetime at which each row was last updated

These fields cannot be renamed, altered, or deleted, and are present in every Baseten data table.

You can add any number of custom columns to your table to store necessary data. Column names only accept lowercase letters and underscores, such as column_name.

Columns must have a type. Available types:

  • string, a string of effectively unlimited length

  • integer, an integer between -2,147,483,648 and 2,147,483,647

  • number, a floating-point value of effectively unlimited size

  • boolean, either True or False

  • datetime, a PostgreSQL datetime object

  • json, a structured object in JSON form

  • object, a row of any Baseten data table, including the current one

  • list, a list of any of the above types

When you are ready for your table to be created, click "Save table" at the bottom-right corner of the screen. Once you see a toast message confirming the table was created, you can navigate back to the Data page to see it added to the list.

Last updated