{"id":13576627,"url":"https://github.com/runreveal/pql","last_synced_at":"2026-01-12T02:58:34.914Z","repository":{"id":224627188,"uuid":"748871374","full_name":"runreveal/pql","owner":"runreveal","description":"Pipelined Query Language","archived":false,"fork":false,"pushed_at":"2024-06-15T03:33:07.000Z","size":187,"stargazers_count":628,"open_issues_count":4,"forks_count":24,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-08-14T09:47:13.218Z","etag":null,"topics":["clickhouse","detection-engineering","go","golang","query-language","siem","sql"],"latest_commit_sha":null,"homepage":"https://pql.dev","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/runreveal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2024-01-26T23:15:38.000Z","updated_at":"2024-07-23T12:17:21.000Z","dependencies_parsed_at":"2024-06-11T18:43:00.063Z","dependency_job_id":"630b9259-8b30-4f10-b15a-8a9e543a52aa","html_url":"https://github.com/runreveal/pql","commit_stats":null,"previous_names":["runreveal/pql"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runreveal%2Fpql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runreveal%2Fpql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runreveal%2Fpql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runreveal%2Fpql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/runreveal","download_url":"https://codeload.github.com/runreveal/pql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223176487,"owners_count":17100638,"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":["clickhouse","detection-engineering","go","golang","query-language","siem","sql"],"created_at":"2024-08-01T15:01:12.179Z","updated_at":"2026-01-12T02:58:34.865Z","avatar_url":"https://github.com/runreveal.png","language":"Go","readme":"# pipelined query language\n\n[![Website](https://img.shields.io/badge/INTRO-WEB-blue?style=for-the-badge)](https://pql.dev)\n[![Playground](https://img.shields.io/badge/INTRO-PLAYGROUND-blue?style=for-the-badge)](https://pql.dev)\n[![Discord](https://img.shields.io/discord/1120882187785470113?label=discord%20chat\u0026style=for-the-badge)](https://discord.gg/PbeXzrWP)\n\n\nThis Go library compiles a pipelined-based query language\n(inspired by the [Kusto Query Language][])\ninto SQL.\nIt has been specifically tested to work with the [Clickhouse SQL dialect][],\nbut the generated SQL is intentionally database agnostic. This repository\ncontains a Go library, and a CLI to invoke the library.\n\nFor example, the following expression:\n\n```plain\nStormEvents\n| where DamageProperty \u003e 5000 and EventType == \"Thunderstorm Wind\"\n| top 3 by DamageProperty\n```\n\nwill be compiled to SQL that is similar to:\n\n```sql\nSELECT *\nFROM StormEvents\nWHERE DamageProperty \u003e 5000 AND EventType = 'Thunderstorm Wind'\nORDER BY DamageProperty DESC\nLIMIT 3;\n```\n\n[Kusto Query Language]: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/\n[Clickhouse SQL dialect]: https://clickhouse.com/docs/en/sql-reference\n\n## Getting Started\nIf you'd like to see a demo along with some examples, check out https://pql.dev.\n\nTo use pql in your go code, a minimal example might look like this\n```\npackage main\n\nimport (\n\t\"github.com/runreveal/pql\"\n)\n\nfunc main() {\n\tsql, err := pql.Compile(\"users | project id, email | limit 5\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tprintln(sql)\n}\n```\n\nRunning this program should give you the following output\n```\n$ go run test.go\n\nWITH \"__subquery0\" AS (SELECT \"id\" AS \"id\", \"email\" AS \"email\" FROM \"users\")\nSELECT * FROM \"__subquery0\" LIMIT 5;\n```\n\n## Documentation\n\nThe following tabular operators are supported and the Microsoft KQL\ndocumentation is representative of the current pql api.\n\n- [`as`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/as-operator)\n- [`count`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/count-operator)\n- [`join`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/join-operator)\n- [`let` statements](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/let-statement),\n  but only scalar expressions are supported.\n- [`project`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/project-operator)\n- [`extend`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/extend-operator)\n- [`sort`/`order`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/sort-operator)\n- [`summarize`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/summarize-operator)\n- [`take`/`limit`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/take-operator)\n- [`top`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/top-operator)\n- [`where`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/where-operator)\n\nThe following scalar functions are implemented within pql. Functions not in this\nlist will be passed through to the underlying SQL engine. This allows the usage\nof the full APIs implemented by the underlying engine.\n\n- [`not`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/not-function)\n- [`now`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/now-function)\n- [`isnull`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/isnull-function)\n  and [`isnotnull`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/isnotnull-function)\n- [`strcat`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/strcat-function)\n- [`iff`/`iif`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/iff-function)\n- [`count`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/count-aggregation-function)\n- [`countif`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/countif-aggregation-function)\n- [`tolower`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/tolower-function)\n- [`toupper`](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/toupper-function)\n\n\nColumn names with special characters can be escaped with backticks.\n\n## Get involved\n- Join our [discord](https://discord.gg/NZS9QtCJXt)\n- Contribute a [scalar function](./CONTRIBUTING.md)\n\n## License\n[Apache 2.0](LICENSE)\n","funding_links":[],"categories":["Go","Language bindings"],"sub_categories":["Golang"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunreveal%2Fpql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frunreveal%2Fpql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunreveal%2Fpql/lists"}