graphql-engine: [v2.0.0-alpha.3] Hasura fails to track tables with the same name from different databases
We currently have a multi-tenant application were each tenant has its own Postgres database. This is exposed via a Graphql API, the URL path /tenant-id/graphql determines which tenant you are trying to reach. Currently in Hasura [v2.0.0-alpha.3] its not possible to track tables that share the same name from multiple databases. I’m assuming this will be supported (likely by prefixing the graphql operations), but what about this kind multi-tenant model, were the tenants share the same data structure, but need to be completely isolated (sometimes data has to be geographically allocated in different areas due to some laws). Is filtering the graphql database by header or URL param in the picture?
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 9
- Comments: 17 (4 by maintainers)
@tirumaraiselvan Is there a PR/RFC for fixing the issue with tracking tables with same name from multiple databases. Most databases will have at least one table name that matches.
Similar to schema, can we add the databaseName_schemaName_tableName as the naming standard for all below routes.
Also provide the option to give Custom GraphQL Root Fields when creating a table itself and not just in Modify tab.
Is filtering the database in the picture? I am also in the same boat as @niranjan94 where each user has its own “clone” of a database. For our use case, this would ideally be filtered based on a claim in a JWT.
In my case it is not feasible to rename each table for every user/table combination. I see that renaming at the database source level is an option. Is it possible for this to be combined with filtering?
👍🏻
Unless I’m missing something, Hasura 2 cannot run multi-tenancy at all until this issue is addressed. (Multi-tenancy was the #1 use-case mentioned in the announcement blog post).
We tried setting unique name for all the routes in @amnaveenriaz 's screenshot above, but it wasn’t enough. When we tried to track the same table from an additional database, there was still a conflict in the
{schema name}_{table name}_connectionfield of the selection set, and we couldn’t figure out a way to assign custom names to that particular field.How do you access the screen from https://github.com/hasura/graphql-engine/issues/6648#issuecomment-796389528 ? I am trying to add another database with conflicting table names, and unable to figure out how to resolve it
@dmoverton oh that’s great. Sorry I hadn’t looked properly 😄 thought it will be available only in the next versions. Thanks for pointing it out.
Tried setting a custom name and I’m able to successfully connect to multiple databases 😃