graphjin icon indicating copy to clipboard operation
graphjin copied to clipboard

Per-table schema setting

Open warent opened this issue 4 years ago • 2 comments

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.

warent avatar Aug 01 '20 19:08 warent

Interesting I didn't expect tables across schema's. Can I ask the reason behind putting tables in separate schema's

dosco avatar Aug 01 '20 20:08 dosco

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.)

warent avatar Aug 01 '20 20:08 warent