Skip to content

Conversation

rohkhann
Copy link
Contributor

@rohkhann rohkhann commented Mar 18, 2024

Why make this change?

During the call to executeQuery, if DataSource Name is not specified, the query will execute against the default dB. Currently this option is an optional argument. This can lead to caller not sending the DataSource Name as the method does not require it.

If used incorrectly, it will then execute against the default db which can lead to errors during multi-db scenario. For example, in SQLMetadataProvider, we have the queryexecutor call executequeryAsync for readonly columns. Currently, that does not specify the datasource as it is not required by the method. This means that will always execute against the default db, even though the datasourceName property is available on the SQLMetadataprovider which tells you which db to execute this query against.

currently we execute the query against the default db (this was done to maintain backward compatibility for single source scenarios). In this change, we make it mandatory to specify the datasource name during a call to executequeryAsync. String.Empty or null can be sent if query is to be executed against default db.

What is this change?

  1. Change the executeAsync call to explicitly require for the the dbname. The executeAsync in the queryExecutor is the final call made to actually execute the query against the underlying db. By this time in both rest and GQL, we have either determined the dbname or gone with the default db name.
  2. Updates to all callers to specify dbname explicitly.

How was this tested?

  1. Existing test cases are updated to account for mandatory passing of the datasourceName.
  2. Integration test done.

@rohkhann
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@rohkhann
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@rohkhann
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@rohkhann
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Contributor

@aaronburtle aaronburtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@rohkhann rohkhann merged commit 31429e5 into main Mar 18, 2024
@rohkhann rohkhann deleted the rohkhann/SetDataSourceNameDuringPopulateColumnDefinitionAsync branch March 18, 2024 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants