-
Notifications
You must be signed in to change notification settings - Fork 41
[FEATURE] Add SQL Datasource Plugin with Explorer Support #542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
e0cd822 to
82e7d52
Compare
|
Related to: perses/perses#2930 |
rickardsjp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution. Please add the sql plugin to the top level (monorepo root) package.json workspaces list. Otherwise, it will not be included in e.g. the build and lint commands. Once you include it, please take a look at the linter issues, too.
82e7d52 to
3f6cc91
Compare
Signed-off-by: Pascal Zimmermann <pascal.zimmermann@theiotstudio.com>
3f6cc91 to
4648fef
Compare
Signed-off-by: Pascal Zimmermann <pascal.zimmermann@theiotstudio.com>
| datasource?: { | ||
| kind: "SQLDatasource" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check how to improve this query schema to ensure it's compatible with the DatasourceVariable plugin https://github.com/perses/plugins/pull/540/changes#diff-6f1afe7036188e8a850133c2bbb0e495ec791fc97629478bb7581e291a7e916a
You'll have to edit the datasource schema to provide a #selector, see https://github.com/perses/plugins/pull/540/changes#diff-8761f27760297b04f98f79b9ff23665a6649ab00556da9fe03091cf7d5f25915R28
|
Update: I'll further update the source code after this PR is merged. |
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