Skip to content

[Bug]: autoentities does not honor schema #3455

@Aniruddh25

Description

@Aniruddh25

What happened?

What happened?

I had two tables names magazines in 2 different schemas:
foo.magazines and bar.magazines

Configuration used:

"entities": {},
 "autoentities": {
   "default": {
     "template": {
       "mcp": { "dml-tools": true },
       "rest": { "enabled": true },
       "graphql": { "enabled": true },
       "health": { "enabled": true },
       "cache": {
         "enabled": false
       }
     },
     "permissions": [
       {
         "role": "anonymous",
         "actions": [
           "create", "read", "update", "delete"
         ]
       }
     ]
   }
 }

dab could not start.

Saw this error:

fail: Azure.DataApiBuilder.Service.Startup[0]
   Unable to complete runtime initialization. Refer to exception for error details.
   **Azure.DataApiBuilder.Service.Exceptions.DataApiBuilderException: Entity with name 'magazines' already exists. Cannot create new entity from autoentity pattern with definition-name 'default'.**
      at Azure.DataApiBuilder.Core.Services.MsSqlMetadataProvider.GenerateAutoentitiesIntoEntities(IReadOnlyDictionary`2 autoentities) in /_/src/Core/Services/MetadataProviders/MsSqlMetadataProvider.cs:line 358
      at Azure.DataApiBuilder.Core.Services.SqlMetadataProvider`3.InitializeAsync() in /_/src/Core/Services/MetadataProviders/SqlMetadataProvider.cs:line 336
      at Azure.DataApiBuilder.Core.Services.MetadataProviders.MetadataProviderFactory.InitializeAsync() in /_/src/Core/Services/MetadataProviders/MetadataProviderFactory.cs:line 95
      at Azure.DataApiBuilder.Service.Startup.PerformOnConfigChangeAsync(IApplicationBuilder app) in /_/src/Service/Startup.cs:line 1209
fail: Azure.DataApiBuilder.Service.Startup[0]
   Could not initialize the engine with the runtime config file: dab-config.json

When I deleted one of the magazines tables, dab started. This means the autoentities feature does not honor schema when comparing entity names.

Version

2.0.0-rc

What database are you using?

Azure SQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

No response

Relevant log output


Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Labels

2.0bugSomething isn't workingtriageissues to be triaged

Type

Projects

Status

Todo

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions