我正在尝试遍历Firestore中的所有文档。我在Python中运行以下代码
from google.cloud.firestore import Client
client = Client()
docs = list()
for es in client.collection('exchange-statements').stream():
docs.append(es)
但是会产生以下错误
google.api_core.exceptions.ServiceUnavailable: 503 The datastore operation timed out, or the data was temporarily unavailable.
我正在使用google-cloud-firestore v1.2.0
。
由于我的问题是关于流送文档而不仅仅是计数,所以它与找到的解决方案here不同。
答案 0 :(得分:0)
受answer here的启发,我想到了一个通用解决方案。但是,我想知道是否还有更好的解决方案。
{
"Time":[
{
"Description":"Shoution app",
"Total":"240",
"In_Location":"507, 1st Main Road,Murugeshpalya,Bengaluru,Karnataka,India,560017",
"In":"01:49:07",
"Out":"01:49:24",
"Out_Location":"487, 1st Main Road,Murugeshpalya,Bengaluru,Karnataka,India,560017"
}
],
"Employee_ID":"160",
"Date":"2019-07-02"
}