Skip to content
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

Replace Cosmos Db metadata query with container query #2215

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LeeAtCfc
Copy link

@LeeAtCfc LeeAtCfc commented May 15, 2024

What this PR does / why we need it:
Run a container query rather than a metadata query if containers are specified

Which issue(s) this PR fixes:
Execution of Cosmos Db account metadata queries that can result in throttling errors

Please reference the issue this PR will close: #[462]

Special notes for your reviewer:

Does this PR introduce a user-facing change?:
Implementation change of existing functionality

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Unit tests passing
  • End-to-end tests passing
  • Extended the documentation
  • Provided sample for the feature

Run a container query rather than a metadata query if containers are  specified
@LeeAtCfc
Copy link
Author

@dotnet-policy-service agree company="CFC Underwriting"

@LeeAtCfc LeeAtCfc changed the title Don't run metadata query Replace Cosmos Db metadata query with container query May 15, 2024
@AButcherCFC
Copy link

@adamsitnik

{
var container = _cosmosClient.GetContainer(_options.DatabaseId, containerId);
var query = new QueryDefinition($"SELECT 1 FROM {containerId}");
using var queryStream = container.GetItemQueryStreamIterator(query);

Choose a reason for hiding this comment

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

Don't you need to call .ReadNextAsync() to execute the operation against the container?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants