You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `query` subcommand includes options to help ensure that the right database is queried with the correct permissions. Only the `--database` option is required, but depending on your specific setup, you may need to pass other options, such as host, port, and token.
37
+
-`-H`, `--host`: The host URL of the server _(default is `http://127.0.0.1:8181`)_
38
+
-`-d`, `--database`: _({{% req %}})_ The name of the database to query
39
+
-`-l`, `--language`: The query language of the provided query string
40
+
-`sql`_(default)_
41
+
-`influxql`
42
+
- SQL or InfluxQL query as a string
38
43
39
44
> [!Important]
40
45
> If the `INFLUXDB3_AUTH_TOKEN` environment variable defined in
41
46
> [Set up {{% product-name %}}](/influxdb3/version/get-started/setup/#set-your-token-for-authorization)
42
47
> isn't set in your environment, set it or provide your token using
43
48
> the `-t, --token` option in your command.
44
49
45
-
#### Example: query `“SHOW TABLES”` on the `servers` database:
#### Example: query the `cpu` table, limiting to 10 rows:
62
-
63
-
```console
64
-
$ influxdb3 query --database servers "SELECT DISTINCT usage_percent, time FROM cpu LIMIT 10"
65
-
+---------------+---------------------+
66
-
| usage_percent | time |
67
-
+---------------+---------------------+
68
-
| 63.4 | 2024-02-21T19:25:00 |
69
-
| 25.3 | 2024-02-21T19:06:40 |
70
-
| 26.5 | 2024-02-21T19:31:40 |
71
-
| 70.1 | 2024-02-21T19:03:20 |
72
-
| 83.7 | 2024-02-21T19:30:00 |
73
-
| 55.2 | 2024-02-21T19:00:00 |
74
-
| 80.5 | 2024-02-21T19:05:00 |
75
-
| 60.2 | 2024-02-21T19:33:20 |
76
-
| 20.5 | 2024-02-21T18:58:20 |
77
-
| 85.2 | 2024-02-21T19:28:20 |
78
-
+---------------+---------------------+
79
-
```
50
+
To query the home sensor sample data you wrote in
51
+
[Write data to {{% product-name %}}](/influxdb3/version/get-started/write/#write-data-using-the-cli),
52
+
run the following command:
80
53
81
-
### Query using the CLI for InfluxQL
82
-
83
-
[InfluxQL](/influxdb3/version/reference/influxql/) is an SQL-like language developed by InfluxData with specific features tailored for leveraging and working with InfluxDB. It’s compatible with all versions of InfluxDB, making it a good choice for interoperability across different InfluxDB installations.
Copy file name to clipboardExpand all lines: content/shared/influxdb3-get-started/write.md
+11-9Lines changed: 11 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,16 @@
1
-
### Write data
1
+
<!-- ALLOW SHORTCODE -->
2
2
3
-
InfluxDB is a schema-on-write database. You can start writing data and InfluxDB creates the logical database, tables, and their schemas on the fly.
4
-
After a schema is created, InfluxDB validates future write requests against it before accepting the data.
5
-
Subsequent requests can add new fields on-the-fly, but can't add new tags.
3
+
{{% product-name %}} is designed for high write-throughput and uses an efficient,
4
+
human-readable write syntax called _[line protocol](#line-protocol)_. InfluxDB
5
+
is a schema-on-write database, meaning you can start writing data and InfluxDB
6
+
creates the logical database, tables, and their schemas automatically, without
7
+
any required intervention. Once InfluxDB creates the schema, it validates future
8
+
write requests against the schema before accepting new data.
9
+
Both new tags and fields can be added later as your schema changes.
6
10
7
11
{{% show-in "core" %}}
8
12
> [!Note]
9
-
> #### Core is optimized for recent data
13
+
> #### InfluxDB 3 Core is optimized for recent data
10
14
>
11
15
> {{% product-name %}} is optimized for recent data but accepts writes from any time period.
12
16
> The system persists data to Parquet files for historical analysis with [InfluxDB 3 Enterprise](/influxdb3/enterprise/get-started/) or third-party tools.
0 commit comments