-
Notifications
You must be signed in to change notification settings - Fork 128
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
Table name collision bug fix #1990
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick fix! Need to make sure MySQL doesn't regress
src/Service.Tests/SqlTests/RestApiTests/Find/FindApiTestBase.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to reuse existing methods
…provider for each data source
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few things to consider:
SourceDefinition
class has a method calledFullName
which returnsschemaName.tableName
. A new method can be introduced that returnsDBname.SchemaName.objectName
.
Advantages with introducing this method
a) This would cover all database object types.
b) Logic of determining the full name would not get repeated at different places.
sourceDefinition.FullName()
and sourceDefinition.FullNameIncludingDbName()
(just example method name) can be used instead of determining the complete name multiple times.
3. This issue was reported for REST Get APIs. But, would be good to test this for other types like POST
, PUT
, etc.
4. This can be an opportunity to validate similar scenarios with GraphQL (This can be a separate issue/PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to fix the test for databasename
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, suggestions to validate few more scenarios as part of a different issue/PR.
- Validating and adding tests for the same bug but with views and stored procedures
- Validating and adding tests for the same bug with GraphQL
src/Service.Tests/SqlTests/RestApiTests/Find/FindApiTestBase.cs
Outdated
Show resolved
Hide resolved
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to handle exceptions, and correct lookups
Looks good to merge once unit tests succeed in pipeline and merged with main. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to merge, tests that include database name in the connection string can be added optionally.
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
## 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
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>
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