SQL query interface for NetBox with syntax highlighting, abstract views, and role-based access control
Project description
netbox-sqlquery
A NetBox plugin that provides a SQL query interface with syntax highlighting, abstract views, saved queries, and role-based access control.
Features
- SQL console with real-time syntax highlighting and auto-uppercase keywords
- Abstract views (
nb_*) that resolve foreign keys to names and aggregate tags - Schema sidebar with search filter and Raw SQL / Views toggle
- Interactive results: click columns to refine SELECT, click cells to add WHERE filters
- Saved queries with save/load dialogs and private/public visibility
- Write query support (INSERT, UPDATE, DELETE) with confirmation dialog
- Role-based access control integrated with NetBox's ObjectPermission system
- Per-user color preferences for syntax highlighting
- CSV export
- Compatible with NetBox 4.0 through 4.5, netbox-docker, and OIDC providers
Screenshots
Views mode
Query abstract views that resolve foreign keys and aggregate tags, matching how data appears in the NetBox UI.
Raw SQL mode
Query the database directly with full PostgreSQL power.
Column select
Click column headers to refine which columns are returned.
Saving queries
Save queries for reuse with private or public visibility.
Saved queries list
Permissions setup
Control access using NetBox's native ObjectPermission system.
User preferences
Customize syntax highlighting colors per user.
Compatibility
See COMPATIBILITY.md for the full version matrix.
| NetBox version | Python versions |
|---|---|
| 4.0 - 4.5 | 3.10, 3.11, 3.12, 3.13, 3.14 |
Installation
pip install netbox-sqlquery
Add to your NetBox configuration.py:
PLUGINS = ["netbox_sqlquery"]
PLUGINS_CONFIG = {
"netbox_sqlquery": {
"require_superuser": True,
"max_rows": 1000,
"statement_timeout_ms": 10000,
"deny_tables": [
"auth_user",
"users_token",
"users_userconfig",
],
}
}
Run migrations:
python manage.py migrate netbox_sqlquery
Collect static files:
python manage.py collectstatic --no-input
For Docker-based installations, see docs/docker.md.
Configuration
| Setting | Type | Default | Description |
|---|---|---|---|
require_superuser |
bool | True |
Require superuser to access the query view |
max_rows |
int | 1000 |
Maximum rows returned per query |
statement_timeout_ms |
int | 10000 |
PostgreSQL statement timeout in milliseconds |
deny_tables |
list | ["auth_user", "users_token", "users_userconfig"] |
Tables blocked for all users including superusers |
top_level_menu |
bool | False |
Show as a top-level nav menu instead of under Plugins |
Documentation
License
Apache 2.0. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file netbox_sqlquery-0.1.1.tar.gz.
File metadata
- Download URL: netbox_sqlquery-0.1.1.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
349eedddeb3128f190c83e3cd5e68561bde82a1b8096f95bcb9f1d1c98c98d22
|
|
| MD5 |
d49223adabd7be475496ebdc1d636b0a
|
|
| BLAKE2b-256 |
72caf3044c9ae08000ae3300c0f290f4c480d277ba425d687dc277e697084a35
|
Provenance
The following attestation bundles were made for netbox_sqlquery-0.1.1.tar.gz:
Publisher:
publish.yml on ravinald/netbox-sqlquery
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netbox_sqlquery-0.1.1.tar.gz -
Subject digest:
349eedddeb3128f190c83e3cd5e68561bde82a1b8096f95bcb9f1d1c98c98d22 - Sigstore transparency entry: 1200296964
- Sigstore integration time:
-
Permalink:
ravinald/netbox-sqlquery@b017a17e359c70b64ea2efa1cca43e44a8338289 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/ravinald
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b017a17e359c70b64ea2efa1cca43e44a8338289 -
Trigger Event:
push
-
Statement type:
File details
Details for the file netbox_sqlquery-0.1.1-py3-none-any.whl.
File metadata
- Download URL: netbox_sqlquery-0.1.1-py3-none-any.whl
- Upload date:
- Size: 31.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88174c741ec6c78e1cfe63920b4e2cea8feeb70c182869838227f5b3afc15398
|
|
| MD5 |
72e830f5f88fd910bf4af0e080e0a5d6
|
|
| BLAKE2b-256 |
49599e922aeafed5911bcd2f4d1d74d659bdad1afbeba7a75894a0903e529e83
|
Provenance
The following attestation bundles were made for netbox_sqlquery-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on ravinald/netbox-sqlquery
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netbox_sqlquery-0.1.1-py3-none-any.whl -
Subject digest:
88174c741ec6c78e1cfe63920b4e2cea8feeb70c182869838227f5b3afc15398 - Sigstore transparency entry: 1200296967
- Sigstore integration time:
-
Permalink:
ravinald/netbox-sqlquery@b017a17e359c70b64ea2efa1cca43e44a8338289 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/ravinald
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b017a17e359c70b64ea2efa1cca43e44a8338289 -
Trigger Event:
push
-
Statement type: