{"id":18600145,"url":"https://github.com/giancarl021/csvql","last_synced_at":"2026-05-01T19:32:07.551Z","repository":{"id":104871278,"uuid":"306492763","full_name":"Giancarl021/csvql","owner":"Giancarl021","description":"A module to quickly query CSV data as a SQL","archived":false,"fork":false,"pushed_at":"2021-02-19T18:31:46.000Z","size":107,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-28T19:39:51.660Z","etag":null,"topics":["cli","csv","nodejs","sql"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/Giancarl021.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":"2020-10-23T00:46:56.000Z","updated_at":"2023-02-13T23:20:06.000Z","dependencies_parsed_at":"2023-06-03T05:30:59.908Z","dependency_job_id":null,"html_url":"https://github.com/Giancarl021/csvql","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"8053b0a1f95656056162ee79c4bb8c833503416d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Giancarl021%2Fcsvql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Giancarl021%2Fcsvql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Giancarl021%2Fcsvql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Giancarl021%2Fcsvql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Giancarl021","download_url":"https://codeload.github.com/Giancarl021/csvql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239389577,"owners_count":19630310,"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":["cli","csv","nodejs","sql"],"created_at":"2024-11-07T02:03:10.544Z","updated_at":"2026-05-01T19:32:07.514Z","avatar_url":"https://github.com/Giancarl021.png","language":"JavaScript","readme":"# csvql\n\nA module to quickly query CSV data as a SQL\n\nSimilar packages:\n\n* (Node) [tables](https://www.npmjs.com/package/tables)\n* (Go) [textql](https://github.com/dinedal/textql)\n\n## Installation\n\n### CLI\n\nnpm:\n\n```bash\nnpm install --global csvql\n```\n\nyarn:\n\n```bash\nyarn add global csvql\n```\n\n### API\n\nnpm:\n\n```bash\nnpm install csvql\n```\n\nyarn:\n\n```bash\nyarn add csvql\n```\n\n## Usage\n\nThis module can be used in two formats: CLI and API.\n\n### CLI\n\n#### Create session\nTo start the application you use this command on terminal:\n\n```bash\ncsvql [path/to/file1.csv[ path/to/file2.csv [...]]]\n```\n\n##### Arguments\n\nEach argument needs to point to a CSV file.\n\n##### Flags\n\n* ``-p | --persist``: Create a disk database with the data when the session is closed. Values: ``\u003csession-name\u003e | null``. If null a random name will be used;\n* ``-d | --delimiter``: The delimiter of the CSV file. Default is ``,``. Values: ``\u003cdelimiter\u003e``;\n* ``-D | --disk``: Create the session on a in-disk database, useful when the CSV is too large to a in-memory database;\n* ``-f | --from``: Restart a persistent session in-memory. Values: ``\u003csession-name\u003e``; If invalid the startup will be aborted;\n* ``--verbose``: Show top level JavaScript errors if they occur.\n\nAfter that the interactive terminal of csvql will start.\n\n#### Commands\nThe CLI have 4 commands:\n\n##### Help\nPrints all the available commands.\n\n```\ncsvql\u003e help\nselect \u003csql query\u003e: Queries into imported schemas.\nschema \u003coperation\u003e: Manage the schemas of the current session.\n  list: List all tables and columns available.\n  import \u003cpath [as \u003ctableName\u003e[, ...]]\u003e: Import a new schema from CSV file(s).\n  drop \u003ctableName\u003e: Delete a table of the current session.\n  rename \u003ctableName\u003e \u003cnewTableName\u003e: Rename a table of the current session.\nhelp: List all available commands.\nexit: Close the current session.\n```\n\n##### Exit\nClose the application, equivalent of ``^C``.\n\n##### Schema\nManages the schemes on the current session\n\n**Operations**\n\n*list*\n\nList all the tables on current session, with the types.\n\n*import*\n\nImport CSV files, follows the syntax:\n```\ncsvql\u003e schema import path/to/file.csv [as table] [, ...]\n```\n\n*rename*\n\nRename a table on current session.\n\n*drop*\n\nDelete a table on current session.\n\n##### Select\nSQL SELECT Query, from [sqlite](https://www.sqlite.org/index.html).\n\n### API\n\n#### Initialization\n\n```javascript\n// Importing\nconst createCsvql = require('csvql');\n\n// Initialize\nconst csvql = await createCsvql(files, options);\n```\n\n#### Files\n\nYou can provide initial file paths:\n\n```javascript\nconst files = [\n\t'path/to/file1',\n\t'path/to/file2',\n\t'path/to/file3',\n\t...etc\n];\n\n```\n\n#### Options\n\nYou can provide some options to change the behavior of the module:\n\n```javascript\nconst options = {\n\tfrom: null, // Import session (path/to/session)\n    persist: null, // Save session (path/to/session)\n    disk: null, // Create session on disk (path/to/session)\n    parseCommaAsDecimal: false // Parse strings like 0,123 as 0.123\n};\n```\n\n#### Functions\n\n##### schema\n\n**list**\n\nList all tables on current session\n\n```javascript\nconst result = await csvql.schema('list');\n```\n\nReturn:\n\n```javascript\nconst result = [\n\t{\n\t\tname: 'file',\n\t\tcolumns: [\n\t\t\t'a': 'int',\n\t\t\t'b': 'float'\n\t\t]\n\t},\n\t...etc\n]\n```\n\n**rename**\n\nRename a table on current session\n\n```javascript\nawait csvql.schema('rename', 'oldName', 'newName');\n```\n\n**import**\n\n```javascript\nawait csvql.schema('import', 'path/to/file');\n```\n\n**drop**\n\nDelete a table on current session\n\n```javascript\nawait csvql.schema('drop', 'file');\n```\n\n##### select\n\nRun SQL-like ``SELECT``'s, as example:\n\n```javascript\nconst result = await csvql.select('* from file1');\n```\n\nThe result will be the same as the [better-sqlite3]() module, with the format:\n\n```javascript\n[\n\t{\n\t\tcolumn: 'value'\n\t}\n]\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiancarl021%2Fcsvql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiancarl021%2Fcsvql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiancarl021%2Fcsvql/lists"}