Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency between "Dynamic" routing and "static" graphQL types #10209

Open
arvind-fluxon opened this issue Apr 18, 2024 · 0 comments
Open
Labels
k/enhancement New feature or improve an existing feature

Comments

@arvind-fluxon
Copy link

arvind-fluxon commented Apr 18, 2024

Is your proposal related to a problem?

Hasura has a clear segregation of database routing using request headers / JWT claims to route to the right destined DB. However, if the schema for the databases remain the same all across, we are forced to use the custom_name for tables or to have different namespaces. The downside to this approach is, the clients (could be UI or other services) have a well bound statically type-checked GraphQL schema, that makes it easy to access their data via Hasura GraphQL engine. However, when we introduce these custom_names for each of the tables, we lose the ability for static typing and Hasura expects us to have Dynamic Types here.
This is clearly not an easy way out with say a multi-tenant distinct database approach.

The effects of this problem are:

  1. Say, I have two different databases (same DB schema for both) and we are using Dynamic routing to query the right database
  2. In order for Hasura to "Track" and make them available for GraphQL queries, we are forced to have a custom_name for each type
  3. Now, if we proceed with this idea, we are forced to regenerate the client graphQL schema everytime there are additions and new custom types.
  4. This also makes the client to be "tenant-aware" / "dynamic-schema aware", which contradicts with the "dynamic-routing" in principle.

Describe the solution you'd like

If the dynamic routing is defined, it makes sense for Hasura to auto-namespace within and not force the external service to be aware of the custom types.

@arvind-fluxon arvind-fluxon added the k/enhancement New feature or improve an existing feature label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k/enhancement New feature or improve an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant