{"id":20585410,"url":"https://github.com/jonathanlb/sqlite32grafana","last_synced_at":"2025-08-17T08:07:19.033Z","repository":{"id":48405343,"uuid":"261039236","full_name":"jonathanlb/sqlite32grafana","owner":"jonathanlb","description":"Publish sqlite3 tables to grafana/simple-json-datasource for visualization and exploration","archived":false,"fork":false,"pushed_at":"2021-07-27T19:31:04.000Z","size":84,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T21:09:05.561Z","etag":null,"topics":["datasource","grafana","timeserie"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonathanlb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-03T23:18:32.000Z","updated_at":"2022-12-24T18:38:22.000Z","dependencies_parsed_at":"2022-08-24T09:32:23.145Z","dependency_job_id":null,"html_url":"https://github.com/jonathanlb/sqlite32grafana","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jonathanlb/sqlite32grafana","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanlb%2Fsqlite32grafana","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanlb%2Fsqlite32grafana/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanlb%2Fsqlite32grafana/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanlb%2Fsqlite32grafana/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonathanlb","download_url":"https://codeload.github.com/jonathanlb/sqlite32grafana/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanlb%2Fsqlite32grafana/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270820793,"owners_count":24651534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datasource","grafana","timeserie"],"created_at":"2024-11-16T07:08:01.216Z","updated_at":"2025-08-17T08:07:18.984Z","avatar_url":"https://github.com/jonathanlb.png","language":"Go","readme":"# sqlite32grafana\n\nMonitor and explore the contents of your\n[Sqlite3](https://www.sqlite.org/index.html) database using\n[Grafana](https://github.com/grafana/grafana) and\n[simple-json-datasource](https://github.com/grafana/simple-json-datasource)\n to allow Grafana to pull data from Sqlite3 database files.\n\n## Startup\n```\ngo run main -port \u003cport-number\u003e \\\n  [-db file-name.sqlite3 -tab table-name -time time-column [-a db-alias] ]*\n```\n\nsqlite32grafana will fire up a server to listen for timeseries requests.\n(Table queries are not yet implemented.)\n\nOn your Grafana server,\n\n- Install [simple-json-datasource](https://github.com/grafana/simple-json-datasource).\n- Create a new datasource on from your Grafana web interface.\n - Select \"SimpleJson\" under the \"Others\" section near the bottom of the list.\n - Enter an URL under HTTP that looks like\n```\nhttp://your-host:port/db-file-or-alias/table-name/time-column\n```\n using the the command-line arguments matching the tuples used upon sqlite32grafana start up above.  The `-a` option, alias, is useful/required for avoiding slashes and other unpleasant characters in the DB file from appearing in the REST endpoint.\n - Clicking \"Save \u0026 Test\" should send a liveness check to your sqlite32grafana instance, or alert you of a mistake.\n- You'll need a separate datasource for every time column you'll query.\n\n### The Time Column\n\nA time column can be either a scalar value, `DATETIME`, or `TEXT` column.\nFor scalars, sqlite32grafana will infer either epoch seconds, milliseconds, or\nnanoseconds based upon the smallest value used in the column.\n\n## Query\n\nWhen you build a query, select your datasource; the \"timeserie\" option, and\nenter a column name from table you'll be querying for time series values.\nThe drop-down hint will auto-populate with the table column names, from which\nyou can select one.\n\nYou can apply tags or options to the query by appending them to the column name.\nUse a space to delimit an option from the value column and adjacent options.\nThe expected format/order of elements in the query is\n```\nvalue-column [tag-column] [interval-option]\n```\n\nThe entry will be used to build a SQL query in the form:\n```\nSELECT time-expr, value-expr, [tag-column] FROM table WHERE time-range [interval-group]\n```\n(ignoring order and row-limit modifiers).\n\n### Tags\nYou can signal Grafana to plot multiple time series from the same table using\na another column to name (tag) the series.\nFor example, if you have a table\n```\nCREATE TABLE patientTemperature (ts INT, patient TEXT, tempF REAL)\n```\nThe query target `tempF patient` will plot one temperature series for every\nunique value of `patient` encountered.\n\n### Summarization\nAny place that you use a column name in a query, you can also use\n[an aggregate function](https://www.sqlite.org/lang_aggfunc.html) on\nthe column, such as `count()` or `sum()`, useful during intervalization, next.\n\n### Intervalize\nYou can intervalize your results using the `t()` option to transform the time\ncolumn and group by the results.\nThe argument to `t()` is a SQL clause to transform the time column, which you\ncan alias as `?`\n\nFor example, if the time column `ts` represents epoch\nseconds, you can plot the count the number of rows every six hours with\nthe target query\n```\ncount(ts) t(21600*(?/21600))\n```\nwhich translates to a querying\n```\nSELECT 21600*(ts/21600), count(ts) FROM notes WHERE ts \u003e= ? AND ts \u003c ? GROUP BY 21600*(ts/21600) ORDER BY 21600*(ts/21600)\n```\nWe'll implement duration-based rounding intervalization to allow terser queries\nfor a future issue.\n\nCurrently, we ignore the `__interval` and `__interval_ms` options on the\nGrafana request.\n\n## Debugging\n\nsqlite32grafana uses the `DEBUG` environment variable to turn on development\ndebugging.  Any non-empty value will trigger it at the moment....\n\n## TODO\n- Implement table queries.\n- Add intervalization aliases to allow duration, e.g. `i(10s)` to intervalize\nevery 10 seconds.\n- Apply adhocFilters from grafana query.\n- Implement multiple group-by options.\n- Implement tag-values.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanlb%2Fsqlite32grafana","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanlb%2Fsqlite32grafana","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanlb%2Fsqlite32grafana/lists"}