The 2.0 release of the google-cloud-datastore client is a significant upgrade based on a next-gen code generator, and includes substantial interface changes. Existing code written for earlier versions of this library may require updates to use this version. This document describes the changes that have been made, and what you need to do to update your usage.
If you experience issues or have questions, please file an issue.
Supported Python Versions
WARNING: Breaking change
The 2.0.0 release requires Python 3.6+.
Method Calls
WARNING: Breaking change
If you previously were using modules or functions under the namespace
google.cloud.datastore_v1.gapic there is a high likelihood you have incompatible code.
To assist with this, we have includes some helpful scripts to make some of the code
modifications required to use 2.0.0.
Install the library
python3 -m pip install google-cloud-datastore
The scripts fixup_datastore_v1_keywords.py and fixup_datastore_admin_v1_keywords.py
is shipped with the library. It expects an input directory (with the code to convert)
and an empty destination directory.
In the 2.0.0 release, all methods have a single positional parameter request. Method docstrings indicate whether a parameter is required or optional.
Some methods have additional keyword only parameters. The available parameters depend on the google.api.method_signature annotation specified by the API producer.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["Version latestkeyboard_arrow_down\n\n- [2.21.0 (latest)](/python/docs/reference/datastore/latest/upgrading)\n- [2.20.2](/python/docs/reference/datastore/2.20.2/upgrading)\n- [2.19.0](/python/docs/reference/datastore/2.19.0/upgrading)\n- [2.18.0](/python/docs/reference/datastore/2.18.0/upgrading)\n- [2.17.0](/python/docs/reference/datastore/2.17.0/upgrading)\n- [2.16.1](/python/docs/reference/datastore/2.16.1/upgrading)\n- [2.15.2](/python/docs/reference/datastore/2.15.2/upgrading)\n- [2.14.0](/python/docs/reference/datastore/2.14.0/upgrading)\n- [2.13.2](/python/docs/reference/datastore/2.13.2/upgrading)\n- [2.12.0](/python/docs/reference/datastore/2.12.0/upgrading)\n- [2.11.1](/python/docs/reference/datastore/2.11.1/upgrading)\n- [2.10.0](/python/docs/reference/datastore/2.10.0/upgrading)\n- [2.9.0](/python/docs/reference/datastore/2.9.0/upgrading)\n- [2.8.3](/python/docs/reference/datastore/2.8.3/upgrading)\n- [2.7.2](/python/docs/reference/datastore/2.7.2/upgrading)\n- [2.6.2](/python/docs/reference/datastore/2.6.2/upgrading)\n- [2.5.1](/python/docs/reference/datastore/2.5.1/upgrading)\n- [2.4.0](/python/docs/reference/datastore/2.4.0/upgrading)\n- [2.3.0](/python/docs/reference/datastore/2.3.0/upgrading)\n- [2.2.0](/python/docs/reference/datastore/2.2.0/upgrading)\n- [2.1.6](/python/docs/reference/datastore/2.1.6/upgrading)\n- [2.0.1](/python/docs/reference/datastore/2.0.1/upgrading)\n- [1.15.5](/python/docs/reference/datastore/1.15.5/upgrading)\n- [1.14.0](/python/docs/reference/datastore/1.14.0/upgrading)\n- [1.13.2](/python/docs/reference/datastore/1.13.2/upgrading)\n- [1.12.0](/python/docs/reference/datastore/1.12.0/upgrading)\n- [1.11.0](/python/docs/reference/datastore/1.11.0/upgrading)\n- [1.10.0](/python/docs/reference/datastore/1.10.0/upgrading)\n- [1.9.0](/python/docs/reference/datastore/1.9.0/upgrading) \n\n2.0.0 Migration Guide\n=====================\n\nThe 2.0 release of the `google-cloud-datastore` client is a significant upgrade based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-python), and includes substantial interface changes. Existing code written for earlier versions of this library may require updates to use this version. This document describes the changes that have been made, and what you need to do to update your usage.\n\nIf you experience issues or have questions, please file an [issue](https://github.com/googleapis/python-datastore/issues).\n\nSupported Python Versions\n-------------------------\n\n\u003e **WARNING**: Breaking change\n\nThe 2.0.0 release requires Python 3.6+.\n\nMethod Calls\n------------\n\n\u003e **WARNING**: Breaking change\n\nIf you previously were using modules or functions under the namespace\n`google.cloud.datastore_v1.gapic` there is a high likelihood you have incompatible code.\nTo assist with this, we have includes some helpful scripts to make some of the code\nmodifications required to use 2.0.0.\n\n- Install the library\n\n python3 -m pip install google-cloud-datastore\n\n- The scripts `fixup_datastore_v1_keywords.py` and `fixup_datastore_admin_v1_keywords.py` is shipped with the library. It expects an input directory (with the code to convert) and an empty destination directory.\n\n $ fixup_datastore_v1_keywords.py --input-directory .samples/ --output-directory samples/\n $ fixup_datastore_admin_v1_keywords.py --input-directory .samples/ --output-directory samples/\n\n### More Details\n\nIn `google-cloud-datastore\u003c2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters.\n\n**Before:** \n\n def a_method(\n self,\n param1,\n param2,\n param3,\n retry=google.api_core.gapic_v1.method.DEFAULT,\n timeout=google.api_core.gapic_v1.method.DEFAULT,\n metadata=None,\n ):\n\nIn the 2.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional.\n\nSome methods have additional keyword only parameters. The available parameters depend on the `google.api.method_signature` annotation specified by the API producer.\n\n**After:** \n\n def a_method(\n self,\n request: RequestType = None,\n *\n param1,\n param2,\n param3,\n retry=google.api_core.gapic_v1.method.DEFAULT,\n timeout=google.api_core.gapic_v1.method.DEFAULT,\n metadata=None,\n ):\n\n\u003e **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive.\n\u003e Passing both will result in an error.\n\nBoth of these calls are valid: \n\n response = client.a_method(\n request={\n \"param1\": param1,\n \"param2\": param2,\n \"param3\": param3\n }\n )\n\n response = client.a_method(\n param1=param1,\n param2=param2,\n param3=param3\n )\n\nThis call is invalid because it mixes `request` with a keyword argument `param1`. Executing this code\nwill result in an error. \n\n response = client.a_method(\n request={\n \"param1\": param1,\n \"param2\": param2\n },\n param2=param2\n )\n\nEnums and Types\n---------------\n\n\u003e **WARNING**: Breaking change\n\nThe `enums` submodule has been removed.\n\n**Before:** \n\n from google.cloud import https://cloud.google.com/python/docs/reference/datastore/latest/_v1\n\n direction = datastore_v1.enums.CommitRequest.Mode.TRANSACTIONAL\n\n**After:** \n\n from google.cloud import https://cloud.google.com/python/docs/reference/datastore/latest/_v1\n\n direction = datastore_v1.types.CommitRequest.Mode.TRANSACTIONAL"]]