{"id":15767460,"url":"https://github.com/lmangani/ifql-parser","last_synced_at":"2025-10-11T07:04:59.890Z","repository":{"id":57292917,"uuid":"139197005","full_name":"lmangani/ifql-parser","owner":"lmangani","description":"InfluxDB Query Language parser","archived":false,"fork":false,"pushed_at":"2023-04-26T00:04:33.000Z","size":56,"stargazers_count":3,"open_issues_count":4,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-19T06:16:23.349Z","etag":null,"topics":["dsl","elastic","ifql","influx","influxdb","javascript","nearley","node","parse","parser","query"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lmangani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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},"funding":{"github":["lmangani"]}},"created_at":"2018-06-29T21:17:45.000Z","updated_at":"2019-11-18T19:35:48.000Z","dependencies_parsed_at":"2024-10-19T03:27:57.452Z","dependency_job_id":null,"html_url":"https://github.com/lmangani/ifql-parser","commit_stats":{"total_commits":26,"total_committers":2,"mean_commits":13.0,"dds":"0.038461538461538436","last_synced_commit":"488a0b5463db2ea8c89e44899cc2c078d8ed7cd6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmangani%2Fifql-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmangani%2Fifql-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmangani%2Fifql-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmangani%2Fifql-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lmangani","download_url":"https://codeload.github.com/lmangani/ifql-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249347305,"owners_count":21255148,"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":["dsl","elastic","ifql","influx","influxdb","javascript","nearley","node","parse","parser","query"],"created_at":"2024-10-04T13:22:14.328Z","updated_at":"2025-10-11T07:04:54.871Z","avatar_url":"https://github.com/lmangani.png","language":"JavaScript","funding_links":["https://github.com/sponsors/lmangani"],"categories":[],"sub_categories":[],"readme":"# ifql-parser \u003cimg src=\"https://user-images.githubusercontent.com/1423657/38137158-590eefbc-3423-11e8-96dd-487022b5618c.gif\" width=100 /\u003e\nInfluxDB Query Language parser\n\n### Status\n\n* Work in progress! Testers and Contributors welcome\n\n#### Todo\n\n* Parser\n  * [x] Baseline SQL parser\n  * [x] FROM parser\n  * [x] TIME math\n  * [ ] Quotes parser\n  * [ ] Cleanup \u0026 Tests\n* Output\n  * [x] JSON output\n  * [x] Elastic DSL output\n  \n### JSON Example\n```\nconst parser = require('ifql-parser')();\nparser.parse('SELECT sum('load') AS mean_cpu FROM telegraf.autogen.cpu WHERE time \u003e now() - 6h GROUP BY time(3600)');\n```\n##### Output\n```javascript\n{ referencedTables: [ 'cpu' ],\n  createdTables: undefined,\n  sourceTables: [ 'cpu' ],\n  operation: 'select',\n  parsed:\n   { type: 'select',\n     top: undefined,\n     all_distinct: undefined,\n     selection:\n      { type: 'selection_columns',\n        columns:\n         [ { type: 'column',\n             expression:\n              { type: 'function_call',\n                name: { value: 'sum' },\n                parameters: [ { type: 'string', string: 'load' } ] },\n             alias: { type: 'identifier', value: 'mean_cpu' } } ] },\n     table_exp:\n      { type: 'from_table',\n        from:\n         { type: 'from',\n           table_refs:\n            [ { type: 'table', table: 'cpu', db: 'telegraf', ret: 'autogen' } ] },\n        where:\n         { type: 'where',\n           condition:\n            { type: 'operator',\n              operator: '\u003e',\n              left: { type: 'identifier', value: 'time' },\n              right:\n               { type: 'operator',\n                 operator: '-',\n                 left:\n                  { type: 'function_call',\n                    name:\n                     { value: 'now',\n                       from_timestamp: 1545482191716,\n                       to_timestamp: 1545482213317 },\n                    parameters: [] },\n                 right:\n                  { type: 'decimal',\n                    value: 6,\n                    range: { type: 'data_type', data_type: 'hour', size: undefined } } } } },\n        groupby:\n         { type: 'group_by',\n           columns:\n            { type: 'selection_columns',\n              columns:\n               [ { type: 'column',\n                   expression:\n                    { type: 'function_call',\n                      name: { value: 'time' },\n                      parameters: [ { type: 'decimal', value: 3600 } ] } } ] } },\n        having: undefined,\n        order: undefined } },\n  joins: [],\n  returnColumns: [ { name: 'mean_cpu', sourceColumns: [] } ] }\n```\n\n##### Credits\n* Parser built using the [nearley](https://www.npmjs.com/package/nearley) ToolKit\n* Grammar baseline forked from [js-sql-parse](https://github.com/justinkenel/js-sql-parse)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flmangani%2Fifql-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flmangani%2Fifql-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flmangani%2Fifql-parser/lists"}