小编syl*_*man的帖子

Firestore 关于使用位置参数进行过滤的警告。如何在 Firestore 查询中使用“过滤器”kwarg?

Firestore 开始显示

UserWarning: Detected filter using positional arguments. Prefer using the 'filter' keyword argument instead.
Run Code Online (Sandbox Code Playgroud)

使用时,query.where(field_path, op_string, value)它是官方文档中的方法https://cloud.google.com/firestore/docs/query-data/queries

那么我们该如何使用“过滤器”kwarg呢?找不到相关的文档或示例。

更新: GitHub 上有一个未解决的问题https://github.com/googleapis/python-firestore/issues/705 (Google 人员没有任何反应)

UPDATE2: 所以,基本上,它应该看起来像这样

from google.cloud.firestore import CollectionReference
from google.cloud.firestore_v1.base_query import FieldFilter, BaseCompositeFilter

...

conditions = [[field, operator, value], [field, operator, value], ...]
query = CollectionReference(path1, path2, path3, ...)

query = query.where(filter=BaseCompositeFilter('AND', [FieldFilter(*_c) for _c in conditions]))
Run Code Online (Sandbox Code Playgroud)

对于 FieldFilter 运算符,通常 ==、!= 等按此处指定的方式工作https://firebase.google.com/docs/firestore/query-data/queries#query_operators

除了“AND”之外,您还可以使用“OPERATOR_UNSPECIFIED”,但我不确定它是否能达到我认为应该的效果https://firebase.google.com/docs/firestore/reference/rest/v1/StructuredQuery#Operator

python google-cloud-firestore

22
推荐指数
1
解决办法
7544
查看次数

仪表板后端的 BigQuery 与 Cloud SQL

我对 BQ 与 Cloud SQL 用例有点困惑。我在 BQ 中有几 Gbs 的行数据,需要在该数据上构建 Web 仪表板(SQL 与多个表的 JOIN)。

直接从 BQ 查询数据是否有很大的缺点(例如延迟或并发),我应该将数据移动到 Cloud SQL(pSQL) 并进行查询吗?

数据不是实时的。我预计最多有几百个并发请求。

我不希望这方面的成本很高,因此查询速度和可靠性是主要目标。

谢谢!

google-cloud-sql google-bigquery

7
推荐指数
2
解决办法
6152
查看次数

Pinia w/ Vue3:在模板中使用操作返回 funcName 不是函数

在 Vue3 中的模板中使用 Pinia 操作可以给出

未捕获的类型错误:$setup.[storeName].[actionName] 不是函数

我做错了什么还是预期的行为?似乎没有其他人有同样的问题。谷歌搜索没有透露任何信息。

我正在使用新组件

vuejs3 pinia

6
推荐指数
1
解决办法
6098
查看次数