Home > Backend Development > Golang > ## Can You Access AppEngine Datastore via Cloud Datastore API in Local Development?

## Can You Access AppEngine Datastore via Cloud Datastore API in Local Development?

Barbara Streisand
Release: 2024-10-25 08:02:02
Original
463 people have browsed it

## Can You Access AppEngine Datastore via Cloud Datastore API in Local Development?

Connecting to AppEngine Datastore via Cloud Datastore API in Local Development

While developing an AppEngine application with a combined GCE instance, you may desire to access the datastore from your standalone binary running on GCE locally. To achieve this, you've utilized the google-api-go-client/datastore/v1beta2 library for API-based access. However, this approach faces limitations within the local development environment.

Challenges and Limitations

Connecting to the AppEngine datastore via the Cloud Datastore API is not currently feasible in local development due to several factors:

  • The Google Cloud Datastore tool (gcd.sh) utilizes a Java development server, while AppEngine's Go development server employs a Python server with distinct underlying storage.
  • The Cloud Datastore JSON API, utilized by the Go client library, is not currently supported by the development server.

Workarounds

Despite these limitations, you can develop a Google Cloud Datastore application in Go through alternative approaches:

  • Use the Protocol Version of the API (Protobuf): As suggested by proppy in the given answer, you can employ the Cloud Datastore Protobuf HTTP API in Go. This involves compiling the protobuf definition and sending POST HTTP requests to the appropriate endpoint. However, this workaround requires crafting HTTP requests manually and prevents data sharing between your application and the in-development Cloud Datastore.
  • Explore the Native Go Client Library: Although the Go client library may have bugs, it offers a convenient way to access the Cloud Datastore API. Ongoing development of the library is expected to resolve current issues. However, consider the additional effort required for bug handling and potential setbacks during the development process.

Conclusion

While it's not currently possible to connect to the AppEngine datastore via the Cloud Datastore API in local development, the provided workarounds offer viable alternatives for accessing Cloud Datastore from a standalone Go binary. Remember that these approaches come with their own limitations and may require additional effort for implementation and maintenance.

The above is the detailed content of ## Can You Access AppEngine Datastore via Cloud Datastore API in Local Development?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template