Merge branch 'master' into beta-7

pull/862/head
Scott Anderson 2020-03-25 09:03:16 -06:00
commit 97688a2ec2
27 changed files with 514 additions and 39 deletions

View File

@ -75,6 +75,7 @@ related: # Creates links to specific internal and external content at the bottom
external_url: # Used in children shortcode type="list" for page links that are external external_url: # Used in children shortcode type="list" for page links that are external
list_image: # Image included with article descriptions in children type="articles" shortcode list_image: # Image included with article descriptions in children type="articles" shortcode
list_note: # Used in children shortcode type="list" to add a small note next to listed links list_note: # Used in children shortcode type="list" to add a small note next to listed links
list_code_example: # Code example included with article descriptions in children type="articles" shortcode
``` ```
#### Title usage #### Title usage
@ -406,17 +407,29 @@ The following list types are available:
- **list:** lists children article links in an unordered list. - **list:** lists children article links in an unordered list.
- **functions:** a special use-case designed for listing Flux functions. - **functions:** a special use-case designed for listing Flux functions.
#### Include a code example with a child summary
Use the `list_code_example` frontmatter to provide a code example with an article
in an articles list.
~~~yaml
list_code_example: |
```sh
This is a code example
```
~~~
#### Children frontmatter #### Children frontmatter
Each children list `type` uses [frontmatter properties](#page-frontmatter) when generating the list of articles. Each children list `type` uses [frontmatter properties](#page-frontmatter) when generating the list of articles.
The following table shows which children types use which frontmatter properties: The following table shows which children types use which frontmatter properties:
| Frontmatter | articles | list | functions | | Frontmatter | articles | list | functions |
|:----------- |:--------:|:----:|:---------:| |:----------- |:--------:|:----:|:---------:|
| `list_title` | ✓ | ✓ | ✓ | | `list_title` | ✓ | ✓ | ✓ |
| `description` | ✓ | | | | `description` | ✓ | | |
| `external_url` | ✓ | ✓ | | | `external_url` | ✓ | ✓ | |
| `list_image` | ✓ | | | | `list_image` | ✓ | | |
| `list_note` | | ✓ | | | `list_note` | | ✓ | |
| `list_code_example` | ✓ | | |
### Inline icons ### Inline icons
The `icon` shortcode allows you to inject icons in paragraph text. The `icon` shortcode allows you to inject icons in paragraph text.

View File

@ -33,4 +33,4 @@ data = from(bucket: "example-bucket")
--- ---
{{< children >}} {{< children pages="all" >}}

View File

@ -0,0 +1,80 @@
---
title: Work with geo-temporal data
description: >
Use the Flux Geo package to filter geo-temporal data and group by geographic location or track.
menu:
v2_0:
name: Geo-temporal data
parent: Query with Flux
weight: 220
---
Use the [Flux Geo package](/v2.0/reference/flux/stdlib/experimental/geo) to
filter geo-temporal data and group by geographic location or track.
{{% warn %}}
The Geo package is experimental and subject to change at any time.
By using it, you agree to the [risks of experimental functions](/v2.0/reference/flux/stdlib/experimental/#use-experimental-functions-at-your-own-risk).
{{% /warn %}}
**To work with geo-temporal data:**
1. Import the `experimental/geo` package.
```js
import "experimental/geo"
```
2. Load geo-temporal data. _See below for [sample geo-temporal data](#sample-data)._
3. Do one or more of the following:
- [Shape data to work with the Geo package](#shape-data-to-work-with-the-geo-package)
- [Filter data by region](#filter-geo-temporal-data-by-region) (using strict or non-strict filters)
- [Group data by area or by track](#group-geo-temporal-data)
{{< children >}}
---
## Sample data
Many of the examples in this section use a `sampleGeoData` variable that represents
a sample set of geo-temporal data.
The [Bird Migration Sample Data](https://github.com/influxdata/influxdb2-sample-data/tree/master/bird-migration-data)
available on GitHub provides sample geo-temporal data that meets the
[requirements of the Flux Geo package](/v2.0/reference/flux/stdlib/experimental/geo/#geo-schema-requirements).
### Load annotated CSV sample data
Use the [experimental `csv.from()` function](/v2.0/reference/flux/stdlib/experimental/csv/from/)
to load the sample bird migration annotated CSV data from GitHub:
```js
import `experimental/csv`
sampleGeoData = csv.from(
url: "https://github.com/influxdata/influxdb2-sample-data/blob/master/bird-migration-data/bird-migration.csv"
)
```
{{% note %}}
`csv.from(url: ...)` downloads sample data each time you execute the query **(~1.3 MB)**.
If bandwidth is a concern, use the [`to()` function](/v2.0/reference/flux/stdlib/built-in/outputs/to/)
to write the data to a bucket, and then query the bucket with [`from()`](/v2.0/reference/flux/stdlib/built-in/inputs/from/).
{{% /note %}}
### Write sample data to InfluxDB with line protocol
Use `curl` and the `influx write` command to write bird migration line protocol to InfluxDB.
Replace `example-bucket` with your destination bucket:
```sh
curl https://raw.githubusercontent.com/influxdata/influxdb2-sample-data/master/bird-migration-data/bird-migration.line --output ./tmp-data
influx write -b example-bucket @./tmp-data
rm -f ./tmp-data
```
Use Flux to query the bird migration data and assign it to the `sampleGeoData` variable:
```js
sampleGeoData = from(bucket: "example-bucket")
|> range(start: 2019-01-01T00:00:00Z, stop: 2019-12-31T23:59:59Z)
|> filter(fn: (r) => r._measurement == "migration")
```

View File

@ -0,0 +1,127 @@
---
title: Filter geo-temporal data by region
description: >
Use the `geo.filterRows` function to filter geo-temporal data by box-shaped, circular, or polygonal geographic regions.
menu:
v2_0:
name: Filter by region
parent: Geo-temporal data
weight: 302
list_code_example: |
```js
import "experimental/geo"
sampleGeoData
|> geo.filterRows(
region: {lat: 30.04, lon: 31.23, radius: 200.0},
strict: true
)
```
---
Use the [`geo.filterRows` function](/v2.0/reference/flux/stdlib/geo/filterrows/)
to filter geo-temporal data by geographic region:
1. [Define a geographic region](#define-geographic-regions)
2. [Use strict or non-strict filtering](#strict-and-non-strict-filtering)
The following example uses the [sample bird migration data](/v2.0/query-data/flux/geo/#sample-data)
and queries data points **within 200km of Cairo, Egypt**:
```js
import "experimental/geo"
sampleGeoData
|> geo.filterRows(
region: {lat: 30.04, lon: 31.23, radius: 200.0},
strict: true
)
```
## Define a geographic region
Many functions in the Geo package filter data based on geographic region.
Define a geographic region using one of the the following shapes:
- [box](#box)
- [circle](#circle)
- [polygon](#polygon)
### box
Define a box-shaped region by specifying an object containing the following properties:
- **minLat:** minimum latitude in decimal degrees (WGS 84) _(Float)_
- **maxLat:** maximum latitude in decimal degrees (WGS 84) _(Float)_
- **minLon:** minimum longitude in decimal degrees (WGS 84) _(Float)_
- **maxLon:** maximum longitude in decimal degrees (WGS 84) _(Float)_
##### Example box-shaped region
```js
{
minLat: 40.51757813,
maxLat: 40.86914063,
minLon: -73.65234375,
maxLon: -72.94921875
}
```
### circle
Define a circular region by specifying an object containing the following properties:
- **lat**: latitude of the circle center in decimal degrees (WGS 84) _(Float)_
- **lon**: longitude of the circle center in decimal degrees (WGS 84) _(Float)_
- **radius**: radius of the circle in kilometers (km) _(Float)_
##### Example circular region
```js
{
lat: 40.69335938,
lon: -73.30078125,
radius: 20.0
}
```
### polygon
Define a polygonal region with an object containing the latitude and longitude for
each point in the polygon:
- **points**: points that define the custom polygon _(Array of objects)_
Define each point with an object containing the following properties:
- **lat**: latitude in decimal degrees (WGS 84) _(Float)_
- **lon**: longitude in decimal degrees (WGS 84) _(Float)_
##### Example polygonal region
```js
{
points: [
{lat: 40.671659, lon: -73.936631},
{lat: 40.706543, lon: -73.749177},
{lat: 40.791333, lon: -73.880327}
]
}
```
## Strict and non-strict filtering
In most cases, the specified geographic region does not perfectly align with S2 grid cells.
- **Non-strict filtering** returns points that may be outside of the specified region but
inside S2 grid cells partially covered by the region.
- **Strict filtering** returns only points inside the specified region.
_Strict filtering is less performant, but more accurate than non-strict filtering._
<span class="key-geo-cell"></span> S2 grid cell
<span class="key-geo-region"></span> Filter region
<span class="key-geo-point"></span> Returned point
{{< flex >}}
{{% flex-content %}}
**Strict filtering**
{{< svg "/static/svgs/geo-strict.svg" >}}
{{% /flex-content %}}
{{% flex-content %}}
**Non-strict filtering**
{{< svg "/static/svgs/geo-non-strict.svg" >}}
{{% /flex-content %}}
{{< /flex >}}

View File

@ -0,0 +1,70 @@
---
title: Group geo-temporal data
description: >
Use the `geo.groupByArea()` to group geo-temporal data by area and `geo.asTracks()`
to group data into tracks or routes.
menu:
v2_0:
parent: Geo-temporal data
weight: 302
list_code_example: |
```js
import "experimental/geo"
sampleGeoData
|> geo.groupByArea(newColumn: "geoArea", level: 5)
|> geo.asTracks(groupBy: ["id"],sortBy: ["_time"])
```
---
Use the `geo.groupByArea()` to group geo-temporal data by area and `geo.asTracks()`
to group data into tracks or routes.
- [Group data by area](#group-data-by-area)
- [Group data into tracks or routes](#group-data-into-tracks-or-routes)
### Group data by area
Use the [`geo.groupByArea()` function](/v2.0/reference/flux/stdlib/experimental/geo/groupbyarea/)
to group geo-temporal data points by geographic area.
Areas are determined by [S2 grid cells](https://s2geometry.io/devguide/s2cell_hierarchy.html#s2cellid-numbering)
- Specify a new column to store the unique area identifier for each point with the `newColumn` parameter.
- Specify the [S2 cell level](https://s2geometry.io/resources/s2cell_statistics)
to use when calculating geographic areas with the `level` parameter.
The following example uses the [sample bird migration data](/v2.0/query-data/flux/geo/#sample-data)
to query data points within 200km of Cairo, Egypt and group them by geographic area:
```js
import "experimental/geo"
sampleGeoData
|> geo.filterRows(region: {lat: 30.04, lon: 31.23, radius: 200.0})
|> geo.groupByArea(
newColumn: "geoArea",
level: 5
)
```
### Group data by track or route
Use [`geo.asTracks()` function](/v2.0/reference/flux/stdlib/experimental/geo/astracks/)
to group data points into tracks or routes and order them by time or other columns.
Data must contain a unique identifier for each track. For example: `id` or `tid`.
- Specify columns that uniquely identify each track or route with the `groupBy` parameter.
- Specify which columns to sort by with the `sortBy` parameter. Default is `["_time"]`.
The following example uses the [sample bird migration data](/v2.0/query-data/flux/geo/#sample-data)
to query data points within 200km of Cairo, Egypt and group them into routes unique
to each bird:
```js
import "experimental/geo"
sampleGeoData
|> geo.filterRows(region: {lat: 30.04, lon: 31.23, radius: 200.0})
|> geo.asTracks(
groupBy: ["id"],
sortBy: ["_time"]
)
```

View File

@ -0,0 +1,121 @@
---
title: Shape data to work with the Geo package
description: >
Functions in the Flux Geo package require **lat** and **lon** fields and an **s2_cell_id** tag.
Rename latitude and longitude fields and generate S2 cell ID tokens.
menu:
v2_0:
name: Shape geo-temporal data
parent: Geo-temporal data
weight: 301
list_code_example: |
```js
import "experimental/geo"
sampleGeoData
|> map(fn: (r) => ({ r with
_field:
if r._field == "latitude" then "lat"
else if r._field == "longitude" then "lon"
else r._field
}))
|> map(fn: (r) => ({ r with
s2_cell_id: geo.s2CellIDToken(point: {lon: r.lon, lat: r.lat}, level: 10)
}))
```
---
Functions in the Geo package require the following data schema:
- an **s2_cell_id** tag containing the [S2 Cell ID](https://s2geometry.io/devguide/s2cell_hierarchy.html#s2cellid-numbering)
**as a token**
- a **`lat` field** field containing the **latitude in decimal degrees** (WGS 84)
- a **`lon` field** field containing the **longitude in decimal degrees** (WGS 84)
<!-- -->
- [Rename latitude and longitude fields](#rename-latitude-and-longitude-fields)
- [Generate S2 cell ID tokens](#generate-s2-cell-id-tokens)
## Rename latitude and longitude fields
Use [`map()`](/v2.0/reference/flux/stdlib/built-in/transformations/map/) to rename
existing latitude and longitude fields using other names.
```js
from(bucket: "example-bucket")
|> range(start: -1h)
|> filter(fn: (r) => r._measurement == "example-measurement")
|> map(fn: (r) => ({ r with
_field:
if r._field == "existingLatitudeField" then "lat"
else if r._field == "existingLongitudeField" then "lon"
else r._field
}))
```
## Generate S2 cell ID tokens
The Geo package uses the [S2 Geometry Library](https://s2geometry.io/) to represent
geographic coordinates on a three-dimensional sphere.
The sphere is divided into [cells](https://s2geometry.io/devguide/s2cell_hierarchy),
each with a unique 64-bit identifier (S2 cell ID).
Grid and S2 cell ID accuracy are defined by a [level](https://s2geometry.io/resources/s2cell_statistics).
{{% note %}}
To filter more quickly, use higher S2 Cell ID levels,
but know that that higher levels increase [series cardinality](/v2.0/reference/glossary/#series-cardinality).
{{% /note %}}
The Geo package requires S2 cell IDs as tokens.
To generate add S2 cell IDs tokens to your data, use one of the following options:
- [Generate S2 cell ID tokens with Telegraf](#generate-s2-cell-id-tokens-with-telegraf)
- [Generate S2 cell ID tokens language-specific libraries](#generate-s2-cell-id-tokens-language-specific-libraries)
- [Generate S2 cell ID tokens with Flux](#generate-s2-cell-id-tokens-with-flux)
### Generate S2 cell ID tokens with Telegraf
Enable the [Telegraf S2 Geo (`s2geo`) processor](https://github.com/influxdata/telegraf/tree/master/plugins/processors/s2geo)
to generate S2 cell ID tokens at a specified `cell_level` using `lat` and `lon` field values.
Add the `processors.s2geo` configuration to your Telegraf configuration file (`telegraf.conf`):
```toml
[[processors.s2geo]]
## The name of the lat and lon fields containing WGS-84 latitude and
## longitude in decimal degrees.
lat_field = "lat"
lon_field = "lon"
## New tag to create
tag_key = "s2_cell_id"
## Cell level (see https://s2geometry.io/resources/s2cell_statistics.html)
cell_level = 9
```
Telegraf stores the S2 cell ID token in the `s2_cell_id` tag.
### Generate S2 cell ID tokens language-specific libraries
Many programming languages offer S2 Libraries with methods for generating S2 cell ID tokens.
Use latitude and longitude with the `s2.CellID.ToToken` endpoint of the S2 Geometry
Library to generate `s2_cell_id` tags. For example:
- **Go:** [s2.CellID.ToToken()](https://godoc.org/github.com/golang/geo/s2#CellID.ToToken)
- **Python:** [s2sphere.CellId.to_token()](https://s2sphere.readthedocs.io/en/latest/api.html#s2sphere.CellId)
- **JavaScript:** [s2.cellid.toToken()](https://github.com/mapbox/node-s2/blob/master/API.md#cellidtotoken---string)
### Generate S2 cell ID tokens with Flux
Use the [`geo.s2CellIDToken()` function](/v2.0/reference/flux/stdlib/experimental/geo/s2cellidtoken/)
with existing longitude (`lon`) and latitude (`lat`) field values to generate and add the S2 cell ID token.
First, use the [`geo.toRows()` function](/v2.0/reference/flux/stdlib/experimental/geo/torows/)
to pivot **lat** and **lon** fields into row-wise sets:
```js
import "experimental/geo"
from(bucket: "example-bucket")
|> range(start: -1h)
|> filter(fn: (r) => r._measurement == "example-measurement")
|> geo.toRows()
|> map(fn: (r) => ({ r with
s2_cell_id: geo.s2CellIDToken(point: {lon: r.lon, lat: r.lat}, level: 10)
}))
```

View File

@ -7,7 +7,7 @@ description: >
menu: menu:
v2_0: v2_0:
name: Extract scalar values name: Extract scalar values
parent: How-to guides parent: Query with Flux
weight: 220 weight: 220
v2.0/tags: [scalar] v2.0/tags: [scalar]
related: related:

View File

@ -69,11 +69,15 @@ sql.from(
{{% code-tab-content %}} {{% code-tab-content %}}
```js ```js
// NOTE: InfluxDB OSS and InfluxDB Cloud do not have access to
// the local filesystem and cannot query SQLite data sources.
// Use the Flux REPL to query an SQLite data source.
import "sql" import "sql"
sql.from( sql.from(
driverName: "sqlite3", driverName: "sqlite3",
dataSourceName: "file:test.db?cache=shared&mode=memory", dataSourceName: "file:/path/to/test.db?cache=shared&mode=ro",
query: "SELECT * FROM example_table" query: "SELECT * FROM example_table"
) )
``` ```

View File

@ -92,25 +92,22 @@ _Required when a `host` is specified._
_**Data type:** String_ --> _**Data type:** String_ -->
### timeColumn ### timeColumn
Time column of the output.
The time column of the output.
Default is `"_time"`. Default is `"_time"`.
_**Data type:** String_ _**Data type:** String_
### tagColumns ### tagColumns
Tag columns in the output.
The tag columns of the output. Defaults to all columns with type `string`, excluding all value columns and columns
Defaults to all columns with type `string`, excluding all value columns and the identified by [`fieldFn`](#fieldfn).
`_field` column if present.
_**Data type:** Array of strings_ _**Data type:** Array of strings_
### fieldFn ### fieldFn
Function that takes a record from the input table and returns an object. Function that takes a record from the input table and returns an object.
For each record from the input table, `fieldFn` returns an object that maps output For each record from the input table, `fieldFn` returns an object that maps the
the field key to the output value. output field key to the output value.
Default is `(r) => ({ [r._field]: r._value })` Default is `(r) => ({ [r._field]: r._value })`
_**Data type:** Function_ _**Data type:** Function_

View File

@ -48,9 +48,8 @@ Geometry Library to generate `s2_cell_id` tags.
Specify your [S2 Cell ID level](https://s2geometry.io/resources/s2cell_statistics.html). Specify your [S2 Cell ID level](https://s2geometry.io/resources/s2cell_statistics.html).
{{% note %}} {{% note %}}
For faster filtering, use higher S2 Cell ID levels. To filter more quickly, use higher S2 Cell ID levels,
But know that that higher levels increase but know that that higher levels increase [series cardinality](/v2.0/reference/glossary/#series-cardinality).
[series cardinality](/v2.0/reference/glossary/#series-cardinality).
{{% /note %}} {{% /note %}}
Language-specific implementations of the S2 Geometry Library provide methods for Language-specific implementations of the S2 Geometry Library provide methods for

View File

@ -25,7 +25,7 @@ _**Function type:** Transformation_
import "experimental/geo" import "experimental/geo"
geo.filterRows( geo.filterRows(
region: {lat: 40.69335938, lon: -73.30078125, radius: 20.0} region: {lat: 40.69335938, lon: -73.30078125, radius: 20.0},
minSize: 24, minSize: 24,
maxSize: -1, maxSize: -1,
level: -1, level: -1,

View File

@ -0,0 +1,26 @@
---
title: v1.databases() function
description: The `v1.databases()` function returns a list of databases in an InfluxDB 1.7+ instance.
menu:
v2_0_ref:
name: v1.databases
parent: InfluxDB v1
weight: 301
related:
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-databases, SHOW DATABASES in InfluxQL
---
The `v1.databases()` function returns a list of databases in an **InfluxDB 1.7+ instance**.
```js
import "influxdata/influxdb/v1"
v1.databases()
```
Output includes the following columns:
- **databaseName:** Database name _(string)_
- **retentionPolicy:** Retention policy name _(string)_
- **retentionPeriod:** Retention period in nanoseconds _(integer)_
- **default:** Default retention policy for database _(boolean)_

View File

@ -9,6 +9,8 @@ menu:
parent: InfluxDB v1 parent: InfluxDB v1
weight: 301 weight: 301
v2.0/tags: [measurements] v2.0/tags: [measurements]
related:
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-measurements, SHOW MEASUREMENTS in InfluxQL
--- ---
The `v1.measurements()` function returns a list of measurements in a specific bucket. The `v1.measurements()` function returns a list of measurements in a specific bucket.

View File

@ -9,6 +9,8 @@ menu:
parent: InfluxDB v1 parent: InfluxDB v1
weight: 301 weight: 301
v2.0/tags: [tags] v2.0/tags: [tags]
related:
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-keys, SHOW TAG KEYS in InfluxQL
--- ---
The `v1.measurementTagKeys()` function returns a list of tag keys for a specific measurement. The `v1.measurementTagKeys()` function returns a list of tag keys for a specific measurement.

View File

@ -9,6 +9,8 @@ menu:
parent: InfluxDB v1 parent: InfluxDB v1
weight: 301 weight: 301
v2.0/tags: [tags] v2.0/tags: [tags]
related:
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-values, SHOW TAG VALUES in InfluxQL
--- ---
The `v1.measurementTagValues()` function returns a list of tag values for a specific measurement. The `v1.measurementTagValues()` function returns a list of tag values for a specific measurement.

View File

@ -9,6 +9,8 @@ menu:
parent: InfluxDB v1 parent: InfluxDB v1
weight: 301 weight: 301
v2.0/tags: [tags] v2.0/tags: [tags]
related:
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-keys, SHOW TAG KEYS in InfluxQL
--- ---
The `v1.tagKeys()` function returns a list of tag keys for all series that match the [`predicate`](#predicate). The `v1.tagKeys()` function returns a list of tag keys for all series that match the [`predicate`](#predicate).

View File

@ -9,6 +9,8 @@ menu:
parent: InfluxDB v1 parent: InfluxDB v1
weight: 301 weight: 301
v2.0/tags: [tags] v2.0/tags: [tags]
related:
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-values, SHOW TAG VALUES in InfluxQL
--- ---
The `v1.tagValues()` function returns a list unique values for a given tag. The `v1.tagValues()` function returns a list unique values for a given tag.

View File

@ -33,7 +33,7 @@ This function encodes [Flux types](/v2.0/reference/flux/language/types/) as foll
### v ### v
The value to convert. The value to convert.
_**Data type:** Boolean | Duration | Float | Integer | String | Time | UInteger_ _**Data type:** Object | Array | Boolean | Duration | Float | Integer | String | Time | UInteger_
## Examples ## Examples

View File

@ -38,6 +38,7 @@ The string value to search.
_**Data type:** String_ _**Data type:** String_
### i ### i
The number of substrings to return. The maximum number of substrings to return.
`-1` returns all matching substrings.
_**Data type:** Integer_ _**Data type:** Integer_

View File

@ -8,6 +8,8 @@ menu:
name: sql.from name: sql.from
parent: SQL parent: SQL
weight: 202 weight: 202
related:
- /v2.0/query-data/flux/sql/
--- ---
The `sql.from()` function retrieves data from a SQL data source. The `sql.from()` function retrieves data from a SQL data source.
@ -35,7 +37,7 @@ The following drivers are available:
- mysql - mysql
- postgres - postgres
- sqlite3 - sqlite3 _Does not work with InfluxDB OSS or InfluxDB Cloud. More information [below](#query-an-sqlite-database)._
### dataSourceName ### dataSourceName
The data source name (DSN) or connection string used to connect to the SQL database. The data source name (DSN) or connection string used to connect to the SQL database.
@ -52,7 +54,7 @@ postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full
username:password@tcp(localhost:3306)/dbname?param=value username:password@tcp(localhost:3306)/dbname?param=value
# SQLite Driver DSN # SQLite Driver DSN
file:test.db?cache=shared&mode=memory file:/path/to/test.db?cache=shared&mode=ro
``` ```
### query ### query
@ -85,12 +87,20 @@ sql.from(
``` ```
### Query an SQLite database ### Query an SQLite database
{{% warn %}}
**InfluxDB OSS** and **InfluxDB Cloud** do not have direct access to the local filesystem
and cannot query SQLite data sources.
Use the [Flux REPL](/v2.0/reference/cli/influx/repl/) to query a SQLite data source
on your local filesystem.
{{% /warn %}}
```js ```js
import "sql" import "sql"
sql.from( sql.from(
driverName: "sqlite3", driverName: "sqlite3",
dataSourceName: "file:test.db?cache=shared&mode=memory", dataSourceName: "file:/path/to/test.db?cache=shared&mode=ro",
query:"SELECT * FROM ExampleTable" query:"SELECT * FROM ExampleTable"
) )
``` ```

View File

@ -36,7 +36,7 @@ The following drivers are available:
- mysql - mysql
- postgres - postgres
- sqlite3 - sqlite3 _Does not work with InfluxDB OSS or InfluxDB Cloud. More information [below](#write-data-to-an-sqlite-database)._
### dataSourceName ### dataSourceName
The data source name (DSN) or connection string used to connect to the SQL database. The data source name (DSN) or connection string used to connect to the SQL database.
@ -53,7 +53,7 @@ postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full
username:password@tcp(localhost:3306)/dbname?param=value username:password@tcp(localhost:3306)/dbname?param=value
# SQLite Driver DSN # SQLite Driver DSN
file:test.db?cache=shared&mode=memory file:/path/to/test.db?cache=shared&mode=rw
``` ```
### table ### table
@ -96,12 +96,20 @@ sql.to(
``` ```
### Write data to an SQLite database ### Write data to an SQLite database
{{% warn %}}
**InfluxDB OSS** and **InfluxDB Cloud** do not have direct access to the local filesystem
and cannot write to SQLite data sources.
Use the [Flux REPL](/v2.0/reference/cli/influx/repl/) to write to an SQLite data
source on your local filesystem.
{{% /warn %}}
```js ```js
import "sql" import "sql"
sql.to( sql.to(
driverName: "sqlite3", driverName: "sqlite3",
dataSourceName: "file:test.db?cache=shared&mode=memory", dataSourceName: "file:/path/to/test.db?cache=shared&mode=rw",
table: "ExampleTable" table: "ExampleTable"
) )
``` ```

View File

@ -18,6 +18,7 @@ related:
The `strings.splitAfter()` function splits a string after a specified separator and returns The `strings.splitAfter()` function splits a string after a specified separator and returns
an array of substrings. an array of substrings.
Split substrings include the separator, `t`.
_**Output data type:** Array of strings_ _**Output data type:** Array of strings_

View File

@ -18,13 +18,14 @@ related:
The `strings.splitAfterN()` function splits a string after a specified separator and returns The `strings.splitAfterN()` function splits a string after a specified separator and returns
an array of `i` substrings. an array of `i` substrings.
Split substrings include the separator `t`.
_**Output data type:** Array of strings_ _**Output data type:** Array of strings_
```js ```js
import "strings" import "strings"
strings.splitAfterN(v: "a flux of foxes", t: " ", i: 2) strings.splitAfterN(v: "a flux of foxes", t: " ", i: 3)
// returns ["a ", "flux ", "of foxes"] // returns ["a ", "flux ", "of foxes"]
``` ```
@ -42,7 +43,9 @@ The string value that acts as the separator.
_**Data type:** String_ _**Data type:** String_
### i ### i
The number of substrings to return. The maximum number of split substrings to return.
`-1` returns all matching substrings.
The last substring is the unsplit remainder.
_**Data type:** Integer_ _**Data type:** Integer_

View File

@ -24,7 +24,7 @@ _**Output data type:** Array of strings_
```js ```js
import "strings" import "strings"
strings.splitN(v: "a flux of foxes", t: " ", i: 2) strings.splitN(v: "a flux of foxes", t: " ", i: 3)
// returns ["a", "flux", "of foxes"] // returns ["a", "flux", "of foxes"]
``` ```
@ -42,7 +42,9 @@ The string value that acts as the separator.
_**Data type:** String_ _**Data type:** String_
### i ### i
The number of substrings to return. The maximum number of split substrings to return.
`-1` returns all matching substrings.
The last substring is the unsplit remainder.
_**Data type:** Integer_ _**Data type:** Integer_

View File

@ -13,7 +13,7 @@ weight: 302
Update a scraper in the InfluxDB user interface (UI). Update a scraper in the InfluxDB user interface (UI).
{{% note %}} {{% note %}}
Scraper **Target URLs** and **Buckets** can not be updated. Scraper **Target URLs** and **Buckets** cannot be updated.
To modify either, [create a new scraper](/v2.0/write-data/scrape-data/manage-scrapers/create-a-scraper). To modify either, [create a new scraper](/v2.0/write-data/scrape-data/manage-scrapers/create-a-scraper).
{{% /note %}} {{% /note %}}

View File

@ -8,9 +8,9 @@
<div class="cards"> <div class="cards">
<div class="card main" id="get-started"> <div class="card main" id="get-started">
{{ $currentVersion := replaceRE "v" "" (index (findRE "[^/]+.*?" .RelPermalink) 0) }} {{ $currentVersion := replaceRE "v" "" (index (findRE "[^/]+.*?" .RelPermalink) 0) }}
<h1>Get started with InfluxDB {{ $currentVersion }}</h1> <h1>Get started with InfluxDB</h1>
<a class="btn oss" href="get-started">Start with InfluxDB OSS</a>
<a class="btn" href="cloud/get-started">Start with InfluxDB Cloud</a> <a class="btn" href="cloud/get-started">Start with InfluxDB Cloud</a>
<a class="btn oss" href="get-started">Start with InfluxDB OSS {{ $currentVersion }}</a>
</div> </div>
{{ partial "svgs/hive.svg" }} {{ partial "svgs/hive.svg" }}
<div class="group"> <div class="group">

View File

@ -18,7 +18,7 @@
{{ $title := cond ( isset .Params "list_title" ) .Params.list_title .Title }} {{ $title := cond ( isset .Params "list_title" ) .Params.list_title .Title }}
{{ $url := cond ( isset .Params "external_url" ) .Params.external_url .RelPermalink }} {{ $url := cond ( isset .Params "external_url" ) .Params.external_url .RelPermalink }}
{{ $target := cond ( isset .Params "external_url" ) "_blank" "" }} {{ $target := cond ( isset .Params "external_url" ) "_blank" "" }}
<h3><a href="{{ $url }}" target="{{ $target }}">{{ $title }}</a></h3> <h3 id="{{ anchorize $title }}"><a href="{{ $url }}" target="{{ $target }}">{{ $title }}</a></h3>
<p> <p>
{{- if .Description }}{{- .Description | markdownify -}} {{- if .Description }}{{- .Description | markdownify -}}
{{ else }}{{- .Summary | markdownify -}} {{ else }}{{- .Summary | markdownify -}}
@ -35,6 +35,9 @@
<img src='{{ $img }}'/> <img src='{{ $img }}'/>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ if .Params.list_code_example }}
{{ .Params.list_code_example | markdownify }}
{{ end }}
{{ end }} {{ end }}
{{ else if (eq $type "functions") }} {{ else if (eq $type "functions") }}