{"id":16966254,"url":"https://github.com/scottlepp/grafana-sqlproxy-datasource","last_synced_at":"2025-04-11T23:24:03.205Z","repository":{"id":41081692,"uuid":"241435659","full_name":"scottlepp/grafana-sqlproxy-datasource","owner":"scottlepp","description":"A grafana datasource plugin to connect to and query any SQL/SQL supported database.","archived":false,"fork":false,"pushed_at":"2021-03-09T16:38:40.000Z","size":1625,"stargazers_count":8,"open_issues_count":4,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-25T19:15:35.545Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scottlepp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-18T18:24:44.000Z","updated_at":"2023-08-24T18:20:40.000Z","dependencies_parsed_at":"2022-08-26T10:11:05.653Z","dependency_job_id":null,"html_url":"https://github.com/scottlepp/grafana-sqlproxy-datasource","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottlepp%2Fgrafana-sqlproxy-datasource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottlepp%2Fgrafana-sqlproxy-datasource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottlepp%2Fgrafana-sqlproxy-datasource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottlepp%2Fgrafana-sqlproxy-datasource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scottlepp","download_url":"https://codeload.github.com/scottlepp/grafana-sqlproxy-datasource/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248493675,"owners_count":21113299,"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","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":[],"created_at":"2024-10-14T00:05:13.476Z","updated_at":"2025-04-11T23:24:03.185Z","avatar_url":"https://github.com/scottlepp.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SqlProxy Grafana Datasource\n\n![Diagram](https://github.com/scottlepp/grafana-sqlproxy-datasource/blob/master/SQLProxyPlugin.png)\n\n## Features\n\nConnect and Query from any SQL Datasource (oracle, microsoft sql server, postgresql, mysql, snowflake, etc)\n\n## How to install the plugin:\n\n1. Install Grafana\n2. Clone this repo to the grafana plugins folder (`git clone https://github.com/grafana/sqlproxy-grafana-datasource /var/lib/grafana/plugins/sqlproxy-grafana-datasource`)\n\n## SQL Proxy \n\nThis datasource is dependent upon the SQL Proxy container. https://github.com/scottlepp/sql-proxy\n\nFor a quick local setup you can use Docker to run the container.  Once Docker is installed run the following to start the container:\n\n```\ndocker run -p 8081:8081 scottlepper/sql-proxy\n```\n\nThe proxy will now be running on port 8081.\n\nFollow the instructions here to connect to the SQL Proxy:  https://github.com/scottlepp/sql-proxy#using-the-proxy\n\n## Using the SqlProxy plugin\n\nIn the Grafana Datasource setup, set the URL to the proxy: http://localhost:8081\n\nFrom the dashboard, add a panel and select SQL Proxy from the Query dropdown.  You will see a SQL Editor.\n\nEnter your SQL and click away to run the SQL command and get results into the panel.\n\n## Time macros\n\nTo reference the dashboard time frame, you can supply macros (variables) within your sql:\n\n* $__timeFrom - the start time in milliseconds\n* $__timeTo - the end time in milliseconds\n* $__timeFrom(format) - the start time converted to a date string with the supplied format\n* $__timeTo(format) - the end time converted to a date string with the supplied format\n\n\"format\" example: \n* SELECT NAME FROM FOO where \"TIME\" \u003e '$__timeFrom(yyyy-MM-dd hh:mm:ss)' and \"TIME\" \u003c '$__timeTo(yyyy-MM-dd)'\n\n## How to contribute\n\nThis plugin is using Typescript.  \nAll the code goes into the `src` folder, and we let `webpack` watch for changes and update the `dist` folder.\n\nGrafana only reads the `dist` folder, and must be included with any release.\n\n## Developing without docker\n\n1. Install Grafana\n2. `git clone https://github.com/scottlepp/grafana-sqlproxy-datasource`\n3. `cd grafana-sqlproxy-datasource`\n4. `yarn install --pure-lockfile`\n5. `yarn watch` or `yarn dev`\n\n## Developing with docker\n\n1. `git clone https://github.com/grafana/grafana-sqlproxy-datasource`\n2. `cd grafana-sqlproxy-datasource`\n3. `` docker run -d -p 3000:3000 --name grafana -v `pwd`:/var/lib/grafana/plugins/grafana-sqlproxy-datasource/ grafana/grafana ``\n4. `yarn install --pure-lockfile`\n5. `yarn watch`\n\n## Using docker-compose\n\n```\nversion: \"3\"\nservices:\n  grafana:\n    image: grafana/grafana:${GRAFANA_VERSION:-latest}\n    ports:\n      - \"3000:3000\"\n    volumes:\n      - ./dist:/var/lib/grafana/plugins/grafana-sqlproxy-datasource\n      - ${GRAFANA_PROVISIONING:-./provisioning}:/etc/grafana/provisioning\n      - ${HOME}:${HOME}\n    environment:\n      - TERM=linux\n```\nNote the following environment variables that can be used:\n1. `GRAFANA_VERSION`: The grafana version you wish to use (default: latest)\n2. `GRAFANA_PROVISIONING`: The directory pointing to provisioning files (default: `./provisioning`)\n3. Your home directory will be mapped to home in the container\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscottlepp%2Fgrafana-sqlproxy-datasource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscottlepp%2Fgrafana-sqlproxy-datasource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscottlepp%2Fgrafana-sqlproxy-datasource/lists"}