用于App Engine上的云数据存储的客户端库 - NDB或谷歌云数据存储 [英] Client Library for Cloud Datastore on App Engine - NDB or google-cloud-datastore

查看:155
本文介绍了用于App Engine上的云数据存储的客户端库 - NDB或谷歌云数据存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据Google的文档,似乎我有两个使用Python连接到数据存储的主要选项:App Engine的NDB数据存储库和Google Cloud Datastore API。



我目前使用的是App Engine(标准版),但是我想要构建我的应用程序,以便在需要时可以扩展,可能通过迁移到计算引擎。考虑到这一点,我应该使用哪个库? App引擎的文档指出可以使用NDB,但它似乎不再被非常积极地开发。在撰写本文时,最后一次提交是在6个月前完成的,尽管看起来他们可能以前是规划一些扩展。一切最终都会转而使用Google Cloud Datastore API吗?如果NDB正在被淘汰,我真的不想开发它的依赖。



我还没有给它一个镜头,但似乎使用App Engine中完整的Google Cloud Datastore API 可能如果有人在App Engine-Standard上使用Google Cloud Datastore API的经验,我很乐意听到您的声音。想法。

编辑 - 2016-11-30 - 唯一性
$ b

被标记为与这一个类似。虽然有一些相似之处,但我特别提到想要选择一种解决方案,以允许在App Engine之外轻​​松增长。在这一点上,我假设NDB库仅适用于App Engine,所以如果我超越App Engine,它将无法正常工作。但是,我认识到,在App Engine上使用NDB可能仍然有优势,如果超出范围,则可以交换到Cloud Datastore API。我有一些相关的,更具体的问题包括:


  • NDB和Cloud Datastore API相似程度相当,后来从一个移到另一个会不会有问题?也许有人已经这样做了,并且可能有意见。

  • NDB真的在App Engine上有什么特别的理由吗?性能?

  • 由于NDB使用云数据存储,我应该担心它最终会停止使用吗? Google已经将App Engine与最近的其他云计算产品联系起来,并且最近NDB repo还没有看到很多更新的事实让我担忧。 Google会不时停止这些操作。



谢谢。

解决方案

继阅读之后,我会继续回答自己的问题,希望能为其他人带来好处。

阅读完整的有关google-cloud-python的讨论,我的很多人问题可以在某种程度上得到解答。

首先,开发人员对项目的看法似乎是,但是性能将会是比NDB差。这当然是在数据存储API上使用NDB的原因。

第二,这听起来像开发人员认为NDB既复杂又相当成熟,一致支持将其最终纳入Cloud Datastore python库。因此,NDB似乎不会停止。最有可能的是,它最终可能需要从更广泛的gcloud库集合中包含。

第三,开发人员指出正在积极开发App Engine之外的NDB支持,所以如果我的项目超出App Engine,NDB可能已经在其他环境中可用,因此不需要切换到Cloud Datastore API。此外,超越标准App Engine的下一步是灵活环境,其中似乎已经很好地支持NDB了。



所有这些都说明我应该清楚地推进NDB,从其更好的性能和ORM功能中受益App Engine,除非谷歌对此事的意见/指示在未来发生变化,否则我很可能会选择在Google Cloud的其他环境中继续使用NDB。我打算使用NDB,并期待它最终纳入google-cloud-python。



如果有人有任何额外的经验,我很乐意听听你的想法。


Per Google's documentation, it seems like I have two main options for connecting to Datastore using Python: App Engine's NDB Datastore library, and the Google Cloud Datastore API for Python.

I'm currently on App Engine (Standard), but I'd like to structure my app such that it can grow beyond if required, likely via a move to Compute Engine. With that in mind, which library should I use? App engine's documentation states that NDB can be used, but it doesn't seem to be very actively developed anymore. At time of writing the last commit was over 6 months ago, though it seems they may have previously been planning some expansion. Will everything eventually switch to use the Google Cloud Datastore API instead? If NDB is being phased out, I really don't want to develop a dependency on it.

I haven't given it a shot yet, but it seems that using the full Google Cloud Datastore API in App Engine may come with its own issues.

If anyone has experience with using the Google Cloud Datastore API on App Engine - Standard, I'd be happy to hear your thoughts.

Edit - 2016-11-30 - Uniqueness

This question was flagged as being similar to this one. While there is some similarity, I specifically mentioned wanting to choose a solution that would allow for easy growth beyond App Engine. At this point I'm assuming that the NDB library only works on App Engine, so it wouldn't work if I move beyond App Engine. However, I recognise that there may still be advantages to using NDB while on App Engine and then swapping to Cloud Datastore API if I move beyond. Some relevant, more specific questions I have include:

  • Are NDB and the Cloud Datastore API similar enough that moving from one to the other later on wouldn't be that problematic? Perhaps someone has done this and may have an opinion.
  • Are there specific reasons that NDB really shines on App Engine? Performance?
  • Since NDB uses the Cloud Datastore, should I be concerned that it will eventually discontinued? Google has brought App Engine closer and closer to the rest of the cloud computing lineup recently, and the fact that the NDB repo hasn't seen a lot of updating recently concerns me. Google does discontinue things from time to time.

Thanks.

解决方案

Following some more reading, I'm going to go ahead and answer my own questions, hopefully for the benefit of others.

After reading the discussion on google-cloud-python in full, many of my questions can be answered with some degree of confidence.

First, it seems that the opinion of the developers on the project is that Google Cloud Datastore API should work on App Engine, but that the performance will be worse than NDB. This is certainly a reason to use NDB over the Datastore API on App Engine.

Second, it sounds like the developers consider NDB to be both complex and quite mature, and seem to unanimously support its eventual inclusion in the Cloud Datastore python library. Thus, it doesn't seem likely that NDB will be discontinued. Most likely, it may just eventually need to be included from the broader gcloud set of libraries.

Third, the devs are indicating that NDB support beyond App Engine is being actively developed, so if my project moves beyond App Engine, NDB may already be available on further environments by then, so no switch to the Cloud Datastore API will be required. Besides, the next step beyond standard App Engine is the Flexible Environment, which seems to already support NDB nicely.

All this to say that I should be clear to move ahead with NDB, benefiting from its better performance and ORM capabilities on App Engine, and unless Google's opinions/directions on the matter change in the future, I'll most likely have the option to continue using NDB in other environments on the Google Cloud. I'm going to use NDB and look forward to its eventual inclusion into google-cloud-python.

If anyone has any additional experience with the matter, I'd love to hear your thoughts.

这篇关于用于App Engine上的云数据存储的客户端库 - NDB或谷歌云数据存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆