将数据从谷歌云数据存储转移到谷歌云存储。

datastore-to-gcs的Python项目详细描述


将数据从谷歌云数据存储转移到谷歌云存储。 打算从谷歌应用引擎使用。

用法

>>> import datastore_to_gcs
>>> from google.appengine.ext import ndb
>>>
>>> class Foo(datastore_to_gcs.BaseModel):
...     email = ndb.StringProperty()
...
>>> f = Foo(email='a@b.com')
>>> f.put()
Key('Foo', 1)
>>> datastore_to_gcs.update(Foo, 'bucket-name', 'foo.json')
>>> f2 = Foo(email='b@b.com')
>>> f2.put()
Key('Foo', 2)
>>> import datastore_to_gcs.cloud_storage as gcs
>>> gcs.download_object('bucket-name', 'foo.json')
[{u'last_modified': u'2017-06-19T18:02:01.332908', u'email': u'a@b.com', u'id': 1}]
>>> datastore_to_gcs.update(Foo, 'bucket-name', 'foo.json')
>>> gcs.download_object('bucket-name', 'foo.json')
[{u'last_modified': u'2017-06-19T18:02:01.332908', u'email': u'a@b.com', u'id': 1}, {u'last_modified': u'2017-06-19T18:03:09.342067', u'email': u'b@b.com', u'id': 2}]
>>>
>>>
>>> class Message(datastore_to_gcs.BaseModel):
...     text = ndb.StringProperty()
...
>>> m1 = Message(text='hello 1')
>>> m1.put()
Key('Message', 3)
>>> datastore_to_gcs.dump_log(Message, 'bucket-name', 'messages/')
'2017-06-19T18:05:07.json'
>>> m2 = Message(text='hello 2')
>>> m2.put()
Key('Message', 4)
>>> m3 = Message(text='hello 3')
>>> m3.put()
Key('Message', 5)
>>> datastore_to_gcs.dump_log(Message, 'bucket-name', 'messages/')
'2017-06-19T18:06:02.json'
>>> gcs.download_object('bucket-name', 'messages/2017-06-19T18:05:07.json')
[{u'text': u'hello 1', u'last_modified': u'2017-06-19T18:04:33.558426', u'id': 3}]
>>> gcs.download_object('bucket-name', 'messages/2017-06-19T18:06:02.json')
[{u'text': u'hello 2', u'last_modified': u'2017-06-19T18:05:35.084417', u'id': 4}, {u'text': u'hello 3', u'last_modified': u'2017-06-19T18:05:50.859952', u'id': 5}]

关于SOCO

索科斯有限责任公司是Muse背后的公司。

缪斯将您孩子的日常生活体验带到生活中并给予支持 通过研究性活动发展。缪斯给你的 洞察孩子的成长并向你展示你的能力 每天支持他们的成长。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Android在用户按下硬键时如何从选项卡式片段中获取数据?   java Android改造循环请求不执行回调   参考解释Java中的链表数据结构   java如何查找@EntityListeners调用期间更改的字段   当我试图通过socket流发送/接收jxrpc时出现java“socket关闭”错误   java Javafx组合框自动完成返回错误   java引用集合上带有@DBRef注释的文档   Bouncy Castle在C中没有从Java解密DoFinal#   PHP中未签名的右移/Zerofill Right Shift/>(Java/JavaScript等效)   为什么apache java http库不能处理ContentEncoding:none的站点?   java如何在其他页面的文本视图中显示logcat?   java可以有效地更改字符串中的EOL字符   java向Spring Boot应用程序添加页面(非常基本)   java Android Studio Gradle项目“无法启动守护进程”   仅在第一行使用XOR JAVA进行加密解密   intellij idea Java层分离模块之间的循环依赖关系