Supabase and Postgres
Read tables you already have in your database
Let an app on your own Postgres or Supabase read existing tables as its own, read-only, with the app's data rules in charge.
When an app keeps its data in your own Postgres or Supabase, it can also read tables you
already have there, such as public.profiles, as tables of the app. Ahamo only reads them and never changes their
rows or structure. For this app, the app's data rules replace the table's own row security.
When to use it
- An existing system writes the data and the app should show it.
- You don't want to copy a table that another tool keeps up to date.
How to use it
-
Ask the build AI to add the table to the app with the columns you want to read, and to give it a closed data rule.
Add a read-only profiles table with id, name and avatar_url, readable only by its owner (user_id). It will read our existing public.profiles table in Supabase.
-
Publish the app.
-
Open Runtime › Data, find External tables, choose the Data space, enter The App's table and Your table (for example
public.profiles), and select Read this table. -
If a
GRANTline is shown, run it once as the database owner (in Supabase, in its SQL editor), then select Read this table again.
The published app then shows the rows of your table. Changes made to it elsewhere show the next time the app reads it. In the preview the table is empty.
To stop, select Stop reading. The app's table of that name then starts empty.
Plans and limits
| Rule | Value |
|---|---|
| Needs | The app's published data on your own Postgres (Pro and up) |
| External tables | 50 per data space |
| Data rule | Closed, so only server code (allow.none()) or each user their own rows (allow.owner('user_id')) |
| Not allowed | Ahamo's, Postgres's and Supabase's own schemas, such as auth and storage |
| Who | People who can publish the app |
While the app reads a table, your database keeps the columns it reads from being changed or removed.
Troubleshooting
"Give … a closed rule of its own…". The app's rule for the table is too open. Ask the build AI for one of the two closed rules, publish, and try again.
"The published App has no table…". Add the table to the app and publish first.
"…lacks some columns…" or "…another kind of value…". The app's table lists columns your table doesn't have, or with other types. Ask the build AI to match your table, publish, and try again.