英文:
How to check that tag exists in InfluxDB bucket?
问题
我正在使用比特币示例数据,例如,并在InfluxDB笔记本UI中进行查询,如下所示:
import "influxdata/influxdb/schema"
schema.tagKeys(bucket: "bitcoin")
这个效果不错。但我想通过名称找到特定的标签。
我想下面的应该可以工作,但却没有:
schema.tagKeys(bucket: "bitcoin", predicate: (r) => r._value == "code")
我看到错误:发生了内部错误 - 请检查服务器日志
。
并在日志中看到以下字符串:
ts=2023-06-05T08:50:06.835733Z lvl=warn msg="internal error not returned to client" log_id=0iB3ypUW000 handler=error_logger error="field values unsupported"
我不确定这是什么意思。
我还尝试检查 _value
是否是有效的属性名称,结果如下:
schema.tagKeys(bucket: "bitcoin", predicate: (r) => exists r._value)
以上返回了所有包含标签名称的8行。
我该如何按标签名称查找标签?谢谢
英文:
I am using bitcoin sample data, for example, and do the query in InfluxDB notebook UI like this:
import "influxdata/influxdb/schema"
schema.tagKeys(bucket: "bitcoin")
This works good. But then I want to find specific tag by its name.
I suppose following should work but doesn't:
schema.tagKeys(bucket: "bitcoin", predicate: (r) => r._value == "code")
I see error: An internal error has occurred - check server logs
.
And the following string in logs:
ts=2023-06-05T08:50:06.835733Z lvl=warn msg="internal error not returned to client" log_id=0iB3ypUW000 handler=error_logger error="field values unsupported"
I'm not sure what does it mean.
I also tried to check if _value
is valid property name and it is like so:
schema.tagKeys(bucket: "bitcoin", predicate: (r) => exists r._value)
above returns all 8 rows with tags names.
How can I find tag by its name? thanks
答案1
得分: 0
我已找到过滤方式如下:
schema.tagKeys(bucket: "bitcoin")
|> filter(fn: (r) => r._value == "code")
英文:
I've found the way to filter it like this
schema.tagKeys(bucket: "bitcoin")
|> filter(fn: (r) => r._value == "code")
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论