Add support for only reading tables from specified schemas
Currently if we try to graphjin as library, we need to call core.NewGraphJin() with a config value and db object. But there's no way to specify a postgres schema for which we want to generate the Graphql.
Is it possible?
If no, any ideas about how should we implement it? (I want contribute in it)
If you're using the serv package then you can set a schema but in core you have to set the schema on the db object before passing it to core.NewGraphJin(). There is no way in go to set the schema on the db object. This is how we do it in the 'serv package https://github.com/dosco/graphjin/blob/dea9e1a1959dcc7d7c47df15cae7c8206a57a292/serv/db.go#L146
I actually looked into the code and even using a different schema for the serv package was not preventing it from generating graphql queries, mutations etc for other schemas. So I don't think it will be a small change and I don't think it's worth time and effort for now.
For me personally, I'll be participating in a hackathon with different databases, rather than schemas so that will solve my problem for now.
Did you want to limit it to one schema? The discovery code pulls in everything since I want to allow folks to query across schemas.
We are running to a similar issue. We use IntrospectionQuery to query the schema but currently it returns schema for all tables in the database. The problem is that we have one Postgres table in public schema that has 100 partitions in another schema in the same database. Currently the IntrospectionQuery returns schema for all tables in the database resulting in a huge and hard to process response.
We need a way to limit the IntrospectionQuery output just to the a single database schema. In case of normal queries and mutations one can use RoleTable in engine configuration to control which tables will be queryable. This does not seem to affect the IntrospectionQuery though.
We now have a @schema(name: "blah") selector level directive.