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

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第三方库


热门话题
JPQL中默认查询中的java错误列   java在Swing中设置JComboBox的背景   rest API数据的编码格式,如何在java中解码   java使用RandomAccessFile在中间插入文本之后会删除一些文本   Jackson ObjectMapper JSON to Java对象返回空值   java如何在所有活动上创建一个共享线程?   java无法将UTC转换为IST,它仍然只返回UTC   java main(String[]args)与String[]args={….}不同?   java正则表达式从下面的页面中提取段落   在linux中使用http_代理变量的代理背后的Java应用程序   java视频不会在第二个活动中播放   java将REST响应转换回服务响应   从spring批处理中的java类读取数据   线程“main”中的java异常:0   包含Java containsAll在给定列表时不返回true   安全java许可证实施,创建激活密钥的算法?   java Play框架:将参数传递给自定义标记   java Android Studio从URL获取JSON致命异常   java在安卓中以EditText保存信息