hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.17k stars 2.77k forks source link

Need automation support to apply across multiple metadata scripts #7155

Open radha-igtb opened 3 years ago

radha-igtb commented 3 years ago

Hasura team,

Will describe below the scenario, problem statement and the request

Scenario: We have multiple products. Each product is managed and maintained by different teams in independent repos and in unique PG schemas. We also have certain common models that will be required by all products. Our customers usually need more than 1 product at a time. This will imply multiple migration and metadata scripts will need to be run on the same gql engine and pg instance. We cannot expect for all products to be maintained in the same schema and repo.

Problem statement: Lets say there are metadata scripts for 2 different schemas Schema1 and Schema2. Let execute migration and metadata scripts for Schema1. Now lets run the migration and metadata for Schema2. All metadata for Schema1 is lost Request: Ask is to:

  1. Pl ensure metadata is not overwritten for Schema(n-x). And all individual metadata are applied.
  2. OR Provide a tool to merge multiple metadata yawls/scripts. So once all migrations are executed we can run 1 integrated metadata. Intention is to integrate this with the CD pipeline
radha-igtb commented 3 years ago

Discussed with hasura team. 2 approaches discussed:

  1. (Preferred) Pl consider the option to apply metadata by schema? We had discussed this on the call with Sidharth and at the time it looked like a promising option. Meaning, if we are able to provide input about what-schema-to-apply-metadata-for, then metadata for other existing schemas is not disturbed.

  2. If we are still looking at the merge-metadata-script approach then, the final merged output should be a recommendation from Hasura team. Because ultimately Hasura cli will have to use the merged scripts to apply the metadata right?

manasag commented 10 months ago

The V3 architecture pays much attention to metadata authoring and management. It introduces a concept of subgraph which can be modelled to be managed separately by different teams from Ci/CD point of view. You can probably map the subgraph to be backed by tables of only 1 schema. Please do try the alpha version of Hasura V3 to see if this solves your requirement. We would like to get an early feedback.