Skip to content

Databases

InfluxDB Database Management in VS Code

InfluxDB is a purpose-built time-series database designed for handling high volumes of timestamped data. Key characteristics include:

  • Time-series optimized: Purpose-built storage engine for time-stamped data with automatic data lifecycle management
  • SQL support: Query data using familiar SQL syntax (InfluxDB 3.x)
  • High performance: Optimized for high-write throughput and fast queries over time ranges
  • Data retention policies: Automatic data expiration and downsampling
  • Built-in visualization: Native support for time-series visualization and dashboards
  • Cloud and self-hosted: Available as managed cloud service or self-hosted deployment

InfluxDB is ideal for IoT sensor data, application metrics, real-time analytics, DevOps monitoring, and any use case involving time-stamped measurements.

DBCode connects to both InfluxDB 3.x (using SQL) and InfluxDB 2.x (using InfluxQL).

To connect to InfluxDB in DBCode, you’ll need:

  1. Open the DBCode Extension: Launch Visual Studio Code and open the DBCode extension.
  2. Add a New Connection: Click on the “Add Connection” icon.
  3. Complete connection form: Select InfluxDB as the database type, then choose the InfluxDB Version:
    • 3.x (default):
      • Host/Server address
      • Port (default: 8181)
      • API Token for authentication
      • Database name
      • Enable SSL/TLS if required
    • 2.x:
      • Host/Server address
      • Port (default: 8086)
      • Organization (your InfluxDB 2.x organization name)
      • API Token for authentication
      • Database name
      • Enable SSL/TLS if required
  4. Connect: Click save to connect to your InfluxDB instance.
  5. Start Managing Your Data: Browse measurements and run queries.

For detailed instructions on connecting to databases, refer to the Connect article.

Prerequisite for InfluxDB 2.x: DBRP mapping

Section titled “Prerequisite for InfluxDB 2.x: DBRP mapping”

InfluxDB 2.x connections use InfluxQL, which queries buckets through the older database and retention policy (DBRP) model. InfluxQL can only see a bucket if that bucket has a DBRP mapping. If a bucket has no mapping, it will not appear as a database in DBCode.

Create a mapping with the InfluxDB CLI:

Terminal window
influx v1 dbrp create --bucket-id <bucket-id> --db <database-name> --rp <retention-policy-name> --default

Run this once for each bucket you want to query through DBCode.

DBCode enhances your InfluxDB development experience with:

  • SQL query editor: Write and execute SQL queries with syntax highlighting
  • Measurement browsing: Navigate through databases and measurements
  • Column type information: View field types and tag keys
  • Query results visualization: View and export query results
  • Time-series data display: Optimized display for time-stamped data

By using InfluxDB with DBCode, you can efficiently explore your time-series data, develop queries, and analyze metrics directly within Visual Studio Code.

For more information about InfluxDB, check out InfluxDB.