Query data
Last updated on Thu Jun 20 11:40:48 2024 by stone1100
This page shows how to query data from LinDB using different programming languages and tools.
Client
The Client Libraries provide user-friendly and high preformance SDKs for a growing number of languages.
Examples
Go client library docs and repo.
package main
import (
"context"
"fmt"
lindb "github.com/lindb/client_go"
)
func main() {
// create write client
cli := lindb.NewClient("http://localhost:9000")
query := cli.DataQuery()
// LinQL ref: https://lindb.io/guide/lin-ql.html#metric-query
data, err := query.DataQuery(context.TODO(),
"_internal",
"select heap_objects from lindb.runtime.mem where time>now()-2m and 'role' in ('Broker') group by node")
if err != nil {
fmt.Println(err)
return
}
// print table
_, table := data.ToTable()
fmt.Println(table)
}
HTTP REST API
Lin Query language
Example request:
Terminal
curl -G http://localhost:9000/api/v1/exec?db=_internal --data-urlencode "sql=select heap_inuse from lindb.runtime.mem where 'role' in ('Broker') group by node"
For more information about Lin query language.
Previous
Insert dataNext
Kubernetes