graphjin
graphjin copied to clipboard
Per-table schema setting
What would you like to be added:
something like:
roles:
- name: user
tables:
- name: users
schema: my_schema
query:
filters: ["{ id: { _eq: $user_id } }"]
Why is this needed:
Under the "roles" config params, you can specify users and tables, but if your table is in a schema that is different from the one specified at the top of the yaml file, there's no way to access it.
Different tables can live in different schemas. At the moment I think super-graph assumes all your data is architected into one schema.
Interesting I didn't expect tables across schema's. Can I ask the reason behind putting tables in separate schema's
It helps with organizing data, making clear lines between data ownership, etc.
For example, imagine two schemas with the tables
schema s_public
- users
- comments
schema s_admin
- abuse_reports
The s_admin.reports table contains a list of reports of abuse people have made about other users. That would never be accessible to the public, only internally, so we put it in its own schema. However, we still use the same graphql server to access the data, because you still want to get users data (i.e. by joining the s_admin.abuse_reports table on the s_public.users table.)