Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.

docs(samples): add samples for IN, NOT_IN, and != operators. - #312

Merged
Mariatta merged 19 commits into
googleapis:mainfrom
jlara310:in-not-equals-samples
Jun 16, 2022
Merged

docs(samples): add samples for IN, NOT_IN, and != operators.#312
Mariatta merged 19 commits into
googleapis:mainfrom
jlara310:in-not-equals-samples

Conversation

@jlara310

@jlara310 jlara310 commented May 24, 2022

Copy link
Copy Markdown
Contributor

docs: add samples for IN, NOT_IN, and != operators.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #311 🦕

@jlara310
jlara310 requested a review from a team as a code owner May 24, 2022 21:05
@jlara310
jlara310 requested review from a team and engelke May 24, 2022 21:05
@product-auto-label product-auto-label Bot added the size: m Pull request size is medium. label May 24, 2022
@snippet-bot

snippet-bot Bot commented May 24, 2022

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 4 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
@product-auto-label product-auto-label Bot added api: datastore Issues related to the googleapis/python-datastore API. samples Issues that are directly related to samples. labels May 24, 2022
@jlara310

Copy link
Copy Markdown
Contributor Author

Depends on #287

@jlara310 jlara310 changed the title Add samples for IN, NOT_IN, and != operators. May 25, 2022
@jlara310 jlara310 changed the title docs: Add samples for IN, NOT_IN, and != operators. May 25, 2022
@jlara310
jlara310 force-pushed the in-not-equals-samples branch from e3837f9 to 3bd844f Compare May 25, 2022 15:07
@jlara310
jlara310 force-pushed the in-not-equals-samples branch from 3bd844f to 1fc08eb Compare May 25, 2022 15:09
Comment thread samples/snippets_test.py Outdated
@Mariatta Mariatta added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 9, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 9, 2022
@Mariatta Mariatta added the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 9, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 9, 2022
@product-auto-label product-auto-label Bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Jun 9, 2022
@jlara310

Copy link
Copy Markdown
Contributor Author

Now that #287 merged, this is ready for review/merge, too.

@jlara310

Copy link
Copy Markdown
Contributor Author

The project used for testing requires the indexes in samples/index.yaml. Can someone help me add that index to the testing project?

gcloud datastore create index.yaml

@jlara310
jlara310 requested a review from Mariatta June 10, 2022 07:18
@yoshi-kokoro yoshi-kokoro removed kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Jun 10, 2022
@Mariatta

Copy link
Copy Markdown
Contributor

Ok looks like the samples tests are now running, and there are some errors.

@jlara310
jlara310 requested a review from Mariatta June 13, 2022 18:44
@jlara310

Copy link
Copy Markdown
Contributor Author

I saw errors like this one for the unit tests:

details = "Datastore-Native databases do not support IN filters. Upgrade to Datastore-Mode to enable this."

Looks like the testing project is on the legacy Cloud Datastore backend. The new query features are only available for Firestore in Datastore mode. I'm not sure how to resolve this without creating a new testing project.

@jlara310

jlara310 commented Jun 13, 2022

Copy link
Copy Markdown
Contributor Author

Looks like it's just python-docs-samples-tests that is on the legacy back-end. The build-specific projects look to be on Firestore in Datastore mode. Opting into those in the noxfile to use them for testing.

The other projects will also require the new index:

python-docs-samples-tests-py36
python-docs-samples-tests-py37
python-docs-samples-tests-py38
python-docs-samples-tests-py39
python-docs-samples-tests-310

indexes:

  • kind: Task
    properties:
    • name: tag
    • name: tag
@jlara310

Copy link
Copy Markdown
Contributor Author

Added a test fixture to set up the required index if it doesn't already exist. However, I'm now getting this error when attempting to create that index:

"google.api_core.exceptions.PermissionDenied: 403 The caller does not have permission"

Either I didn't set things up quite right or the service account doesn't have index creation permissions on the build-specific test projects.

@jlara310

jlara310 commented Jun 15, 2022

Copy link
Copy Markdown
Contributor Author

I removed the snippets that require an index for now. I'd like to submit the remaining snippets as that will allow me to update the documentation. I can figure out the other two snippets in a follow-up PR.

I'm still failing two checks, but I'm not sure why. Any insights appreciated.

Kokoro — Build failed error:

nox > * docs: failed

Kokoro Prerelease Dependencies error:

ERROR collecting samples/snippets/snippets_test.py
Traceback:
/usr/local/lib/python3.8/importlib/init.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
samples/snippets/snippets_test.py:16: in
import backoff
E ModuleNotFoundError: No module named 'backoff'

@dandhlee dandhlee added the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 15, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 15, 2022
@dandhlee dandhlee added the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 15, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 15, 2022
@jlara310

Copy link
Copy Markdown
Contributor Author

PR should be good to go and ready to merge. Thank you.

if name in ("main", "_preamble", "defaultdict") or not callable(function):
continue

print(name)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just wondering what is the purpose of the prints here?

One of the output is for the pprint:

pprint
<google.cloud.datastore.client.Client object at 0x1096a7820>
None

Perhaps we don't need these prints?

@Mariatta Mariatta changed the title docs: add samples for IN, NOT_IN, and != operators. Jun 16, 2022
@Mariatta

Copy link
Copy Markdown
Contributor

The pre-release dependencies CI is not needed so it's good to merge. Thank you!

@Mariatta
Mariatta merged commit 4170325 into googleapis:main Jun 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: datastore Issues related to the googleapis/python-datastore API. samples Issues that are directly related to samples. size: l Pull request size is large.

4 participants