[FEATURE] Add SQL Datasource Plugin with Explorer Support #542
+13,236
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a comprehensive SQL datasource plugin for Perses, enabling users to query and visualize data from PostgreSQL, MySQL, and MariaDB databases. The plugin includes a full-featured Explorer mode similar to the Prometheus plugin, providing both table and graph views for SQL query results.
Key Features
SQL Datasource Plugin
SQL Time Series Query Plugin
$__timeFilter(column)- Generates time range filter$__timeFrom- Query start time$__timeTo- Query end time$__interval- Auto-calculated interval$__interval_ms- Interval in millisecondsSQL Explorer Plugin (New)
Architecture
The plugin follows Perses plugin architecture best practices:
Frontend (TypeScript/React)
Backend Integration
sslmode=disablefor development environmentsTesting
Unit Tests (12 tests, all passing)
replace-sql-builtin-variables.test.ts)sql-client.test.ts)SQLDatasource.test.tsx)Test Data
Documentation
Screenshots
SQL Datasource Configuration
SQL Explorer - Table View
SQL Plugin View
Dashboard with SQL Panel
Checklist
[FEATURE] <commit message>naming convention.UI Changes
Additional Notes
What's Included
✅ Production-ready features:
Future Enhancements (Not Blocking)
Testing Instructions
Start test databases:
cd plugins/sql make db-upRun unit tests:
npm testBuild the plugin:
Manual testing:
Database Compatibility
Migration Notes
This is a new plugin and does not require migration from existing configurations.
Related issues
Add PostgreSQL plugin support
Related PRs
Adapt the proxy output
Handle the MariaDB support for the backend proxy