Databases
InfluxDB Database Management in VS Code
Overview
Section titled “Overview”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).
Connecting
Section titled “Connecting”To connect to InfluxDB in DBCode, you’ll need:
- Open the DBCode Extension: Launch Visual Studio Code and open the DBCode extension.
- Add a New Connection: Click on the “Add Connection” icon.
- 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
- 3.x (default):
- Connect: Click save to connect to your InfluxDB instance.
- 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:
influx v1 dbrp create --bucket-id <bucket-id> --db <database-name> --rp <retention-policy-name> --defaultRun this once for each bucket you want to query through DBCode.
InfluxDB Features in DBCode
Section titled “InfluxDB Features in 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.