Hello folks,
I am trialing Hasura on a legacy database.
Current server version: v1.1.1
Latest stable server version: v1.1.1
Console asset version: 1585320727535
I have a constraint that I cannot make any schema changes
I would love to learn if there is an option for me to use Hasura to achieve the following
Ability to hide columns from appearing in the schema
When I track a table all the columns in the table becomes available in the GraphQL schema.
Some of the columns store ids to foreign tables which is already factored in by foreign key relationships, I would like to hide those columns to have a clean Graphql type
Rename tables
Some of the tables have cryptic names that are not understandable by the consumer of the GraphQL schema, I want to rename them in the GraphQL Schema
Thanks,
Soney
Hi @soneymathew
select permissions: https://hasura.io/docs/1.0/graphql/manual/auth/authorization/permission-rules.html#column-level-permissions(We are also thinking about global permissions which would let you configure this automatically for all roles essentially: https://github.com/hasura/graphql-engine/issues/280)
Thanks @tirumaraiselvan
Does it avoid it from appearing in schema anymore?
What I wanted to do is Table name renaming instead of Field name renaming :)
You can use "Custom GraphQL Root Fields" feature in the table modification tab to change the table name values in the schema:

After changing user resolver for select to new_user_name:

Does this help?
Does it avoid it from appearing in schema anymore?
Yes, if you using the role (by providing x-hasura-role header, say), then only part of the schema which has permission to will appear. Hasura has Role Based Schemas: https://hasura.io/docs/1.0/graphql/manual/auth/authorization/roles-variables.html#roles
What I wanted to do is Table name renaming instead of Field name renaming :)
Ah, not yet but very soon: https://github.com/hasura/graphql-engine/issues/3811
But as @GavinRay97 showed above, you can also manually change the names for each of the field that uses the table name.
Thanks for the guidance @tirumaraiselvan / @GavinRay97 馃檹
I will follow #3811 for updates.
Most helpful comment
Yes, if you using the role (by providing
x-hasura-roleheader, say), then only part of the schema which has permission to will appear. Hasura has Role Based Schemas: https://hasura.io/docs/1.0/graphql/manual/auth/authorization/roles-variables.html#rolesAh, not yet but very soon: https://github.com/hasura/graphql-engine/issues/3811
But as @GavinRay97 showed above, you can also manually change the names for each of the field that uses the table name.