Influx Db Querying Cryptocurrency

Influx db querying cryptocurrency

The InfluxDB Query Language (InfluxQL) syntax is a SQL-like query language tailored for querying ranges of time.

Influx db querying cryptocurrency

This page explains the InfluxQL syntax. See the specification for a formal explanation of InfluxQL.

Identifiers (Double-quoted)

Identifiers are user defined references to objects in the database.

Introduction

They are distinct from string literals, which are single quoted values. In InfluxQL, all of the following are all references with identifiers:

  • usernames
  • database names
  • retention policy names
  • measurement names
  • tag keys
  • field keys
  • continuous queries

Identifier Quoting Requirements

Identifiers can be either bare (no quotes) or wrapped in double-quotes.

Bare (unquoted) identifiers are allowed for convenience and must meet all of the following rules,

  • contain only , , , or
  • begin with , , or
  • not match a keyword.

All other identifiers must be wrapped in double-quotes ().

Double-quoted identifers may contain any unicode characters except for double quotes, new lines and backslashes, which must be backslash () escaped.

Tip: Using double quoted identifiers is almost always recommended.

Bare Identifier Examples

Double-quoted Identifier Examples

String Literals (Single-quoted)

String literals are values (like integers or booleans).

Cryptocurrency Market Data

In InfluxQL, all tag values are string literals, and any field values that are not integers, floats, or booleans are also strings. String literals are also used when checking equality with identifiers.

String Literal Quoting Requirements

String literals must always be single-quoted ().

String literals may contain any unicode characters except for single quotes, new lines and backslashes, which must be backslash () escaped.

String Literal Examples

Time Ranges

When querying you often want to limit the set of returned points to a particular time range. This is done with the function in conjunction with the set of possible time range descriptors.

is Local

is the Unix time of the server at the time the query is executed on that server.

Has cryptocurrencies lost their initial purpose

In a cluster, will come from the node that receives and processes the query, regardless of where the queried data resides.

Implicit Time Range Boundaries

If you do not supply a lower bound for the time range, InfluxDB will use epoch , "1970-01-01T00:00:00Z", as the lower bound.

If you do not supply an upper bound for the time range, InfluxDB will use as the upper bound.

Whitespace requirements

When using time ranges, you must put a space between any arithmetic operators and the time range parameters.

You must not include any whitespace between the time range parameter and the unit supplied.

are all valid, but

are not.

CLI

Querying with the CLI requires nothing other than selecting a database and then typing in the direct query.

Select Target Database

You should first set a target database for all queries.

This will be passed along with each subsequent query until a new selection is made.

Influxcoin Statistics

The CLI command is and the syntax is .

All subsequent queries will run against the database.

You do not need to select a target database. You may choose to explicitly name the database in each query:

Output Formats

The CLI can return the results in three formats, column, JSON, and CSV.

The default is column.

Best webhosting reseller options

You can change the output settings with . Run from within the CLI for more information.

Non-interactive Mode

The CLI can run queries in non-interactive mode and the output can be redirected as desired.

Influx db querying cryptocurrency

Run from the command line for more information.

HTTP

To query the database using HTTP, submit a GET request to the endpoint at port . Specify the desired query to run using the query string parameter .

Successful queries will return a HTTP Status Code. Queries will return a for invalid syntax.

Query String Parameters for Reads

  • ,

Database

If required, specify the desired target database in the query string using .

Downsampling Your Data - Getting Started [7 of 7]

Retention Policy

Use the query string parameter to supply a target retention policy for the query. If not specified, the default retention policy for the target database will be used.

Authentication

Use the and to pass the authentication details, if required.

Storing and Processing Billions of Cryptocurrency Market Data Using InfluxDB

Query to Show All Databases

Query to Show All Measurements

This query is against a particular database, so we must supply the parameter in the query string.

Query Against Non-defaults with Authentication

Declare Database and Retention Policy in InfluxQL

Rather than using the GET query string parameters you can specify the target database and/or retention policy directly in the InfluxQL query.

If you want to specify the database but are using the default retention policy for that database, you can leave the retention policy undeclared:

Caveats

Use for all parameters passed to when hitting the endpoint.

Some queries require a target database.

You may specify that in the URL query string or directly in the InfluxQL query, or both. The InfluxQL query takes precedence over the GET query string parameter.

Querying measurements or tags that contain double-quotes can be difficult, since double-quotes are also the syntax for an identifier.

InfluxQL tutorial

It's possible to work around the limitations with regular expressions but it's not easy.

Avoid using Keywords as identifiers (database names, retention policy names, measurement names, tag keys, or field keys) whenever possible. Keywords in InfluxDB are referenced on the InfluxQL Syntax page.

Investment options advice examples

There is no need to quote or escape keywords in the write syntax.

All values in InfluxDB are case-sensitive: != != .

Influx db querying cryptocurrency

The exception is Keywords, which are case-insensitive.