Skip to content

Data Api Builder support for multiple databases. - #1709

Merged
rohkhann merged 57 commits into
mainfrom
rohkhann/MultipleSourceSupport
Sep 28, 2023
Merged

Data Api Builder support for multiple databases.#1709
rohkhann merged 57 commits into
mainfrom
rohkhann/MultipleSourceSupport

Conversation

@rohkhann

@rohkhann rohkhann commented Sep 11, 2023

Copy link
Copy Markdown
Contributor

Why make this change?

This change brings the functionality of multiple datasource support to core engine of DAB. The multi source support is for graphql only and this pr does not address support for REST.

RFC: #1638

What is this change?

  1. changes to DI - introducting factory classes where applicable as for multiple db's we have multiple instances of various class objects
  2. Document generation handling for multiple dbs.
  3. Routing Queries/Mutations to appropriate db using db name pulled from entityName.

How was this tested?

UnitTests:

  1. Added runtimeConfig loader tests for multi-datasource loading. Both positive and negative tests.
  2. Deserialization tests for Data-Source Files converter.
  3. Query and mutation builder tests
  4. MultiSource query execution unit test.
    Integration test:
  5. Single db integration test done.
  6. multiple db integration test:
image

In the above books belongs to one mssql db and authors belongs to another mssql db.
6. Integration test also ran with 3 databases.

Comment thread src/Service.Tests/Authorization/AuthorizationHelpers.cs Outdated
Comment thread src/Service.Tests/ModuleInitializer.cs
Comment thread src/Service.Tests/Unittests/MultiSourceQueryExecutionUnitTests.cs Outdated
Comment thread src/Service.Tests/Unittests/MultiSourceQueryExecutionUnitTests.cs Outdated
Comment thread src/Service.Tests/Unittests/MultiSourceQueryExecutionUnitTests.cs
Comment thread src/Service.Tests/Unittests/MultiSourceQueryExecutionUnitTests.cs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just few more comments, approving with the assumption they'll be resolved :)

Comment thread src/Cli.Tests/ModuleInitializer.cs Outdated
Comment thread src/Config/ObjectModel/RuntimeConfig.cs
Comment thread src/Core/Configurations/RuntimeConfigProvider.cs
Comment thread src/Core/Resolvers/SqlQueryEngine.cs
Comment thread src/Core/Services/OpenAPI/OpenApiDocumentor.cs
Comment thread src/Service.Tests/MultiSourceTestSchema.gql
Comment thread src/Config/ObjectModel/RuntimeConfig.cs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just few more comments, approving with the assumption they'll be resolved :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to go back an look at resolved comments for context. But this review covers both engine/cli/tests components.

Comment thread src/Core/Configurations/RuntimeConfigProvider.cs Outdated
Comment thread src/Core/Services/RestService.cs Outdated
Comment thread src/Service.GraphQLBuilder/GraphQLUtils.cs
Comment thread src/Service.Tests/Configuration/ConfigurationTests.cs Outdated
Comment thread src/Service.Tests/Configuration/RuntimeConfigLoaderTests.cs Outdated
Comment thread src/Service.Tests/Unittests/MultiSourceQueryExecutionUnitTests.cs Outdated
Comment thread src/Service.Tests/Multidab-config.CosmosDb_NoSql.json
Comment thread src/Service.Tests/Multidab-config.CosmosDb_NoSql.json
Comment thread src/Service.Tests/Multidab-config.CosmosDb_NoSql.json
Comment thread src/Cli.Tests/ModuleInitializer.cs Outdated
Comment thread src/Config/ObjectModel/RuntimeConfig.cs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pending one last suggestion and a comment from a OSS community member.

Comment thread schemas/dab.draft.schema.json Outdated
Co-authored-by: Sean Leonard <sean.leonard@microsoft.com>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for all of your efforts addressing review feedback after designing and implementing this solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants