{"id":13508736,"url":"https://github.com/parihaaraka/sqt","last_synced_at":"2026-02-12T05:02:15.511Z","repository":{"id":69542765,"uuid":"123259471","full_name":"parihaaraka/sqt","owner":"parihaaraka","description":"sql query tool","archived":false,"fork":false,"pushed_at":"2025-01-16T17:41:48.000Z","size":741,"stargazers_count":35,"open_issues_count":2,"forks_count":10,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-01-16T18:58:39.742Z","etag":null,"topics":["database","ms-sql","odbc","postgresql","qt","sql"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parihaaraka.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-28T09:10:15.000Z","updated_at":"2025-01-16T17:41:50.000Z","dependencies_parsed_at":"2024-08-23T11:45:49.695Z","dependency_job_id":"236e362a-ef60-46cd-aa41-a5242bd8744a","html_url":"https://github.com/parihaaraka/sqt","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/parihaaraka%2Fsqt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parihaaraka%2Fsqt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parihaaraka%2Fsqt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parihaaraka%2Fsqt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parihaaraka","download_url":"https://codeload.github.com/parihaaraka/sqt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246314015,"owners_count":20757453,"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":["database","ms-sql","odbc","postgresql","qt","sql"],"created_at":"2024-08-01T02:00:57.703Z","updated_at":"2026-02-12T05:02:10.459Z","avatar_url":"https://github.com/parihaaraka.png","language":"C++","funding_links":[],"categories":["C++","sql"],"sub_categories":[],"readme":"# sqt\n`sqt` (sql query tool) is a cross-platform program to provide typical sql data source exploring and programming interface.\n\n## Overview\nThe subject was aimed to provide fast and convenient MS SQL query tool under linux. The only existing ODBC interface lead to support of any other ODBC data source. As a result of pgAdmin3 deprecation `sqt` was modified to have a native PostgreSQL support via libpq. Due to my current needs PostgreSQL support is in priority.\nThe main target audience are db programmers.\n#### Binaries\nStandalone (outdated) [sqt for windows x64](https://drive.google.com/open?id=1pD-twf3N0svQv-UzolVLlaUl3PZ1GK8U) (~12Mb)\n\n## Feature highlights\n* Customizable objects tree and textual/tabular content view (see [scripts/README.md](https://github.com/parihaaraka/sqt/blob/master/scripts/README.md)) let you build you own tree with application-specific nodes;\n* adjustable sql highlighting (see any existing `hl.conf` for more details);\n* alternative sorting (e.g., sort table columns in original/alphabetical order);\n* multiple selection to generate appropriate SQL code (e.g., select/insert/update commands with selected columns only); \n* convenient (Qt Creator-like) search/replace panel;\n* multiple resultsets support;\n* bookmarks (mark: `Ctrl+M`, previous: `Ctrl+,`, next: `Ctrl+.`, last: `Ctrl+L`);\n* uppercase (`Ctrl+U`), lowercase (`Ctrl+Shift+U`, `Ctrl+Win+U`)\n* code completion support (`Ctrl+Space`);\n* json viewer with highlighting and extracting json from it's nested text value (`Ctrl+J`);\n* totalling selected cells (`F6`);\n* customizable time charts to display [current](https://github.com/parihaaraka/sqt/blob/master/scripts/postgres/statistics.sql) or [recorded](https://github.com/parihaaraka/sqt/blob/master/scripts/postgres/recorded_statistics.sql) statistics;\n* resultsets structure textual output;\n* pg: client-side COPY to file or log widget, COPY from file;\n* pg: receiving notifications (`NOTIFY`) and messages (`RAISE`).\n\n![screenshot](https://github.com/parihaaraka/sqt/wiki/img/screenshot1.png)\n![screenshot](https://github.com/parihaaraka/sqt/wiki/img/charts.png)\n\n## COPY to/from local file via meta-comments (pg only)\nUse `COPY FROM STDIN` and `COPY TO STDOUT` forms of the command with some magic in comments:\n```sql\n/*sqt { \"copy_dst\": [\"/tmp/pg_stat_activity.csv\", \"/tmp/pg_stat_database.csv\"] } */\ncopy (select * from pg_stat_activity) to stdout with (format csv, header);\ncopy (select * from pg_stat_database) to stdout with (format csv, header);\n```\nSpecify an empty string instead of file name for output to the log widget:\n```sql\n/*sqt { \"copy_dst\": \"\" } */\ncopy (select * from pg_stat_activity) to stdout with (format csv, header);\n```\n* As you can see, the non-array form of `copy_dst` may be used in case of single source query.\n\n\n```sql\ncreate table tmp1 as select * from pg_stat_activity limit 0;\ncreate table tmp2 as select * from pg_stat_database limit 0;\n\n/*sqt { \"copy_src\": [\"/tmp/pg_stat_activity.csv\", \"/tmp/pg_stat_database.csv\"] } */\ncopy tmp1 from stdin with (format csv, header);\ncopy tmp2 from stdin with (format csv, header);\n```\n\n## Charting via meta-comments\n### Timelines example:\n```sql\n/*sqt\n{\n    \"interval\": 1000,\n    \"charts\": [\n        {\n            \"name\": \"sessions\",\n            \"y\": { \"active\": \"#0b0\", \"total\": \"#c00\", \"idle\": \"#00c\" }\n        },\n        {\n            \"name\": \"transactions, backends\",\n            \"agg_y\": { \"xact_commit\": \"#0b0\", \"xact_rollback\": \"#c00\" },\n            \"y\" : { \"numbackends\": \"#00c\" }\n        },\n        {\n            \"name\": \"tuples out\",\n            \"agg_y\": { \"fetched\": \"#cb0\", \"returned\": \"#0c0\" }\n        }\n    ]\n}\n*/\nselect count(*) total,\n    count(*) filter (where state = 'active') active,\n    count(*) filter (where state = 'idle') idle\nfrom pg_stat_activity;\n\nselect\n    sum(xact_commit) xact_commit,\n    sum(numbackends) numbackends,\n    sum(xact_rollback) xact_rollback,\n    sum(tup_fetched) fetched,\n    sum(tup_returned) returned\nfrom pg_stat_database;\n```\n`interval` - interval to reexecute queries (milliseconds);\n\n`charts` - list of charts with names and graphical paths description;\n\n`agg_y` - cumulative values source.\n\n### Plot some source of (x,y) values\n```sql\n/*sqt\n{\n    \"charts\": [\n        {\n            \"name\": \"tps_log\",\n            \"x\": \"ts\",\n            \"y\": {\n                \"f1\": \"#0c0\"\n            }\n        }\n    ]\n}\n*/\nselect s.ts, 5 + 4*random() f1\nfrom generate_series(now(), now() + '20min'::interval, '1sec'::interval) as s(ts)\n```\n\n## Build instruction\nYou may build the project by means of QtCreator or execute this sequence of commands from the project's root directory:\n```\nmkdir build \u0026\u0026 cd build \u0026\u0026 qmake ../src/sqt.pro \u0026\u0026 make\n```\nQt toolchain must be installed and be available via PATH.\n\n## Todo\n* Improve code completion, prepare scripts to fetch metadata from non-postgresql data sources;\n* executing of JavaScript along with SQL to run automation tasks;\n* new script types to extend objects tree interaction (modifying, administration tasks);\n* enhance scripts to make `sqt` as useful as possible (+provide scripts for different dbms, versions, generic odbc data source);\n* batch mode;\n* reports.\n\n### Acknowledgment\nSome icons by [Yusuke  Kamiyamane](http://p.yusukekamiyamane.com). All rights reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparihaaraka%2Fsqt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparihaaraka%2Fsqt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparihaaraka%2Fsqt/lists"}