-
Notifications
You must be signed in to change notification settings - Fork 288
Populate DatabaseSchema by reading it from database #282
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
Conversation
|
Both GetSchema and FillSchema are interface of ADO.NET. So it should work with MySQL/PGSQL? |
Thats what Im hoping for. Need to test it. |
…tructor of FileMetadataProvider doesnt complain
Co-authored-by: Aaron Powell <[email protected]>
Co-authored-by: Aaron Powell <[email protected]>
Co-authored-by: Aaron Powell <[email protected]>
Co-authored-by: Aaron Powell <[email protected]>
This reverts commit a4aa11e.
Co-authored-by: Aaron Powell <[email protected]>
Co-authored-by: Aaron Powell <[email protected]>
seantleonard
left a comment
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 adding this! Looks good, just some clarifying questions and comments.
| conn.ConnectionString = _connectionString; | ||
| await conn.OpenAsync(); | ||
|
|
||
| DatabaseSchema.Tables.Clear(); |
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.
Does this cause issues if requests come in between clearing the schema and re-populating it?
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.
It might, I have added this just envisioning we might need to support dynamic changes as per outcome of https://github.com/Azure/project-hawaii/issues/76
I think it might be reasonable to expect issues for a short period until we re-populate it if we decide to support the dynamic changes.
All the changes requested have been addressed. Merging it to unblock future development.
Summary
Today, FileMetadataProvider reads the runtime config file sql-config.json to get and populate DatabaseSchema object. This change implements a
SqlMetadataProviderto read the same information from the database instead.How
DbConnection.GetSchema("Tables")to get all the base tables. Ref : https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-schema-collectionsDbDataAdapter's FillSchema()method to obtain the primary key,IsNullableandIsAutoGeneratedinformation for each of the columns in each table. Ref: https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/adding-existing-constraints-to-a-datasetDefaultcolumn does not return accurate information. So, we have to useDbConnection.GetSchema("Columns")to determine if the column has default value or not.Tests
Added unit tests to verify the DatabaseSchema derived from the database matches what we expect from the runtime config file provider.
Future work: