Skip to main content

System requirements

Query Exporter requires:
  • Python: 3.11 or later (for pip installation)
  • Operating system: Linux, macOS, or Windows
  • Database drivers: Depends on which databases you’ll connect to (see below)

Installation methods

Install from PyPI

Install Query Exporter using pip:
pip install query-exporter
After installation, verify it works:
query-exporter --help
The basic installation includes SQLAlchemy but not database-specific drivers. Install drivers separately based on your needs.

Database drivers

Query Exporter uses SQLAlchemy, which requires database-specific drivers. Install the appropriate driver for your database:
# Using psycopg2 (recommended)
pip install psycopg2-binary

# Or using psycopg3
pip install psycopg
DSN format: postgresql://user:password@host:port/database
# Using mysqlclient (recommended)
pip install mysqlclient

# Or using PyMySQL
pip install pymysql
DSN format: mysql://user:password@host:port/database
# Using pymssql
pip install pymssql

# Or using pyodbc
pip install pyodbc
DSN format: mssql+pymssql://user:password@host:port/database
# Using python-oracledb (recommended)
pip install oracledb

# Or using cx_Oracle
pip install cx_Oracle
DSN format: oracle+oracledb://user:password@host:port/service
SQLite support is built-in to Python. No additional driver needed.DSN format: sqlite:///path/to/database.db or sqlite:// for in-memory
pip install ibm-db-sa
DSN format: db2://user:password@host:port/database
pip install clickhouse-sqlalchemy
DSN format: clickhouse+native://user:password@host:port/database
pip install teradatasql
DSN format: teradatasql://user:password@host/database
See the SQLAlchemy documentation for the complete list of supported databases and connection string formats.

Verify installation

After installation, verify Query Exporter is working:
1

Check version

query-exporter --help
2

Validate configuration

Create a minimal config.yaml and test it:
query-exporter --check-only --config config.yaml
3

Run the exporter

query-exporter --config config.yaml
4

Access metrics

Open your browser or use curl:
curl http://localhost:9560/metrics

Dependencies

Query Exporter requires the following Python packages (installed automatically):
  • aiohttp: Async HTTP server
  • croniter: Cron schedule parsing
  • prometheus-aioexporter (≥3.1): Prometheus exporter framework
  • prometheus-client: Prometheus client library
  • pydantic: Configuration validation
  • python-dateutil: Date and time utilities
  • pyyaml: YAML configuration parsing
  • sqlalchemy (≥2.0): Database abstraction layer
  • structlog: Structured logging

Next steps

Quickstart guide

Create your first configuration and run a query

Configuration reference

Learn about all available configuration options

Build docs developers (and LLMs) love