News for hackers. Stuff that matters.
[dead]
Re:PostgREST – A fully RESTful API from any existing Postgre... by scrollaway on Sunday March 26, 2017 @03:22AM (#13959642)
This is a super rude and arrogant thing to say. Have you considered, before dismissing a project with 1.2k commits, that it's not the 54 authors who worked on the project for three years who are missing something, but you who heard about it at most two hours ago?
[dead]
Re:PostgREST – A fully RESTful API from any existing Postgre... by scrollaway on Sunday March 26, 2017 @06:46AM (#13960095)
Wow, unbelievable. I don't know in what world you think it's OK to call something useless just because you don't personally see its use, when faced with evidence that plenty of people in this thread alone do.

I understand you're not a native speaker (neither am I), so I just want to make it very clear to you in case you don't realize it: Your original message, and this reply you just wrote, are both completely out of place and uncalled for. And incorrect on a technical level.

This tool is exposing DB operations as an HTTP API. It wasn't written for you specifically, it was written to solve a particular scenario. One day, you'll encounter said scenario, and you won't even realize there's a tool out there to specifically solve it because you dismissed it as "useless". And instead of "doing something great with your time", you'll waste a few days/weeks reimplementing a poorer version of that wheel.

I'm not affiliated with the project, I don't even use it, but I can still appreciate what it does. If you can't, that's fine, but don't shit on people's work no more knowledge about it than "reading the short introduction". Lest you want me to go through your Github profile and shit on your work based on how you name your repos, which would be just as productive.

Re:PostgREST – A fully RESTful API from any existing Postgre... by Walkman on Sunday March 26, 2017 @10:48AM (#13961036)
Ok the tone of my message might be out of line a little bit, but I find it important to make people aware of incorrect usage of principles/tools/framework/stuff. I would not have so much problem with this project if they would call it "API" instead of "REST API", because it would communicate the purpose much clearer.

Also it would be a huge design mistake to use this on any serious project and probably not everybody will realize this.

Re:PostgREST – A fully RESTful API from any existing Postgre... by dexen on Sunday March 26, 2017 @06:43AM (#13960091)
I have a little bit of experience with PostgreSQL.

Coming from MySQL background, I was pleasantly surprised how much abstraction you can build into your PostgreSQL database itself. With just a few views and perhaps functions you can abstract away your actual data in clean and performant way, and thus enable use of such REST API without worrying too much about future schema change.

Re:PostgREST – A fully RESTful API from any existing Postgre... by ruslan_talpa on Sunday March 26, 2017 @07:14AM (#13960179)
You've just formulated one of the core concepts/techniques PostgREST relies on. You don't expose your core tables as an API, you expose views that extract data from your core tables, even if in the beginning those views are nothing more then "select * from some_table". As the api evolves, you are free to change the logic in those views without the need to touch your core tables
Re:PostgREST – A fully RESTful API from any existing Postgre... by Walkman on Sunday March 26, 2017 @10:50AM (#13961048)
That's actually a very good counter-argument against mine.
Re:PostgREST – A fully RESTful API from any existing Postgre... by zepolen on Sunday March 26, 2017 @03:53AM (#13959699)
Agreed, this is a web api for postgresql - there is nothing REST about it.
Re:PostgREST – A fully RESTful API from any existing Postgre... by dalailambda on Sunday March 26, 2017 @03:18AM (#13959632)
A web page, for example, should not have direct access to the database.
Re:PostgREST – A fully RESTful API from any existing Postgre... by zepolen on Sunday March 26, 2017 @03:45AM (#13959688)
If an app can't have direct access to the database, why would letting it access via a web api be better?
Re:PostgREST – A fully RESTful API from any existing Postgre... by FooBarWidget on Sunday March 26, 2017 @03:59AM (#13959712)
I can think of a few use cases.

- The developer is writing apps in languages that do not have PostgreSQL drivers. Or the available PostgreSQL drivers have major drawbacks. HTTP libraries are pretty much ubiquitous, and the benefits of using HTTP might outweight the drawbacks of the existing drivers or the drawbacks of using HTTP.

- HTTP as a protocol is very good in the sense that there is a lot of tooling around it for load balancing, proxying, security, etc. Depending on the skill level and distribution in the organization, it may make a lot of sense to use HTTP as a protocol for accessing the database so that certain aspects of security, high availability, etc. can be the responsibility of system administrators, rather than developers who must hack into the database driver.

The two use cases above are not theoretical. Someone invented DBSlayer a decade ago, which is like a PostgREST for MySQL. You can read their rationale here: https://open.blogs.nytimes.com/2007/07/25/introducing-dbslay...

And a third use case:

- The author deliberately wants to expose a public database, as a public learning environment of some sort. No production data is stored in the database.

Re:PostgREST – A fully RESTful API from any existing Postgre... by ruslan_talpa on Sunday March 26, 2017 @04:11AM (#13959748)
because the web api (PostgREST) has a strict control on the types of queries the client is allowed to execute thus preventing DOS attack against the db that force it to run complicated/unoptimised joins or function that use a lot of CPU
Re:PostgREST – A fully RESTful API from any existing Postgre... by anticodon on Sunday March 26, 2017 @04:15AM (#13959754)
PostgreSQL has built-in strict control also.
Re:PostgREST – A fully RESTful API from any existing Postgre... by ruslan_talpa on Sunday March 26, 2017 @04:26AM (#13959785)
no it does not, it has control of what data a user can access, it has no control of what types of joins he can do using the tables he has access to or what functions he can execute.

For example anyone can do "select md5(bigtextcolumn) from articles" and kill the db if one would expose the entire sql language to the web. PostgREST protects you agains that.