-
Notifications
You must be signed in to change notification settings - Fork 126
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
[Bug]: DAB seems to have issues with tables in different schemas that have the same name (SQL Server) #1908
Comments
aaronburtle
added a commit
that referenced
this issue
Feb 28, 2024
## Why make this change? Closes #1908 ## What is this change? We were previously filling the schema information for the entity data set but only using the table name. We add in the schema name to deconflict between two tables with the same name in different schemas. This means that we retrieve information from the entity data set by using schema and tablename when schema is available, and just the table name otherwise. The reason that we do not need to worry about collisions at the schema and table name level (eg. where we have the same schema and table names within different databases) is because this entity data set is a part of the SqlMetadataProvider, and we have a SqlMetadataProvider for each database (not database type but actual DBs). ## How was this tested? A regression test with a collision between table names in different schemas was added. We also update the unit test for SqlMetadatProvider. ## Sample Request(s) see #1908
seantleonard
pushed a commit
that referenced
this issue
Mar 1, 2024
## Why make this change? Closes #1908 ## What is this change? We were previously filling the schema information for the entity data set but only using the table name. We add in the schema name to deconflict between two tables with the same name in different schemas. This means that we retrieve information from the entity data set by using schema and tablename when schema is available, and just the table name otherwise. The reason that we do not need to worry about collisions at the schema and table name level (eg. where we have the same schema and table names within different databases) is because this entity data set is a part of the SqlMetadataProvider, and we have a SqlMetadataProvider for each database (not database type but actual DBs). ## How was this tested? A regression test with a collision between table names in different schemas was added. We also update the unit test for SqlMetadatProvider. ## Sample Request(s) see #1908
seantleonard
added a commit
that referenced
this issue
Mar 4, 2024
Cherry picks to `release/0.11` from `main` ## Why make this change? Closes #1908 ## What is this change? We were previously filling the schema information for the entity data set but only using the table name. We add in the schema name to deconflict between two tables with the same name in different schemas. This means that we retrieve information from the entity data set by using schema and tablename when schema is available, and just the table name otherwise. The reason that we do not need to worry about collisions at the schema and table name level (eg. where we have the same schema and table names within different databases) is because this entity data set is a part of the SqlMetadataProvider, and we have a SqlMetadataProvider for each database (not database type but actual DBs). ## How was this tested? A regression test with a collision between table names in different schemas was added. We also update the unit test for SqlMetadatProvider. Co-authored-by: aaronburtle <93220300+aaronburtle@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What happened?
I have two tables with the same name, in two different schemas, in the same database:
schema1.tablename and
schema2.tablename
I add them both to the "entities" section in dab-config.json, like this:
"schema1_tablename": {
"source": "schema1.tablename",
"permissions": [
{
"actions": [""],
"role": "anonymous"
}
]
},
"schema2_tablename": {
"source": "schema2.tablename",
"permissions": [
{
"actions": [""],
"role": "anonymous"
}
]
},
When I try to query the first using REST via /api/schema1_tablename, I get the right answer: a list of the rows.
When I try to query the second using REST via /api/schema2_tablename I get an error 500 that says "Invalid Column Name". The column it names is a valid column in the schema1 table, but not in the schema2 table.
If I reverse the order of the entities in the dab-config.json, then I can query the schema2 table, but not the schema1 table. So, even though in the configuration I am providing the full name of the table using schema.tablename format, it doesn't seem capable of distinguishing between tables that have the sane tablename, even if the schema is different.
Version
Microsoft.DataApiBuilder 0.9.7+e560142426d1c080b9fd7b7fabff51a276f6bf61
What database are you using?
Azure SQL
What hosting model are you using?
Local (including CLI), Static Web Apps (SWA)
Which API approach are you accessing DAB through?
REST
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: