diff --git a/.ci/vale/styles/config/vocabularies/InfluxDataDocs/accept.txt b/.ci/vale/styles/config/vocabularies/InfluxDataDocs/accept.txt index a56077021..8a451ac33 100644 --- a/.ci/vale/styles/config/vocabularies/InfluxDataDocs/accept.txt +++ b/.ci/vale/styles/config/vocabularies/InfluxDataDocs/accept.txt @@ -36,6 +36,7 @@ Redoc SQLAlchemy SQLAlchemy Splunk +System.Data.Odbc [Ss]uperset TBs? \bUI\b diff --git a/.github/instructions/content.instructions.md b/.github/instructions/content.instructions.md index cd6c3019f..458daf82b 100644 --- a/.github/instructions/content.instructions.md +++ b/.github/instructions/content.instructions.md @@ -201,6 +201,7 @@ those frontmatter keys. Frontmatter defined on the page overrides frontmatter #### Use shared content in a page +This repository makes heavy use of shared content to avoid duplication across InfluxDB editions and versions. Use the `source` frontmatter to specify a shared file to use to populate the page content. Shared files are typically stored in the `/content/shared` directory. @@ -225,6 +226,9 @@ The keyword `version` gets replaced during the build process with the appropriat [CLI serve command](/influxdb3/{{% product-key %}}/reference/cli/influxdb3/serve/) ``` +Don't list links to related content at the bottom of shared content files. +Instead, add the `related` frontmatter to the individual pages that use the shared content. + #### Shortcodes in Markdown files For the complete shortcodes reference, see `/.github/instructions/shortcodes-reference.instructions.md`. diff --git a/.github/instructions/contributing.instructions.md b/.github/instructions/contributing.instructions.md index 80a4715d6..6c17d9fdc 100644 --- a/.github/instructions/contributing.instructions.md +++ b/.github/instructions/contributing.instructions.md @@ -176,4 +176,3 @@ docker compose run -T vale --config=content/influxdb/cloud-dedicated/.vale.ini - #### Configure style rules _See full CONTRIBUTING.md for complete details._ - diff --git a/content/influxdb3/cloud-dedicated/query-data/execute-queries/odbc.md b/content/influxdb3/cloud-dedicated/query-data/execute-queries/odbc.md new file mode 100644 index 000000000..0bf0ad5bf --- /dev/null +++ b/content/influxdb3/cloud-dedicated/query-data/execute-queries/odbc.md @@ -0,0 +1,20 @@ +--- +title: Execute SQL queries with ODBC +description: > + Use the Arrow Flight SQL ODBC driver to execute SQL queries against {{% product-name %}} from + ODBC-compatible applications and programming languages. +menu: + influxdb3_cloud_dedicated: + name: Use ODBC + parent: Execute queries +weight: 351 +influxdb3/cloud-dedicated/tags: [query, sql, odbc] +metadata: [SQL] + +related: + - /influxdb3/cloud-dedicated/reference/sql/ + - /influxdb3/cloud-dedicated/query-data/ +source: /shared/influxdb3-query-guides/execute-queries/odbc.md +--- + + \ No newline at end of file diff --git a/content/influxdb3/cloud-dedicated/query-data/execute-queries/visualization-tools.md b/content/influxdb3/cloud-dedicated/query-data/execute-queries/visualization-tools.md index 846a82984..96e8be6e7 100644 --- a/content/influxdb3/cloud-dedicated/query-data/execute-queries/visualization-tools.md +++ b/content/influxdb3/cloud-dedicated/query-data/execute-queries/visualization-tools.md @@ -9,7 +9,7 @@ menu: parent: Execute queries name: Use visualization tools identifier: query-with-visualization-tools -influxdb3/cloud-dedicated/tags: [query, sql, influxql] +influxdb3/cloud-dedicated/tags: [query, sql, influxql, visualization] metadata: [SQL, InfluxQL] aliases: - /influxdb3/cloud-dedicated/query-data/influxql/execute-queries/visualization-tools/ @@ -27,6 +27,7 @@ Use visualization tools to query data stored in {{% product-name %}} with SQL. The following visualization tools support querying InfluxDB with SQL: - [Grafana](/influxdb3/cloud-dedicated/process-data/visualize/grafana/) +- [Power BI](/influxdb3/cloud-dedicated/process-data/visualize/powerbi/) - [Superset](/influxdb3/cloud-dedicated/process-data/visualize/superset/) - [Tableau](/influxdb3/cloud-dedicated/process-data/visualize/tableau/) diff --git a/content/influxdb3/cloud-dedicated/visualize-data/powerbi.md b/content/influxdb3/cloud-dedicated/visualize-data/powerbi.md new file mode 100644 index 000000000..d4bb06ee8 --- /dev/null +++ b/content/influxdb3/cloud-dedicated/visualize-data/powerbi.md @@ -0,0 +1,20 @@ +--- +title: Use Power BI to visualize data +description: > + Use Microsoft Power BI Desktop with the InfluxDB 3 custom connector to query and + visualize data from {{% product-name %}}. +menu: + influxdb3_cloud_dedicated: + name: Power BI + parent: Visualize data +weight: 104 +influxdb3/cloud-dedicated/tags: [visualization, powerbi, sql] +metadata: [SQL] +related: + - https://learn.microsoft.com/en-us/power-bi/desktop/, Power BI documentation + - /influxdb3/cloud-dedicated/query-data/sql/ + - /influxdb3/cloud-dedicated/query-data/execute-queries/odbc/ +source: /shared/influxdb3-visualize/powerbi.md +--- + + diff --git a/content/influxdb3/cloud-serverless/query-data/execute-queries/odbc.md b/content/influxdb3/cloud-serverless/query-data/execute-queries/odbc.md new file mode 100644 index 000000000..ceabe9fdd --- /dev/null +++ b/content/influxdb3/cloud-serverless/query-data/execute-queries/odbc.md @@ -0,0 +1,19 @@ +--- +title: Execute SQL queries with ODBC +description: > + Use the Arrow Flight SQL ODBC driver to execute SQL queries against {{% product-name %}} from + ODBC-compatible applications and programming languages. +menu: + influxdb3_cloud_serverless: + name: Use ODBC + parent: Execute queries +weight: 351 +influxdb3/cloud-serverless/tags: [query, sql, odbc] +metadata: [SQL] +related: + - /influxdb3/cloud-serverless/reference/sql/ + - /influxdb3/cloud-serverless/query-data/ +source: /shared/influxdb3-query-guides/execute-queries/odbc.md +--- + + \ No newline at end of file diff --git a/content/influxdb3/cloud-serverless/query-data/execute-queries/visualization-tools.md b/content/influxdb3/cloud-serverless/query-data/execute-queries/visualization-tools.md index 765c28176..039134e2e 100644 --- a/content/influxdb3/cloud-serverless/query-data/execute-queries/visualization-tools.md +++ b/content/influxdb3/cloud-serverless/query-data/execute-queries/visualization-tools.md @@ -9,7 +9,7 @@ menu: parent: Execute queries name: Use visualization tools identifier: query-with-visualization-tools -influxdb3/cloud-serverless/tags: [query, sql, influxql] +influxdb3/cloud-serverless/tags: [query, sql, influxql, visualization] metadata: [SQL, InfluxQL] aliases: - /influxdb3/cloud-serverless/query-data/influxql/execute-queries/visualization-tools/ @@ -27,6 +27,7 @@ Use visualization tools to query data stored in {{% product-name %}}. The following visualization tools support querying InfluxDB with SQL: - [Grafana](/influxdb3/cloud-serverless/process-data/visualize/grafana/) +- [Power BI](/influxdb3/cloud-serverless/process-data/visualize/powerbi/) - [Superset](/influxdb3/cloud-serverless/process-data/visualize/superset/) - [Tableau](/influxdb3/cloud-serverless/process-data/visualize/tableau/) diff --git a/content/influxdb3/cloud-serverless/visualize-data/powerbi.md b/content/influxdb3/cloud-serverless/visualize-data/powerbi.md new file mode 100644 index 000000000..ffa7beed9 --- /dev/null +++ b/content/influxdb3/cloud-serverless/visualize-data/powerbi.md @@ -0,0 +1,20 @@ +--- +title: Use Power BI to visualize data +description: > + Use Microsoft Power BI Desktop with the InfluxDB 3 custom connector to query and + visualize data from {{% product-name %}}. +menu: + influxdb3_cloud_serverless: + name: Power BI + parent: Visualize data +weight: 104 +influxdb3/cloud-serverless/tags: [visualization, powerbi, sql] +metadata: [SQL] +related: + - https://learn.microsoft.com/en-us/power-bi/desktop/, Power BI documentation + - /influxdb3/cloud-serverless/query-data/sql/ + - /influxdb3/cloud-serverless/query-data/execute-queries/odbc/ +source: /shared/influxdb3-visualize/powerbi.md +--- + + \ No newline at end of file diff --git a/content/influxdb3/clustered/query-data/execute-queries/odbc.md b/content/influxdb3/clustered/query-data/execute-queries/odbc.md new file mode 100644 index 000000000..9ac4d94b1 --- /dev/null +++ b/content/influxdb3/clustered/query-data/execute-queries/odbc.md @@ -0,0 +1,19 @@ +--- +title: Execute SQL queries with ODBC +description: > + Use the Arrow Flight SQL ODBC driver to execute SQL queries against {{% product-name %}} from + ODBC-compatible applications and programming languages. +menu: + influxdb3_clustered: + name: Use ODBC + parent: Execute queries +weight: 351 +influxdb3/clustered/tags: [query, sql, odbc] +metadata: [SQL] +related: + - /influxdb3/clustered/reference/sql/ + - /influxdb3/clustered/query-data/ +source: /shared/influxdb3-query-guides/execute-queries/odbc.md +--- + + \ No newline at end of file diff --git a/content/influxdb3/clustered/query-data/execute-queries/visualization-tools.md b/content/influxdb3/clustered/query-data/execute-queries/visualization-tools.md index 74115ab12..e942ded97 100644 --- a/content/influxdb3/clustered/query-data/execute-queries/visualization-tools.md +++ b/content/influxdb3/clustered/query-data/execute-queries/visualization-tools.md @@ -9,7 +9,7 @@ menu: parent: Execute queries name: Use visualization tools identifier: query-with-visualization-tools -influxdb3/clustered/tags: [query, sql, influxql] +influxdb3/clustered/tags: [query, sql, influxql, visualization] metadata: [SQL, InfluxQL] aliases: - /influxdb3/clustered/query-data/influxql/execute-queries/visualization-tools/ @@ -27,6 +27,7 @@ Use visualization tools to query data stored in {{% product-name %}} with SQL. The following visualization tools support querying InfluxDB with SQL: - [Grafana](/influxdb3/clustered/process-data/visualize/grafana/) +- [Power BI](/influxdb3/clustered/process-data/visualize/powerbi/) - [Superset](/influxdb3/clustered/process-data/visualize/superset/) - [Tableau](/influxdb3/clustered/process-data/visualize/tableau/) diff --git a/content/influxdb3/clustered/visualize-data/powerbi.md b/content/influxdb3/clustered/visualize-data/powerbi.md new file mode 100644 index 000000000..2889b3124 --- /dev/null +++ b/content/influxdb3/clustered/visualize-data/powerbi.md @@ -0,0 +1,20 @@ +--- +title: Use Power BI to visualize data +description: > + Use Microsoft Power BI Desktop with the InfluxDB 3 custom connector to query and + visualize data from {{% product-name %}}. +menu: + influxdb3_clustered: + name: Power BI + parent: Visualize data +weight: 104 +influxdb3/clustered/tags: [visualization, powerbi, sql] +metadata: [SQL] +related: + - https://learn.microsoft.com/en-us/power-bi/desktop/, Power BI documentation + - /influxdb3/clustered/query-data/sql/ + - /influxdb3/clustered/query-data/execute-queries/odbc/ +source: /shared/influxdb3-visualize/powerbi.md +--- + + \ No newline at end of file diff --git a/content/influxdb3/core/query-data/execute-queries/odbc.md b/content/influxdb3/core/query-data/execute-queries/odbc.md new file mode 100644 index 000000000..1bc000d63 --- /dev/null +++ b/content/influxdb3/core/query-data/execute-queries/odbc.md @@ -0,0 +1,20 @@ +--- +title: Execute SQL queries with ODBC +description: > + Use the Arrow Flight SQL ODBC driver to execute SQL queries against {{% product-name %}} from + ODBC-compatible applications and programming languages. +menu: + influxdb3_core: + name: Use ODBC + parent: Execute queries +weight: 351 +influxdb3/core/tags: [query, sql, odbc] +metadata: [SQL] +related: + - /influxdb3/core/reference/sql/ + - /influxdb3/core/query-data/ + - /influxdb3/core/visualize-data/powerbi/ +source: /shared/influxdb3-query-guides/execute-queries/odbc.md +--- + + \ No newline at end of file diff --git a/content/influxdb3/core/visualize-data/powerbi.md b/content/influxdb3/core/visualize-data/powerbi.md new file mode 100644 index 000000000..f2ca5d3b9 --- /dev/null +++ b/content/influxdb3/core/visualize-data/powerbi.md @@ -0,0 +1,20 @@ +--- +title: Use Power BI to visualize data +description: > + Use Microsoft Power BI Desktop with the InfluxDB 3 custom connector to query and + visualize data from {{% product-name %}}. +menu: + influxdb3_core: + name: Power BI + parent: Visualize data +weight: 104 +influxdb3/core/tags: [visualization, powerbi, sql] +metadata: [SQL] +related: + - https://learn.microsoft.com/en-us/power-bi/desktop/, Power BI documentation + - /influxdb3/core/query-data/sql/ + - /influxdb3/core/query-data/execute-queries/odbc/ +source: /shared/influxdb3-visualize/powerbi.md +--- + + \ No newline at end of file diff --git a/content/influxdb3/enterprise/query-data/execute-queries/odbc.md b/content/influxdb3/enterprise/query-data/execute-queries/odbc.md new file mode 100644 index 000000000..d15b40c63 --- /dev/null +++ b/content/influxdb3/enterprise/query-data/execute-queries/odbc.md @@ -0,0 +1,20 @@ +--- +title: Execute SQL queries with ODBC +description: > + Use the Arrow Flight SQL ODBC driver to execute SQL queries against {{% product-name %}} from + ODBC-compatible applications and programming languages. +menu: + influxdb3_enterprise: + name: Use ODBC + parent: Execute queries +weight: 351 +influxdb3/enterprise/tags: [query, sql, odbc] +metadata: [SQL] +related: + - /influxdb3/enterprise/reference/sql/ + - /influxdb3/enterprise/query-data/ + - /influxdb3/enterprise/visualize-data/powerbi/ +source: /shared/influxdb3-query-guides/execute-queries/odbc.md +--- + + \ No newline at end of file diff --git a/content/influxdb3/enterprise/visualize-data/powerbi.md b/content/influxdb3/enterprise/visualize-data/powerbi.md new file mode 100644 index 000000000..3413071bd --- /dev/null +++ b/content/influxdb3/enterprise/visualize-data/powerbi.md @@ -0,0 +1,20 @@ +--- +title: Use Power BI to visualize data +description: > + Use Microsoft Power BI Desktop with the InfluxDB 3 custom connector to query and + visualize data from {{% product-name %}}. +menu: + influxdb3_enterprise: + name: Power BI + parent: Visualize data +weight: 104 +influxdb3/enterprise/tags: [visualization, powerbi, sql] +metadata: [SQL] +related: + - https://learn.microsoft.com/en-us/power-bi/desktop/, Power BI documentation + - /influxdb3/enterprise/query-data/sql/ + - /influxdb3/enterprise/query-data/execute-queries/odbc/ +source: /shared/influxdb3-visualize/powerbi.md +--- + + \ No newline at end of file diff --git a/content/shared/influxdb3-query-guides/execute-queries/odbc.md b/content/shared/influxdb3-query-guides/execute-queries/odbc.md new file mode 100644 index 000000000..c98549738 --- /dev/null +++ b/content/shared/influxdb3-query-guides/execute-queries/odbc.md @@ -0,0 +1,489 @@ +Use the Arrow Flight SQL ODBC driver to execute SQL queries against +{{% product-name %}} from ODBC-compatible applications and programming languages. + +ODBC (Open Database Connectivity) is a standard API for accessing database +management systems. The Arrow Flight SQL ODBC driver enables ODBC-compatible +applications to connect to {{% product-name %}} and query data using SQL. + +- [Download and install the ODBC driver](#download-and-install-the-odbc-driver) +- [Configure a data source](#configure-a-data-source) +- [Connect and query from applications](#connect-and-query-from-applications) +- [Use ODBC with programming languages](#use-odbc-with-programming-languages) + +## Download and install the ODBC driver + +{{% product-name %}} uses the [Arrow Flight SQL ODBC driver](https://docs.dremio.com/current/client-applications/drivers/arrow-flight-sql-odbc-driver/) +to enable ODBC connectivity. + +Download the Arrow Flight SQL ODBC driver for your operating system: + +- [**Windows (x64)**](https://download.dremio.com/arrow-flight-sql-odbc-driver/arrow-flight-sql-odbc-LATEST-win64.msi) +- [**macOS (Universal)**](https://download.dremio.com/arrow-flight-sql-odbc-driver/arrow-flight-sql-odbc-LATEST-universal.pkg) +- [**Linux (x86_64)**](https://download.dremio.com/arrow-flight-sql-odbc-driver/arrow-flight-sql-odbc-LATEST-linux-x86_64.tar.gz) + +### Install on Windows + +#### Using PowerShell (recommended) + +Run the following PowerShell commands: + +{{% code-placeholders "YOUR_USER" %}} +```powershell +# Download the driver +Invoke-WebRequest -Uri "https://download.dremio.com/arrow-flight-sql-odbc-driver/arrow-flight-sql-odbc-LATEST-win64.msi" ` + -OutFile "C:\Users\YOUR_USER\Downloads\arrow-flight-sql-odbc-win64.msi" + +# Mark as trusted +Unblock-File "C:\Users\YOUR_USER\Downloads\arrow-flight-sql-odbc-win64.msi" + +# Install +Start-Process msiexec.exe -Wait -ArgumentList '/i "C:\Users\YOUR_USER\Downloads\arrow-flight-sql-odbc-win64.msi"' +``` +{{% /code-placeholders %}} + +Replace the following: + +- {{% code-placeholder-key %}}`YOUR_USER`{{% /code-placeholder-key %}}: Your Windows username + +#### Manual installation + +1. Run the downloaded `.msi` installer +2. Follow the installation wizard using default settings +3. Complete the installation + +#### Verify installation + +1. Open **ODBC Data Source Administrator (64-bit)** +2. Navigate to the **Drivers** tab +3. Verify **Arrow Flight SQL ODBC Driver** appears in the list + +### Install on macOS + +1. Run the downloaded `.pkg` installer +2. Follow the installation prompts +3. Enter your administrator password when prompted +4. Complete the installation + +To verify installation: + +```bash +odbcinst -q -d +``` + +The output should include **Arrow Flight SQL**. + +### Install on Linux + +1. Extract the downloaded archive: + + ```bash + tar -xzf arrow-flight-sql-odbc-LATEST-linux-x86_64.tar.gz + ``` + +2. Install the driver (installation location may vary by distribution): + + ```bash + sudo mkdir -p /opt/arrow-flight-sql-odbc + sudo cp -r lib /opt/arrow-flight-sql-odbc/ + ``` + +3. Configure the driver in `/etc/odbcinst.ini`: + + ```ini + [Arrow Flight SQL ODBC Driver] + Description = Arrow Flight SQL ODBC Driver + Driver = /opt/arrow-flight-sql-odbc/lib/libarrow-odbc.so + ``` + +To verify installation: + +```bash +odbcinst -q -d +``` + +## Configure a data source + +After installing the Arrow Flight SQL ODBC driver, configure a data source to +connect to {{% product-name %}}. + +### Windows + +1. Open **ODBC Data Source Administrator (64-bit)** +2. Navigate to the **System DSN** or **User DSN** tab +3. Click **Add** +4. Select **Arrow Flight SQL ODBC Driver** and click **Finish** +5. Configure the connection: + + - **Data Source Name**: Provide a descriptive name (for example, `InfluxDB3`) + - **Host**: Your {{% product-name %}} host (for example, {{% show-in "cloud-serverless" %}}`us-west-2-1.aws.cloud2.influxdata.com`{{% /show-in %}}{{% show-in "enterprise,core" %}}`localhost`{{% /show-in %}}{{% show-in "cloud-dedicated" %}}`cluster-id.a.influxdb.io`{{% /show-in %}}{{% show-in "clustered" %}}`cluster-host.com`{{% /show-in %}}) + - **Port**: Your InfluxDB URL port{{% show-in "cloud-serverless,cloud-dedicated,clustered" %}}(for example, `443` (HTTPS){{% /show-in %}}){{% show-in "enterprise,core" %}}`8181` (default){{% /show-in %}}) + - **Database**: Your database name + - **Auth Token**: Your {{% show-in "cloud-dedicated, clustered" %}}{{% token-link "database" %}}{{% /show-in %}}{{% show-in "cloud-serverless" %}}{{% token-link %}}{{% /show-in %}}{{% show-in "core, enterprise" %}}{{% token-link "admin" "database" %}}{{% /show-in %}}{{% hide-in "core" %}} with query permissions for the target database{{% /hide-in %}} + - **Use Encryption**: Enable for HTTPS connections + +6. Click **Test** to verify the connection +7. Click **OK** to save + +### macOS and Linux + +Create or edit `~/.odbc.ini` (user DSN) or `/etc/odbc.ini` (system DSN): + +{{% show-in "enterprise,core" %}} +{{% code-placeholders "DATABASE_NAME|DATABASE_TOKEN" %}} +```ini +[InfluxDB3] +Driver = Arrow Flight SQL ODBC Driver +Host = localhost +Port = 8181 +Database = DATABASE_NAME +AuthToken = DATABASE_TOKEN +UseEncryption = 1 +``` +{{% /code-placeholders %}} +{{% /show-in %}} + +{{% show-in "cloud-serverless" %}} +{{% code-placeholders "DATABASE_NAME|DATABASE_TOKEN" %}} +```ini +[InfluxDB3] +Driver = Arrow Flight SQL ODBC Driver +Host = us-west-2-1.aws.cloud2.influxdata.com +Port = 443 +Database = DATABASE_NAME +AuthToken = DATABASE_TOKEN +UseEncryption = 1 +``` +{{% /code-placeholders %}} +{{% /show-in %}} + +{{% show-in "cloud-dedicated" %}} +{{% code-placeholders "DATABASE_NAME|DATABASE_TOKEN" %}} +```ini +[InfluxDB3] +Driver = Arrow Flight SQL ODBC Driver +Host = cluster-id.a.influxdb.io +Port = 443 +Database = DATABASE_NAME +AuthToken = DATABASE_TOKEN +UseEncryption = 1 +``` +{{% /code-placeholders %}} +{{% /show-in %}} + +{{% show-in "clustered" %}} +{{% code-placeholders "DATABASE_NAME|DATABASE_TOKEN" %}} +```ini +[InfluxDB3] +Driver = Arrow Flight SQL ODBC Driver +Host = cluster-host.com +Port = 443 +Database = DATABASE_NAME +AuthToken = DATABASE_TOKEN +UseEncryption = 1 +``` +{{% /code-placeholders %}} +{{% /show-in %}} + +Replace the following: + +- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: Your database name +- {{% code-placeholder-key %}}`DATABASE_TOKEN`{{% /code-placeholder-key %}}: Your {{% token-link "database" %}}{{% show-in "enterprise" %}} with query permissions{{% /show-in %}} + +Test the connection: + +```bash +isql -v InfluxDB3 +``` + +## Connect and query from applications + +After configuring a data source, connect from ODBC-compatible applications: + +### Power BI + +See [Use Power BI to visualize data](/influxdb3/version/visualize-data/powerbi/). + +### Tableau + +See [Use Tableau to visualize data](/influxdb3/version/visualize-data/tableau/). + +### Excel + +1. Open Excel +2. Go to **Data** > **Get Data** > **From Other Sources** > **From ODBC** +3. Select your InfluxDB data source +4. Enter credentials if prompted +5. Select tables and load data + +### DBeaver + +1. Create a new database connection +2. Select **ODBC** as the connection type +3. Configure the connection: + - **Database/Schema**: Your InfluxDB database + - **ODBC DSN**: Your configured data source name +4. Test and save the connection + +## Use ODBC with programming languages + +### Python with pyodbc + +```python +import pyodbc + +# Connect to InfluxDB +conn = pyodbc.connect( + 'DSN=InfluxDB3', + autocommit=True +) + +# Create cursor +cursor = conn.cursor() + +# Execute query +cursor.execute(""" + SELECT + time, + temp, + location + FROM + home + WHERE + time >= now() - INTERVAL '1 hour' + ORDER BY + time DESC +""") + +# Fetch results +for row in cursor.fetchall(): + print(row) + +# Close connection +cursor.close() +conn.close() +``` + +### R with RODBC + +```r +library(RODBC) + +# Connect to InfluxDB +conn <- odbcConnect("InfluxDB3") + +# Execute query +result <- sqlQuery(conn, " + SELECT + time, + temp, + location + FROM + home + WHERE + time >= now() - INTERVAL '1 hour' + ORDER BY + time DESC +") + +# View results +print(result) + +# Close connection +odbcClose(conn) +``` + +### C# with `System.Data.Odbc` + +```csharp +using System; +using System.Data.Odbc; + +class Program +{ + static void Main() + { + string connectionString = "DSN=InfluxDB3"; + + using (OdbcConnection conn = new OdbcConnection(connectionString)) + { + conn.Open(); + + string query = @" + SELECT + time, + temp, + location + FROM + home + WHERE + time >= now() - INTERVAL '1 hour' + ORDER BY + time DESC + "; + + using (OdbcCommand cmd = new OdbcCommand(query, conn)) + using (OdbcDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + Console.WriteLine($"{reader["time"]} - {reader["temp"]} - {reader["location"]}"); + } + } + } + } +} +``` + +## Connection string format + +For applications that use connection strings directly: + +``` +Driver={Arrow Flight SQL ODBC Driver};Host=HOST;Port=PORT;Database=DATABASE;AuthToken=TOKEN;UseEncryption=1 +``` + +Example: + +{{% code-placeholders "DATABASE_NAME|DATABASE_TOKEN" %}} +``` +Driver={Arrow Flight SQL ODBC Driver};Host=localhost;Port=8181;Database=DATABASE_NAME;AuthToken=DATABASE_TOKEN;UseEncryption=1 +``` +{{% /code-placeholders %}} + +{{% show-in "cloud-serverless,cloud-dedicated" %}} +For {{% product-name %}}, use port `443`: + +{{% code-placeholders "DATABASE_NAME|DATABASE_TOKEN" %}} +``` +Driver={Arrow Flight SQL ODBC Driver};Host=cluster-id.a.influxdb.io;Port=443;Database=DATABASE_NAME;AuthToken=DATABASE_TOKEN;UseEncryption=1 +``` +{{% /code-placeholders %}} +{{% /show-in %}} + +## Configuration options + +### Connection parameters + +| Parameter | Description | Default | +| -------------------------------- | ------------------------------- | ----------------------------------------------------------------------------------------------- | +| `Host` | InfluxDB server hostname | Required | +| `Port` | InfluxDB server port | Required {{% show-in "core,enterprise" %}}(`8181`){{% /show-in %}} | +| `Database` | Database name | Required | +| `AuthToken` | Authentication token | Required | +| `UseEncryption` | Use encrypted connection | `1` (enabled) | +| `TrustedCerts` | Path to trusted CA certificates | System default | +| `DisableCertificateVerification` | Skip certificate verification | `0` (disabled) | + +### Advanced options + +Add these to your DSN configuration or connection string as needed: + +{{% show-in "enterprise,core" %}} +```ini +[InfluxDB3] +Driver = Arrow Flight SQL ODBC Driver +Host = localhost +Port = 8181 +Database = mydb +AuthToken = your-token +UseEncryption = 1 +DisableCertificateVerification = 0 +``` +{{% /show-in %}} + +{{% show-in "cloud-serverless" %}} +```ini +[InfluxDB3] +Driver = Arrow Flight SQL ODBC Driver +Host = us-west-2-1.aws.cloud2.influxdata.com +Port = 443 +Database = mydb +AuthToken = your-token +UseEncryption = 1 +DisableCertificateVerification = 0 +``` +{{% /show-in %}} + +{{% show-in "cloud-dedicated" %}} +```ini +[InfluxDB3] +Driver = Arrow Flight SQL ODBC Driver +Host = cluster-id.a.influxdb.io +Port = 443 +Database = mydb +AuthToken = your-token +UseEncryption = 1 +DisableCertificateVerification = 0 +``` +{{% /show-in %}} + +{{% show-in "clustered" %}} +```ini +[InfluxDB3] +Driver = Arrow Flight SQL ODBC Driver +Host = cluster-host.com +Port = 443 +Database = mydb +AuthToken = your-token +UseEncryption = 1 +DisableCertificateVerification = 0 +``` +{{% /show-in %}} + +## Troubleshooting + +### Driver not found + +If applications cannot find the Arrow Flight SQL ODBC driver: + +**Windows**: +- Open **ODBC Data Source Administrator (64-bit)** +- Navigate to the **Drivers** tab +- Verify **Arrow Flight SQL ODBC Driver** appears in the list +- If not listed, reinstall the driver + +**macOS/Linux**: +- Run `odbcinst -q -d` to list installed drivers +- Verify **Arrow Flight SQL** appears in the output +- Check `/etc/odbcinst.ini` for proper driver configuration +- Ensure the driver library path is correct + +### Connection failures + +If you cannot connect to {{% product-name %}}: + +- Verify your {{% product-name %}} instance is running and accessible +- Check host and port settings: + - Local instances: `localhost:8181` + - {{% show-in "cloud-serverless,cloud-dedicated" %}}{{% product-name %}}: Use your cluster URL with port `443`{{% /show-in %}} +- Ensure `UseEncryption` is set correctly for your connection type +- Verify network connectivity and firewall rules allow connections + +### Authentication errors + +If authentication fails: + +- Confirm your token is valid and not expired +- Ensure the token is specified in the `AuthToken` parameter (not `Token`) +- {{% show-in "enterprise" %}}Verify the token has query permissions for the target database{{% /show-in %}} +- Check that the token was copied correctly without extra spaces or characters + +### Query errors + +If queries fail or return errors: + +- Verify SQL syntax is correct for InfluxDB SQL +- Check that referenced tables (measurements) exist in the database +- Ensure column names match your schema +- Review the [SQL reference](/influxdb3/version/reference/sql/) for supported features +- For large result sets, consider adding `LIMIT` clauses + +### Performance issues + +For slow queries or connection timeouts: + +- Add time range filters to limit data scanned +- Use appropriate indexes if available +- Increase timeout values in your DSN configuration +- Monitor query execution plans for optimization opportunities + diff --git a/content/shared/influxdb3-visualize/powerbi.md b/content/shared/influxdb3-visualize/powerbi.md new file mode 100644 index 000000000..79913c4d3 --- /dev/null +++ b/content/shared/influxdb3-visualize/powerbi.md @@ -0,0 +1,231 @@ +Use [Microsoft Power BI Desktop](https://powerbi.microsoft.com/) with the +InfluxDB 3 custom connector to query and visualize data from {{% product-name %}}. + +> Microsoft Power BI is a collection of software services, apps, and connectors +> that work together to turn your unrelated sources of data into coherent, +> visually immersive, and interactive insights. +> +> {{% cite %}}-- [Microsoft Power BI documentation](https://learn.microsoft.com/en-us/power-bi/fundamentals/power-bi-overview){{% /cite %}} + +> [!Important] +> This tutorial is for Power BI Desktop only and uses a custom connector. + +- [Prerequisites](#prerequisites) +- [Install the Power BI connector](#install-the-power-bi-connector) +- [Enable the connector in Power BI](#enable-the-connector-in-power-bi) +- [Connect Power BI to InfluxDB](#connect-power-bi-to-influxdb) +- [Query and visualize data](#query-and-visualize-data) + +## Prerequisites + +- **Windows operating system**: The custom connector requires Windows + (macOS users can use virtualization software like [Parallels](https://www.parallels.com/)) +- **Power BI Desktop**: [Download and install Power BI Desktop](https://powerbi.microsoft.com/desktop/) + (A free trial is available) +- **{{% product-name %}}**: A running instance with data to query +- **Database token**: Your {{% show-in "cloud-dedicated, clustered" %}}{{% token-link "database" %}}{{% /show-in %}}{{% show-in "cloud-serverless" %}}{{% token-link %}}{{% /show-in %}}{{% show-in "core, enterprise" %}}{{% token-link "admin" "database" %}}{{% /show-in %}}{{% show-in "enterprise" %}} with query permissions for the target database{{% /show-in %}} +- **Arrow Flight SQL ODBC Driver**: [Download and install](https://docs.dremio.com/current/client-applications/drivers/arrow-flight-sql-odbc-driver/) +- **InfluxDB 3 connector**: Download the Power BI Desktop InfluxDB 3 connector `.pqx` file + +## Install the Power BI connector + +The InfluxDB 3 custom connector for Power BI Desktop enables you to connect to +{{% product-name %}} and query data using SQL or InfluxQL. + +### Install the Arrow Flight SQL ODBC Driver + +The custom connector requires the Arrow Flight SQL ODBC Driver. +To install on Windows, run the following PowerShell commands: + +{{% code-placeholders "YOUR_USER" %}} +```powershell +# Download the driver +Invoke-WebRequest -Uri "https://download.dremio.com/arrow-flight-sql-odbc-driver/arrow-flight-sql-odbc-LATEST-win64.msi" ` + -OutFile "C:\Users\YOUR_USER\Downloads\arrow-flight-sql-odbc-win64.msi" + +# Mark as trusted +Unblock-File "C:\Users\YOUR_USER\Downloads\arrow-flight-sql-odbc-win64.msi" + +# Install +Start-Process msiexec.exe -Wait -ArgumentList '/i "C:\Users\YOUR_USER\Downloads\arrow-flight-sql-odbc-win64.msi"' +``` +{{% /code-placeholders %}} + +Replace the following: + +- {{% code-placeholder-key %}}`YOUR_USER`{{% /code-placeholder-key %}}: Your Windows username + +Follow the installation wizard using default settings. + +### Install the connector file + +Copy the `.pqx` connector file to the Power BI custom connectors directory: + +1. Create the custom connectors folder if it doesn't exist: + + ```powershell + mkdir "$env:USERPROFILE\Documents\Power BI Desktop\Custom Connectors" + ``` + +2. Move the connector file to the custom connectors folder: + + ```powershell + Move-Item InfluxDB.pqx "$env:USERPROFILE\Documents\Power BI Desktop\Custom Connectors\" + ``` + +## Enable the connector in Power BI + +To use custom connectors, you must adjust Power BI Desktop's security settings: + +1. Open Power BI Desktop +2. Select **File** > **Options and settings** > **Options** +3. Navigate to **Security** under **GLOBAL** +4. Under **Data Extensions**, select **(Not Recommended) Allow any extension to + load without validation or warning** +5. Click **OK** +6. **Restart Power BI Desktop** for the changes to take effect + +> [!Warning] +> #### Security considerations +> Enabling uncertified extensions allows any custom connector to load. +> Only enable this setting if you trust the connectors you're installing. + +## Connect Power BI to InfluxDB + +After installing the connector and restarting Power BI Desktop: + +1. Open **Power BI Desktop** +2. Click **Get Data** > **More** +3. Search for **InfluxDB 3** and select it +4. Click **Connect** +5. In the **InfluxDB 3** connection dialog, configure the following: + + - **Server**: Your {{% product-name %}} URL without the port, (for example, + - {{% show-in "cloud-serverless" %}}`https://us-west-2-1.aws.cloud2.influxdata.com`{{% /show-in %}}{{% show-in "cloud-dedicated" %}}`https://cluster-id.a.influxdb.io`{{% /show-in %}}{{% show-in "clustered" %}}`https://cluster-host.com`{{% /show-in %}}{{% show-in "enterprise,core" %}}`http://localhost`{{% /show-in %}}) + - **Database**: Your database name + - **Port**: Your server port (for example, {{% show-in "cloud-serverless,cloud-dedicated,clustered" %}}`443` (HTTPS){{% /show-in %}}{{% show-in "enterprise,core" %}}`8181` (default){{% /show-in %}}) + - **Native Query** (optional): Enter a SQL or InfluxQL query to limit the data loaded + +6. Select **DirectQuery** as the **Data Connectivity mode** +7. Click **OK** +8. When prompted for credentials: + - Select **Basic** authentication + - **Username**: Leave blank or enter any value + - **Password**: Enter your {{% show-in "cloud-dedicated, clustered" %}}{{% token-link "database" %}}{{% /show-in %}}{{% show-in "cloud-serverless" %}}{{% token-link %}}{{% /show-in %}}{{% show-in "core, enterprise" %}}{{% token-link "admin" "database" %}}{{% /show-in %}}{{% show-in "enterprise" %}} with query permissions for the target database{{% /show-in %}} +9. Click **Connect** +10. Preview your data and click **Load** + +> [!Important] +> #### Limit query size for optimal performance +> {{% product-name %}} can handle high throughput and dimensional data. +> To ensure Power BI can successfully process data, limit query size by: +> - Using a `LIMIT` clause +> - Specifying time ranges with `WHERE time >= ...` +> - Filtering by specific columns or tags + +## Query and visualize data + +### Use Native Queries + +When connecting to InfluxDB 3, you can use the **Native Query** option to +execute custom SQL or InfluxQL queries: + +1. In the connection dialog, enable **Native Query** +2. Enter your query in the provided field: + + ```sql + SELECT + time, + temp, + room + FROM + home + WHERE + time >= now() - INTERVAL '7 days' + ORDER BY + time DESC + LIMIT 1000 + ``` + +3. Select **DirectQuery** as the connectivity mode +4. Click **OK** to load the data + +### Create visualizations + +After loading data, Power BI displays your dataset in the **Fields** pane. + +#### View data in a table + +1. In the **Visualizations** pane, select the **Table** visualization +2. In the **Fields** pane, select the columns to display: + - **time**: Timestamp column + - **room**: Tag column + - **temp**: Field column +3. By default, Power BI summarizes numeric fields. + To display raw values: + - Select the field in the **Fields** or **Visualizations** pane + - Go to the **Modeling** tab + - Change **Default Summarization** to **Don't Summarize** + +#### Create time series visualizations + +1. In the **Visualizations** pane, select a visualization type + (for example, **Line chart**) +2. Drag fields to the appropriate areas: + - **X-axis**: `time` field + - **Y-axis**: Measurement fields (for example, `temp`) + - **Legend**: Tag fields (for example, `room`) +3. Use the **Filters** pane to apply additional filters +4. Configure visualization properties in the **Format** pane +5. Save your report + +### Time series best practices + +- Always include time range filters in your queries to limit data volume +- Use the `time` column for time-based visualizations +- Apply Power BI's date hierarchy features with the `time` column +- Select only the columns you need to improve query performance +- Use the `LIMIT` clause to restrict the number of rows returned + +## Troubleshooting + +### Connector not found + +If Power BI Desktop doesn't show the InfluxDB 3 connector: + +- Verify the `.pqx` file is in the correct location: + `Documents\Power BI Desktop\Custom Connectors\` +- Ensure you enabled custom connectors in Power BI security settings +- Restart Power BI Desktop after copying the connector file + +### Connection errors + +If you encounter connection errors: + +- Verify your {{% product-name %}} instance is accessible +- Check that the host URL and port are correct + - Local instances typically use `http://localhost:8181` + - {{% show-in "cloud-serverless,cloud-dedicated" %}}{{% product-name %}} instances use cluster-specific URLs{{% /show-in %}} +- Ensure your token has query permissions for the specified database +- Verify firewall rules allow connections on the specified port + +### Authentication errors + +If authentication fails: + +- Verify your database token is valid and not expired +- {{% show-in "enterprise" %}}Ensure the token has permissions for the target database{{% /show-in %}} +- Check that you entered the token in the **Password** field +- Leave the **Username** field blank or enter any value + +### Query performance + +For better query performance: + +- Always use `WHERE` clauses to filter data before loading +- Include time range filters to limit the data scanned +- Select only the columns you need +- Use the `LIMIT` clause to restrict result size +- Consider using **DirectQuery** mode instead of **Import** for large datasets + +