### Run the browser example app Source: https://docs.influxdata.com/influxdb3/cloud-dedicated/reference/client-libraries/v2/javascript/browser/index.md Execute this command to start the example application, which will be accessible at http://localhost:3001/examples/index.html. ```sh npm run browser ``` -------------------------------- ### Install and Run Go Flight SQL Example Source: https://docs.influxdata.com/influxdb3/core/reference/client-libraries/flight/go-flight/index.md Commands to install the necessary Go packages and run the Flight SQL query example against InfluxDB 3 Core. ```sh go get ./... go run ./query.go ``` -------------------------------- ### Install Telegraf as a Windows Service Source: https://docs.influxdata.com/telegraf/v1/release-notes Use this command to install Telegraf as a Windows service. This allows Telegraf to run in the background and start automatically with the system. ```powershell > C:\Program Files\Telegraf\telegraf.exe --service install ``` -------------------------------- ### Install Telegraf as a Windows Service Source: https://docs.influxdata.com/telegraf/v1/release-notes/index.md Install Telegraf as a Windows service using the command-line executable. This allows Telegraf to run in the background and start automatically with the system. ```bash > C:\\Program Files\\Telegraf\\telegraf.exe --service install ``` -------------------------------- ### Configure GitHub Webhooks Input Plugin Source: https://docs.influxdata.com/telegraf/v1/release-notes Migrate from the deprecated `github_webhooks` plugin to the new `webhooks` plugin. This example shows the configuration change required for handling GitHub webhook events. ```toml # A Github Webhook Event collector [[inputs.github_webhooks]] ## Address and port to host Webhook listener on service_address = ":1618" ``` ```toml # A Webhooks Event collector [[inputs.webhooks]] ## Address and port to host Webhook listener on service_address = ":1618" [inputs.webhooks.github] path = "/" ``` -------------------------------- ### Initiate Setup Source: https://docs.influxdata.com/openapi/influxdb-cloud-v2-api.yml Posts an onboarding request to create an initial user, organization, and bucket. ```APIDOC ## POST /api/v2/setup ### Description Post an onboarding request to create an initial user, organization, and bucket. ### Method POST ### Endpoint /api/v2/setup ### Parameters #### Query Parameters - **traceSpan** (string) - Optional - Used for distributed tracing. ### Request Body - **org** (string) - Required - The name of the organization to create. - **user** (string) - Required - The username for the initial user. - **password** (string) - Required - The password for the initial user. - **bucket** (string) - Required - The name of the bucket to create. ### Response #### Success Response (201) - **org** (string) - The name of the created organization. - **user** (string) - The username of the created user. - **bucket** (string) - The name of the created bucket. ``` -------------------------------- ### Get the start of a time unit Source: https://docs.influxdata.com/enterprise_influxdb/v1/flux/guides/manipulate-timestamps Use the `date.truncate()` function with a specific unit to get the start of that time unit. For example, to get the start of the current hour. ```flux import "date" date.truncate(t: now(), unit: 1h) ``` -------------------------------- ### Get the end of a time unit Source: https://docs.influxdata.com/enterprise_influxdb/v1/flux/guides/manipulate-timestamps Add a duration equal to one unit to the start of a time unit to get the end of that time unit. For example, to get the end of the current hour. ```flux import "date" date.truncate(t: now(), unit: 1h) + 1h ``` -------------------------------- ### Initialize Go Module and Create File Source: https://docs.influxdata.com/influxdb3/cloud-serverless/get-started/write?t=Java Set up a new Go project by creating a directory, initializing a Go module, and creating a new source file for your code. ```Bash mkdir -p influxdb_go_client && cd influxdb_go_client ``` ```Bash go mod init influxdb_go_client ``` ```Bash touch write.go ``` -------------------------------- ### Initialize Go Module and Create File Source: https://docs.influxdata.com/influxdb3/cloud-serverless/get-started/write?t= Set up a new Go project by creating a directory, initializing a Go module, and creating a new Go file for your code. ```bash mkdir -p influxdb_go_client && cd influxdb_go_client go mod init influxdb_go_client touch write.go ``` -------------------------------- ### Return start and stop timestamps of yesterday Source: https://docs.influxdata.com/flux/v0/stdlib/date/boundaries/yesterday/index.md This example demonstrates how to get the start and stop timestamps for yesterday. It uses a fixed `now()` value for predictable results. The output is a record containing the start and stop times. ```javascript import "date/boundaries" option now = () => 2022-01-02T13:45:28Z boundaries.yesterday( )// Returns {start: 2022-01-01T00:00:00.000000000Z, stop: 2022-01-02T00:00:00.000000000Z ``` -------------------------------- ### Return start and stop timestamps of yesterday Source: https://docs.influxdata.com/flux/v0/stdlib/experimental/date/boundaries/yesterday/index.md This example demonstrates how to get the start and stop timestamps for yesterday. It uses a fixed 'now()' value for predictable results. The output is a record containing the start and stop times. ```javascript import "experimental/date/boundaries" option now = () => 2022-01-02T13:45:28Z boundaries.yesterday( )// Returns {start: 2022-01-01T00:00:00.000000000Z, stop: 2022-01-02T00:00:00.000000000Z ``` -------------------------------- ### Create Database Examples Source: https://docs.influxdata.com/enterprise_influxdb/v1/query_language/spec/index.md Examples demonstrating how to create databases with and without custom retention policies. ```sql -- Create a database called foo CREATE DATABASE "foo" ``` ```sql -- Create a database called bar with a new DEFAULT retention policy and specify -- the duration, replication, shard group duration, and name of that retention policy CREATE DATABASE "bar" WITH DURATION 1d REPLICATION 1 SHARD DURATION 30m NAME "myrp" ``` ```sql -- Create a database called mydb with a new DEFAULT retention policy and specify -- the name of that retention policy CREATE DATABASE "mydb" WITH NAME "myrp" ``` ```sql -- Create a database called bar with a new retention policy named "myrp", and -- specify the duration, past and future limits, and name of that retention policy CREATE DATABASE "bar" WITH DURATION 1d PAST LIMIT 6h FUTURE LIMIT 6h NAME "myrp" ``` -------------------------------- ### Get start and stop timestamps for last Saturday Source: https://docs.influxdata.com/flux/v0/stdlib/experimental/date/boundaries/saturday/index.md This example demonstrates how to import the necessary package and use the `boundaries.saturday()` function to get the start and stop times for the previous Saturday. It also shows how to set a fixed timezone and a custom `now()` value for reproducible results. ```flux import "experimental/date/boundaries" option location = timezone.fixed(offset: -8h) option now = () => 2021-12-30T00:40:44Z boundaries.saturday()// Returns {start: 2022-12-25T08:00:00Z, stop:2022-12-26T08:00:00Z } ``` -------------------------------- ### Return start and stop timestamps of yesterday Source: https://docs.influxdata.com/flux/v0/stdlib/experimental/date/boundaries/yesterday This example demonstrates how to use boundaries.yesterday() to get the start and stop timestamps for yesterday. It also shows how to set a custom 'now()' for testing purposes. ```APIDOC ## boundaries.yesterday() ### Description Returns a record with `start` and `stop` boundary timestamps for yesterday. Yesterday is relative to `now()`. ### Function Type Signature ``` () => {stop: time, start: time} ``` ### Examples #### Return start and stop timestamps of yesterday ```flux import "experimental/date/boundaries" option now = () => 2022-01-02T13:45:28Z boundaries.yesterday() // Returns {start: 2022-01-01T00:00:00.000000000Z, stop: 2022-01-02T00:00:00.000000000Z} ``` #### Query data from yesterday ```flux import "experimental/date/boundaries" day = boundaries.yesterday() from(bucket: "example-bucket") |> range(start: day.start, stop: day.stop) ``` ``` -------------------------------- ### Run the example browser application Source: https://docs.influxdata.com/influxdb3/core/reference/client-libraries/v2/javascript/browser/index.md Start the development server to run the example browser application. This command makes the application accessible at http://localhost:3001/examples/index.html. ```bash npm run browser ``` -------------------------------- ### Return start and stop timestamps of yesterday Source: https://docs.influxdata.com/flux/v0/stdlib/date/boundaries/yesterday/index.md This example demonstrates how to use boundaries.yesterday() to get the start and stop times for yesterday. It includes setting a specific 'now()' value for reproducible results. ```APIDOC ## boundaries.yesterday() ### Description Returns a record with `start` and `stop` boundary timestamps for yesterday. Yesterday is relative to `now()`. ### Function Type Signature ```js () => {stop: time, start: time} ``` ### Example ```js import "date/boundaries" option now = () => 2022-01-02T13:45:28Z boundaries.yesterday() // Returns {start: 2022-01-01T00:00:00.000000000Z, stop: 2022-01-02T00:00:00.000000000Z} ``` ``` -------------------------------- ### Example: Basic Write Monitoring Setup and Query Source: https://docs.influxdata.com/influxdb3/core/plugins/library/examples/wal-plugin/index.md Set up basic write monitoring, write test data to different tables, and then query the generated write reports. ```bash # Create the monitoring trigger influxdb3 create trigger \ --database testdb \ --plugin-filename examples/wal_plugin/wal_plugin.py \ --trigger-spec "all_tables" \ write_monitor # Write test data to various tables influxdb3 write \ --database testdb \ "temperature,location=office value=22.5" influxdb3 write \ --database testdb \ "humidity,location=office value=45.2" influxdb3 write \ --database testdb \ "pressure,location=office value=1013.25" # The plugin automatically generates write reports in the `write_reports` measurement. # Query the write reports influxdb3 query \ --database testdb \ "SELECT * FROM write_reports ORDER BY time DESC" ``` -------------------------------- ### Navigate to examples directory Source: https://docs.influxdata.com/influxdb3/cloud-dedicated/reference/client-libraries/v2/javascript/browser/index.md Change the current directory to the examples folder within the cloned repository. ```js cd examples ``` -------------------------------- ### Return start and stop timestamps of yesterday Source: https://docs.influxdata.com/flux/v0/stdlib/experimental/date/boundaries/yesterday/index.md This example demonstrates how to use boundaries.yesterday() to get the start and stop timestamps for yesterday. It also shows how to set a custom 'now()' time for testing purposes. ```APIDOC ## boundaries.yesterday() ### Description Returns a record with `start` and `stop` boundary timestamps for yesterday. Yesterday is relative to `now()`. ### Function Signature ```js () => {stop: time, start: time} ``` ### Example ```js import "experimental/date/boundaries" option now = () => 2022-01-02T13:45:28Z boundaries.yesterday() // Returns {start: 2022-01-01T00:00:00.000000000Z, stop: 2022-01-02T00:00:00.000000000Z} ``` ``` -------------------------------- ### Return start and stop timestamps of last Tuesday Source: https://docs.influxdata.com/flux/v0/stdlib/experimental/date/boundaries/tuesday/index.md This example demonstrates how to get the start and stop timestamps for last Tuesday. It sets a fixed timezone and a specific 'now' value for reproducible results. The output is a record containing the start and stop times. ```js import "experimental/date/boundaries" option location = timezone.fixed(offset: -8h) option now = () => 2021-12-30T00:40:44Z boundaries.tuesday()// Returns {start: 2021-12-28T08:00:00Z, stop:2021-12-29T08:00:00Z } ``` -------------------------------- ### Go: Install and run the client Source: https://docs.influxdata.com/influxdb3/cloud-dedicated/get-started/query Command to install necessary Go packages, build the module, and run the program. ```bash go mod tidy && go run influxdb_go_client ``` -------------------------------- ### Return start and stop timestamps of last Sunday Source: https://docs.influxdata.com/flux/v0/stdlib/experimental/date/boundaries/sunday/index.md This example demonstrates how to get the start and stop timestamps for last Sunday. It sets a fixed timezone and a specific 'now' time for reproducible results. The output is a record containing the start and stop times. ```flux import "experimental/date/boundaries" option location = timezone.fixed(offset: -8h) option now = () => 2021-12-30T00:40:44Z boundaries.sunday()// Returns {start: 2021-12-26T08:00:00Z, stop:2021-12-27T08:00:00Z } ``` -------------------------------- ### Create an organization with a description Source: https://docs.influxdata.com/influxdb3/cloud-serverless/reference/cli/influx/org/create/index.md This example shows how to create an organization and provide a descriptive text for it. Ensure you have the necessary authentication credentials configured. ```bash influx org create \ --name example-org \ --description "Example organization description" ``` -------------------------------- ### Return start and stop timestamps for the current month Source: https://docs.influxdata.com/flux/v0/stdlib/experimental/date/boundaries/month This example demonstrates how to get the start and stop timestamps for the current month using `boundaries.month()`. It sets a fixed `now()` value for reproducible results. The output shows the calculated start and stop times for the month. ```flux import "experimental/date/boundaries" option now = () => 2022-05-10T10:10:00Z boundaries.month( )// Returns {start:2022-05-01T00:00:00.000000000Z, stop:2022-06-01T00:00:00.000000000Z} ``` -------------------------------- ### Create Database with All Fields Source: https://docs.influxdata.com/openapi/influxdb-clustered-management-api.yml Example of creating a new database including all optional fields such as partitionTemplate. ```JSON { "name": "DatabaseTwo", "maxTables": 100, "maxColumnsPerTable": 50, "retentionPeriod": 300000000000, "partitionTemplate": [ { "type": "time", "value": "%Y" }, { "type": "tag", "value": "bananas" }, { "type": "tag", "value": "plátanos" }, { "type": "bucket", "value": { "tagName": "c", "numberOfBuckets": 10 } } ] } ``` -------------------------------- ### Return start and stop timestamps of last Monday Source: https://docs.influxdata.com/flux/v0/stdlib/experimental/date/boundaries/monday/index.md This example demonstrates how to get the start and stop timestamps for last Monday. It sets a fixed timezone and a specific 'now' time for reproducible results. The output is a record containing the start and stop times. ```javascript import "experimental/date/boundaries" option location = timezone.fixed(offset: -8h) option now = () => 2021-12-30T00:40:44Z boundaries.monday()// Returns {start: 2021-12-27T08:00:00Z, stop:2021-12-28T08:00:00Z } ``` -------------------------------- ### Example of using planner.New Source: https://docs.influxdata.com/flux/v0/stdlib/planner Demonstrates how to create a new planner instance. This is typically the first step before using other planner functions. ```flux import "planner" p := planner.New() ``` -------------------------------- ### Return start and stop timestamps of last Friday Source: https://docs.influxdata.com/flux/v0/stdlib/date/boundaries/friday/index.md Imports the 'date/boundaries' package and sets a fixed timezone and 'now' value for reproducible results. This example demonstrates how to get the start and stop timestamps for last Friday. ```flux import "date/boundaries" option location = timezone.fixed(offset: -8h) option now = () => 2021-12-30T00:40:44Z boundaries.friday()// Returns {start: 2021-12-24T08:00:00Z, stop:2022-12-25T08:00:00Z } ``` -------------------------------- ### Install and Run Go Flight SQL Example Source: https://docs.influxdata.com/influxdb3/core/reference/client-libraries/flight/go-flight These commands install the necessary Go packages and run the Flight SQL query program. ```bash go get ./... go run ./query.go ``` -------------------------------- ### Return start and stop timestamps of last Thursday Source: https://docs.influxdata.com/flux/v0/stdlib/experimental/date/boundaries/thursday/index.md This example demonstrates how to use boundaries.thursday() to get the start and stop timestamps for last Thursday. It also shows how to set a specific timezone and a fixed 'now' value for reproducible results. ```APIDOC ## boundaries.thursday() ### Description Returns a record with `start` and `stop` boundary timestamps for last Thursday. Last Thursday is relative to `now()`. If today is Thursday, the function returns boundaries for the previous Thursday. ### Function Signature ```js () => {stop: time, start: time} ``` ### Example ```js import "experimental/date/boundaries" option location = timezone.fixed(offset: -8h) option now = () => 2021-12-30T00:40:44Z boundaries.thursday()// Returns {start: 2021-12-23T08:00:00Z, stop:2021-12-24T08:00:00Z } ``` ``` -------------------------------- ### Create database, users, and grant all permissions Source: https://docs.influxdata.com/enterprise_influxdb/v1/administration/manage/users-and-permissions/fine-grained-authorization/index.md This example demonstrates creating a database, then creating two users and granting them all permissions on that database. This is a foundational step before applying fine-grained restrictions. ```sql CREATE DATABASE datacenters CREATE USER east WITH PASSWORD 'east' GRANT ALL ON datacenters TO east CREATE USER west WITH PASSWORD 'west' GRANT ALL ON datacenters TO west ``` -------------------------------- ### Create Database Table with Partitioning Example Source: https://docs.influxdata.com/openapi/influxdb-clustered-management-api.yml Example of creating a database table with all fields, including a complex partition template. Use this for advanced table configurations. ```json { "databaseName": "DatabaseOne", "name": "TableTwo", "partitionTemplate": [ { "type": "time", "value": "%Y" }, { "type": "tag", "value": "a" }, { "type": "tag", "value": "c" }, { "type": "bucket", "value": { "tagName": "c", "numberOfBuckets": 10 } } ] } ``` -------------------------------- ### Return start and stop timestamps of last Sunday Source: https://docs.influxdata.com/flux/v0/stdlib/date/boundaries/sunday/index.md This example demonstrates how to use boundaries.sunday() to get the start and stop timestamps for last Sunday. It also shows how to set a specific timezone and a fixed 'now' value for reproducible results. ```APIDOC ## boundaries.sunday() ### Description Returns a record with `start` and `stop` boundary timestamps for last Sunday. Last Sunday is relative to `now()`. If today is Sunday, the function returns boundaries for the previous Sunday. ### Function Signature ```js () => {stop: time, start: time} ``` ### Example ```js import "date/boundaries" option location = timezone.fixed(offset: -8h) option now = () => 2021-12-30T00:40:44Z boundaries.sunday()// Returns {start: 2021-12-26T08:00:00Z, stop:2021-12-27T08:00:00Z } ``` ``` -------------------------------- ### Return start and stop timestamps of last Sunday Source: https://docs.influxdata.com/flux/v0/stdlib/date/boundaries/sunday This example demonstrates how to use boundaries.sunday() to get the start and stop timestamps for last Sunday. It also shows how to set a specific timezone and a fixed 'now()' value for reproducible results. ```APIDOC ## boundaries.sunday() ### Description Returns a record with `start` and `stop` boundary timestamps for last Sunday. Last Sunday is relative to `now()`. If today is Sunday, the function returns boundaries for the previous Sunday. ### Function Type Signature ``` () => {stop: time, start: time} ``` ### Example ```flux import "date/boundaries" option location = timezone.fixed(offset: -8h) option now = () => 2021-12-30T00:40:44Z boundaries.sunday()// Returns {start: 2021-12-26T08:00:00Z, stop:2021-12-27T08:00:00Z } ``` ``` -------------------------------- ### Create Subscription Examples Source: https://docs.influxdata.com/enterprise_influxdb/v1/query_language/spec/index.md Examples of creating subscriptions to send data to specified destinations using UDP. ```sql -- Create a SUBSCRIPTION on database 'mydb' and retention policy 'autogen' that send data to 'example.com:9090' via UDP. CREATE SUBSCRIPTION "sub0" ON "mydb"."autogen" DESTINATIONS ALL 'udp://example.com:9090' ``` ```sql -- Create a SUBSCRIPTION on database 'mydb' and retention policy 'autogen' that round robins the data to 'h1.example.com:9090' and 'h2.example.com:9090'. CREATE SUBSCRIPTION "sub0" ON "mydb"."autogen" DESTINATIONS ANY 'udp://h1.example.com:9090', 'udp://h2.example.com:9090' ``` -------------------------------- ### Create a table with a custom partition template Source: https://docs.influxdata.com/influxdb3/cloud-dedicated/reference/cli/influxctl/table/create This example demonstrates creating a table with a custom partition template. It partitions by two tags (`room` and `sensor-type`), buckets the `customerID` tag into 1000 buckets, and uses a daily time format. Always include `--template-timeformat` when using custom partitioning. ```bash influxctl table create \ --template-tag room \ --template-tag sensor-type \ --template-tag-bucket customerID,1000 \ --template-timeformat '%Y-%m-%d' \ DATABASE_NAME \ TABLE_NAME ``` -------------------------------- ### Get current month boundaries with a fixed 'now' time Source: https://docs.influxdata.com/flux/v0/stdlib/date/boundaries/month This example demonstrates how to get the start and stop timestamps for the current month using a fixed 'now' value for reproducible results. The output shows the calculated boundary timestamps. ```flux import "date/boundaries" option now = () => 2022-05-10T10:10:00Z boundaries.month( )// Returns {start:2022-05-01T00:00:00.000000000Z, stop:2022-06-01T00:00:00.000000000Z} ``` -------------------------------- ### Return start and stop timestamps of last Friday Source: https://docs.influxdata.com/flux/v0/stdlib/date/boundaries/friday This example demonstrates how to use boundaries.friday() to get the start and stop timestamps for last Friday. It also shows how to set a specific timezone and a fixed 'now' time for reproducible results. ```APIDOC ## boundaries.friday() ### Description Returns a record with `start` and `stop` boundary timestamps for last Friday. Last Friday is relative to `now()`. If today is Friday, the function returns boundaries for the previous Friday. ### Function Type Signature ``` () => {stop: time, start: time} ``` ### Examples #### Return start and stop timestamps of last Friday ```flux import "date/boundaries" option location = timezone.fixed(offset: -8h) option now = () => 2021-12-30T00:40:44Z boundaries.friday()// Returns {start: 2021-12-24T08:00:00Z, stop:2022-12-25T08:00:00Z } ``` #### Query data collected last Friday ```flux import "date/boundaries" day = boundaries.friday() from(bucket: "example-bucket") |> range(start: day.start, stop: day.stop) ``` ``` -------------------------------- ### Create a table with custom partitioning Source: https://docs.influxdata.com/influxdb3/cloud-dedicated/reference/cli/influxctl/table/create/index.md This example demonstrates creating a table with a custom partition template. It partitions by two tags (`room` and `sensor-type`), groups `customerID` tag values into 1000 buckets, and uses a daily time format (`%Y-%m-%d`). Always include `--template-timeformat` when using custom partitioning flags. ```bash influxctl table create \ --template-tag room \ --template-tag sensor-type \ --template-tag-bucket customerID,1000 \ --template-timeformat '%Y-%m-%d' \ DATABASE_NAME \ TABLE_NAME ``` -------------------------------- ### Example: Create a table with a schema Source: https://docs.influxdata.com/influxdb3/enterprise/reference/cli/influxdb3/create/table This example demonstrates creating a table named 'sensor_data' with a predefined schema including 'timestamp', 'sensor_id', and 'temperature' columns. ```bash influxdb3 create table sensor_data --schema 'timestamp:ts,sensor_id:tag,temperature:float' ``` -------------------------------- ### Return start and stop timestamps of last Monday Source: https://docs.influxdata.com/flux/v0/stdlib/experimental/date/boundaries/monday/index.md This example demonstrates how to use the boundaries.monday() function to get the start and stop timestamps of last Monday. It also shows how to set a fixed timezone and a specific 'now' time for reproducible results. ```APIDOC ## boundaries.monday() ### Description Returns a record with `start` and `stop` boundary timestamps of last Monday. Last Monday is relative to `now()`. If today is Monday, the function returns boundaries for the previous Monday. ### Function Type Signature ```js () => {stop: time, start: time} ``` ### Example ```js import "experimental/date/boundaries" option location = timezone.fixed(offset: -8h) option now = () => 2021-12-30T00:40:44Z boundaries.monday()// Returns {start: 2021-12-27T08:00:00Z, stop:2021-12-28T08:00:00Z } ``` ``` -------------------------------- ### Return start and stop timestamps of last Friday Source: https://docs.influxdata.com/flux/v0/stdlib/experimental/date/boundaries/friday/index.md This example demonstrates how to get the start and stop timestamps for last Friday. It sets a fixed timezone and a specific 'now()' time for reproducible results. The output shows the calculated boundary timestamps. ```javascript import "experimental/date/boundaries" option location = timezone.fixed(offset: -8h) option now = () => 2021-12-30T00:40:44Z boundaries.friday()// Returns {start: 2021-12-24T08:00:00Z, stop:2022-12-25T08:00:00Z } ``` -------------------------------- ### Create a new user, organization, and bucket Source: https://docs.influxdata.com/openapi/influxdb-cloud-v2-api.yml Post an onboarding request to create a new user, organization, and bucket. This is typically used for initial setup. ```APIDOC ## POST /api/v2/setup/user ### Description Post an onboarding request to create a new user, organization, and bucket. ### Method POST ### Endpoint /api/v2/setup/user ### Request Body - **schema** (OnboardingRequest) - Required - The request body schema for onboarding. ### Response #### Success Response (201) - **schema** (OnboardingResponse) - Description: The created default user, bucket, and organization. #### Error Response (default) - **$ref** (#/components/responses/GeneralServerError) - Description: Unexpected error ``` -------------------------------- ### Example EXPLAIN query Source: https://docs.influxdata.com/influxdb3/cloud-dedicated/reference/sql/explain/index.md This example shows how to use the EXPLAIN command to view the execution plan for a SELECT statement that calculates the average temperature per room. ```sql EXPLAIN SELECT room, avg(temp) AS temp FROM home GROUP BY room ``` -------------------------------- ### Return start and stop timestamps of last Tuesday Source: https://docs.influxdata.com/flux/v0/stdlib/experimental/date/boundaries/tuesday/index.md This example demonstrates how to import the boundaries package and use the tuesday() function to get the start and stop timestamps of last Tuesday. It also shows how to set a specific timezone and a fixed 'now' value for reproducible results. ```APIDOC ## boundaries.tuesday() ### Description Returns a record with `start` and `stop` boundary timestamps of last Tuesday. Last Tuesday is relative to `now()`. If today is Tuesday, the function returns boundaries for the previous Tuesday. ### Function Signature ```js () => {stop: time, start: time} ``` ### Example ```js import "experimental/date/boundaries" option location = timezone.fixed(offset: -8h) option now = () => 2021-12-30T00:40:44Z boundaries.tuesday()// Returns {start: 2021-12-28T08:00:00Z, stop:2021-12-29T08:00:00Z } ``` ``` -------------------------------- ### Return start and stop timestamps of last Saturday Source: https://docs.influxdata.com/flux/v0/stdlib/date/boundaries/saturday/index.md This example demonstrates how to import the 'date/boundaries' package and use the boundaries.saturday() function to get the start and stop timestamps for last Saturday. It also shows how to set a fixed timezone and a specific 'now()' value for reproducible results. ```APIDOC ## boundaries.saturday() ### Description Returns a record with `start` and `stop` boundary timestamps for last Saturday. Last Saturday is relative to `now()`. If today is Saturday, the function returns boundaries for the previous Saturday. ### Function Signature ```js () => {stop: time, start: time} ``` ### Example ```js import "date/boundaries" option location = timezone.fixed(offset: -8h) option now = () => 2021-12-30T00:40:44Z boundaries.saturday()// Returns {start: 2022-12-25T08:00:00Z, stop:2022-12-26T08:00:00Z } ``` ``` -------------------------------- ### Create User Examples Source: https://docs.influxdata.com/enterprise_influxdb/v1/query_language/spec/index.md Examples for creating a standard user and an administrator user. Note that passwords must be enclosed in single quotes. ```sql -- Create a normal database user. CREATE USER "jdoe" WITH PASSWORD '1337password' ``` ```sql -- Create an admin user. -- Note: Unlike the GRANT statement, the "PRIVILEGES" keyword is required here. CREATE USER "jdoe" WITH PASSWORD '1337password' WITH ALL PRIVILEGES ```