4 ms·
Rather than 2, isn't it better to let a single application own the database and manage the schema?
by Kinrany 3y ago
Rather than 2, isn't it better to let a single application own the database and manage the schema?
- charcircuit 3y agoThat is the point of 2. The single application is the API.
- Kinrany 3y agoI think GP was talking about a database-level API specifically
- deleted 3y ago[deleted]
- claytonjy 3y agoI was, but this approach makes it function as a single application, kinda. You're not exposing your underlying data storage directly to consumers. The weird thing here is your interface is still SQL. Sometimes that's fine, but I think this API-schema approach really takes off when you use something like PostgREST, PostGraphile, or Hasura to automatically turn this API schema into a web API. Lots of nice benefits to those tools, and then you have a single service that is more what users might expect. I actually discovered this API-schema approach from the docs of one of those tool...I just can't remember which one.
- steve-chavez 3y ago> I actually discovered this API-schema approach from the docs of one of those tool...I just can't remember which one. Maybe from https://postgrest.org/en/v10.2/schema_structure.html https://postgrest.org/en/v10.2/schema_structure.html
- claytonjy 3y agoYes, I think that was it! Interesting to see they have removed that page in more recent version of the docs.
- steve-chavez 3y agoIt wasn't removed, just badly reorganized. It's here now: https://postgrest.org/en/stable/explanations/db_authz.html#schemas https://postgrest.org/en/stable/explanations/db_authz.html#s...
- Kinrany 3y agoThe problem I see is that tables and views are a poor general purpose interface: if you don't know what the indexes are, you can't guarantee reasonable performance.