3 ms·
You can allow users to write direct SQL queries or use SQL as API if the database server does all of the following: 1. Access control. Table and column-level
by zX41ZdbW 3y ago
You can allow users to write direct SQL queries or use SQL as API if the database server does all of the following:
1. Access control.
Table and column-level access control. Row-level restrictions by expressions.
Out-of-band table filters that the user cannot override in the query.
2. Query complexity restrictions.
Allow queries only using the index. Restrict the maximum number of records to scan. Limit the max query runtime or maximum memory consumption.
Out-of-band limiting on the result size.
3. Rate limiting.
Limit the number of rows or bytes scanned over a period of time for a user, for an IP address or IP subnet.
4. Interfaces and formats.
CORS headers. HTTP compression. TLS. Proxy protocols.
JSON with metadata, Protobuf, etc.
TLDR. It works with ClickHouse; it is doubtful with other DBMS.
- valenterry 3y agoI'm afraid this might not be sufficient. For example, you might have a table "users" but while "admins" can see all users, "moderators" might only be allowed to see the users of their moderated areas. As soon as this kind of flexibility is needed, solutions like Postgrest stop working - they are just not made for that level of customization.
- ruslan_talpa 3y agoYou are wrong on both statements :) It does not stop working and this “customization” is easy.