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

chore(docs): add basic samples for async data client #940

Merged
merged 24 commits into from
Mar 18, 2024

Conversation

daniel-sanche
Copy link
Contributor

@daniel-sanche daniel-sanche commented Mar 6, 2024

This PR adds

  • samples for the new async data client to match the samples in the Write examples and Read examples sections of the public docs.
    • All samples are as similar as possible to existing ones, with the addition of *_async_* to the region tag
  • a new async version of the hello world sample

Currently missing are the samples on the Use filters and Deletes pages. Let me know if you want me to add those as well

@product-auto-label product-auto-label bot added size: l Pull request size is large. api: bigtable Issues related to the googleapis/python-bigtable API. samples Issues that are directly related to samples. labels Mar 6, 2024
@daniel-sanche daniel-sanche changed the title [DRAFT] chore(docs): add basic samples for async data client chore(docs): add basic samples for async data client Mar 8, 2024
@daniel-sanche daniel-sanche marked this pull request as ready for review March 8, 2024 01:27
@daniel-sanche daniel-sanche requested review from a team as code owners March 8, 2024 01:27
@daniel-sanche daniel-sanche requested a review from rsamborski March 8, 2024 01:27
Copy link

snippet-bot bot commented Mar 8, 2024

Here is the summary of changes.

You are about to add 20 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

samples/hello/async_main.py Outdated Show resolved Hide resolved
samples/hello/async_main.py Outdated Show resolved Hide resolved
samples/hello/async_main.py Outdated Show resolved Hide resolved
family_id = "stats_summary"

async with table.mutations_batcher(
flush_limit_mutation_count=2, flush_limit_bytes=1024
Copy link
Contributor

Choose a reason for hiding this comment

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

should we add a comment here saying the default is 100 and is good for most use cases, setting it to 2 just for the example purpose?
Or we don't change the defaults here, and just manually flush in the end. And I would also add some comments on why manual flush is needed, something like "flush will be called automatically when a batch is full, the default batch size is 100".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, maybe I'll remove the arguments here if that's confusing. A manual flush isn't needed since we are using a async with statement, it will flush and close everything for us at the end of this block

Let me know if you think any extra comments are needed to clarify anything

)
batcher.append(
RowMutationEntry("tablet#a0b81f74#20190502", mutation_list)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to flush?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, we're using a context manager (async with), so it will automatically call close for us at the end of the block

@daniel-sanche daniel-sanche added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 18, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 18, 2024
@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels Mar 18, 2024
@daniel-sanche daniel-sanche merged commit 390b059 into googleapis:main Mar 18, 2024
27 of 29 checks passed
@daniel-sanche daniel-sanche deleted the data_client_samples branch March 18, 2024 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the googleapis/python-bigtable API. samples Issues that are directly related to samples. size: xl Pull request size is extra large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants