在 GAE 中将 python 类存储为泡菜?
我正在将 Python 投资应用程序移植到 Google App Engine。您可以交易的每个市场都是一个插件:例如股票交易和外汇交易都是插件。
该应用程序将投资组合(这是一个包含活动投资(类实例)和历史记录的投资组合类实例)存储为pickle。但是,您无法写入磁盘,并且将数据存储中的pickle用作blob似乎有点粗糙,而且pickle也很慢并且占用CPU资源(没有cPickle)。
有谁知道如何在不使用大型和密集的泡菜的情况下将所有当前投资和历史记录存储到数据存储中?
谢谢你
。网络应用程序还是 Django?
I am porting a Python investing application to Google App Engine. Every market that you can trade in is a plugin: for example the stocks trading and FOREX trading are all plugins.
The application stores the portfolio (which is a Portfolio class instance containing the active investments (class instances) and history) as a pickle. However you can't write to the disk, and it seems a bit crude to use pickles in the Datastore as a blob, and pickles are also slow and CPU intensive (no cPickle).
Does anyone have any ideas how I can store all the current investments, and the history to the datastore without using large and intensive pickles?
Thank you
Ps. webapp or Django?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最好的解决方案是使用数据存储区数据模型,但您必须重写应用程序的部分内容。使用Pickle进行数据持久化,尤其是涉及大量数据时,并不是一个好的做法。
The best solution would be to use the Datastore data models, but you'll have to rewrite parts of your app. Using Pickle for data persistance, especially involving much data, is not a good pratice.
使用 Django 的主要优点是它的 ORM 和模板系统。由于其非关系性质,ORM 对于数据存储不是很有用,并且模板系统可作为与 Web 应用程序一起使用的应用程序引擎的一部分。
我在项目中使用 webapp 和 django 模板取得了巨大成功。
The key advantages of using Django are its ORM and template system. The ORM is not very useful with datastore because of its non-relational nature and the template system is available as part of the app engine to be used with webapp.
I have had good success with using webapp and django templates for our project.