feat(ado.net): support more schema tables#778
Conversation
Add more standard schema tables to the ADO.NET driver. Also adds integration tests for those schema tables, and a new job for running those integration tests against the Spanner emulator.
There was a problem hiding this comment.
Code Review
This pull request implements schema retrieval for 'Tables', 'Columns', 'Indexes', 'IndexColumns', and 'Foreign Keys' collections from Spanner's INFORMATION_SCHEMA in SpannerSchemaProvider.cs, along with corresponding mock server unit tests and emulator-based integration tests. The review feedback suggests dynamically retrieving the emulator host and port from the SPANNER_EMULATOR_HOST environment variable in the integration tests instead of hardcoding localhost:9010.
| private void FillIndexes(DataTable dataTable, string?[]? restrictionValues) | ||
| { | ||
| dataTable.TableName = "Indexes"; | ||
| var query = "SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, INDEX_NAME, INDEX_TYPE, IS_UNIQUE, IS_NULL_FILTERED, INDEX_STATE FROM INFORMATION_SCHEMA.INDEXES WHERE 1=1"; |
There was a problem hiding this comment.
why WHERE 1=1 is required here? (even in following methods)
There was a problem hiding this comment.
Because we dynamically add filter clauses like AND TABLE_SCHEMA=@schema for these queries. By adding WHERE 1=1 here, we know that we can always safely just add an AND ... clause from this point.
Add more standard schema tables to the ADO.NET driver.
Also adds integration tests for those schema tables, and a new job for running those integration tests against the Spanner emulator.