influxdata / influxdata/influxdb
[1.8] v2 forward compat query API does not support "extern"
@rickspencer3 is already working on this.
Since Mar 30, 2022.
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
Steps to reproduce:
Send request with "extern" property:
POST http://localhost:8086/api/v2/query HTTP/1.1
Content-Type: application/json
{
"query":"from(bucket: v.bucket)|>range(start:-1d)|>filter(fn: (r) => contains(value: r.object_id, set: v.objectIds))",
"extern":{
"type": "File",
"package": null,
"imports": null,
"body": [
{
"type": "OptionStatement",
"assignment": {
"type": "VariableAssignment",
"id": {
"type": "Identifier",
"name": "v"
},
"init": {
"type": "ObjectExpression",
"properties": [
{
"type": "Property",
"key": {
"type": "Identifier",
"name": "bucket"
},
"value": {
"type": "StringLiteral",
"value": "app_dev/autogen"
}
},
{
"type": "Property",
"key": {
"type": "Identifier",
"name": "objectIds"
},
"value": {
"type": "ArrayExpression",
"elements": [
{
"type": "StringLiteral",
"value": "MY_OBJECT_ID"
}
]
}
}
]
}
}
}
]
}
}
Expected behavior:
Get a result back.
Actual behavior:
{"error": "type error 1:93-1:94: undefined identifier \"v\""}
Environment info:
- Docker Image: influxdb:1.8-alpine
Context:
I am experimenting with the new influx js-client (with some custom extensions that enable query variables as described here https://github.com/influxdata/influxdb/issues/16109, see https://github.com/influxdata/influxdb-client-js/pull/178). At my company we are currently using influx v1 with influxql and want to explore a migration strategy towards flux & 2.0 using the new forward compat APIs introduced in 1.8 and query variables would remove the need for string interpolation and extra carefulness to avoid injection attack vectors when crafting queries for influx.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.