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

support for accessing multiple postgres database in graphql #821

Closed
sandipmavani opened this issue Oct 19, 2018 · 14 comments
Closed

support for accessing multiple postgres database in graphql #821

sandipmavani opened this issue Oct 19, 2018 · 14 comments
Labels
c/console Related to console c/server Related to server

Comments

@sandipmavani
Copy link

If possible also need dynamic change instance or database on runtime.

@revskill10
Copy link

@sandipmavani I think schema stitching is the way in this case.

@0x777 0x777 added c/console Related to console c/server Related to server p/longterm Low priority issues that will be picked up based on user feedback or bandwidth labels Oct 23, 2018
@ecthiender ecthiender changed the title Need support for access multiple postgresql database in graphql Need support for accessing multiple postgres database in graphql Mar 13, 2019
@ecthiender ecthiender changed the title Need support for accessing multiple postgres database in graphql support for accessing multiple postgres database in graphql Mar 13, 2019
@RAbraham
Copy link

graphql newbie here. My understanding of schema stitching is that it allows one to combine different schemas together from disparate sources. My use case here is that I want multi-tenancy within the same database instance by assigning a different database to a different user(of course, my solution may not be the best one for multitenancy, but I'm making a demo)

@ecthiender
Copy link
Member

ecthiender commented Mar 20, 2019 via email

@RAbraham
Copy link

@ecthiender Unfortunately, a schema per user is not enough. I need to allow users to create multiple schemas.

@coco98
Copy link
Contributor

coco98 commented Mar 22, 2019 via email

@jvice152
Copy link

i have a similar use case.

I cant speak for @sandipmavani , but we are isolating tenants on a database level. Id love to do schema but I dont think schea stitching is scalable as we add more and more tenants in. I also don't see the reason for holding N copies of a schema in memory when they are all the same, this would just hammer startup time/performance etc. It would be wonderful to be able to switch schemas at runtime, or provided in an optional header/argument

@RAbraham
Copy link

@coco98, just to give you context I'm making a demo/prototype platform. While there are advanced multi tenancy options available, the fastest thing I can think of is creating a database per person. Compared to the single database for multiple users with each having his own schema, the issues is that I think I have are:

  • schemas become global namespaces. if one user wants to create a schema securities.stock, he'll have to append his username(or something similar) rabraham_securities.stock which is not bad but I prefer that they don't have to :)
  • I'll have to ensure that each person can view/edit/delete schemas and data that they have access to(and not others) which would need additional code that I have to build. Right now, a separate database makes this easy.
  • I'm not 100% sure of this one but it'll be easier for me to predict how much data each person is using and limit or charge based on storage if I use a separate database for now?

Let me know if you can think of better solutions.

Solving this ticket may be a long term solution and I, of course, speak without understanding the complexity, but could it be a matter of having another field called database_name in your api?

@marionschleifer marionschleifer added the k/ideas Discuss new ideas / pre-proposals / roadmap label Jul 10, 2019
@ZhangShurong
Copy link

any updates?

@gwert
Copy link

gwert commented Jan 28, 2020

Maybe not the simplest and cleanest option for everyone (or even this use case), but the foreign-data wrapper module (postgres_fdw) might be a way to solve this problem for some.

@fjdelaba
Copy link

Hi, has anyone found a solution for this?

@HuxleyMc
Copy link

HuxleyMc commented Nov 4, 2020

Hi, has anyone found a solution for this?

This blog post from Hasura explains it well

https://hasura.io/blog/remote-joins-a-graphql-api-to-join-database-and-other-data-sources/

@tirumaraiselvan
Copy link
Contributor

tirumaraiselvan commented Nov 4, 2020

Hey folks,

This will be possible in v1.4. We also demo'ed the preview in the last 2 community calls: https://www.youtube.com/watch?v=8rfAkAiE2_I&ab_channel=Hasura

@tirumaraiselvan tirumaraiselvan removed their assignment Nov 4, 2020
@tirumaraiselvan tirumaraiselvan removed k/ideas Discuss new ideas / pre-proposals / roadmap p/longterm Low priority issues that will be picked up based on user feedback or bandwidth labels Nov 4, 2020
@tirumaraiselvan
Copy link
Contributor

This is now released in v2.0.0 (currently in alpha): https://github.com/hasura/graphql-engine/releases/tag/v2.0.0-alpha.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/console Related to console c/server Related to server
Projects
None yet
Development

No branches or pull requests

14 participants