{"id":18017752,"url":"https://github.com/assafmo/sqlitequeryserver","last_synced_at":"2025-03-26T19:33:58.711Z","repository":{"id":57641442,"uuid":"179961616","full_name":"assafmo/SQLiteQueryServer","owner":"assafmo","description":"Bulk query SQLite database over the network","archived":false,"fork":false,"pushed_at":"2020-04-19T17:31:59.000Z","size":53,"stargazers_count":51,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-22T07:51:22.120Z","etag":null,"topics":["bulk-api","bulk-operation","csv","http-server","json","query-server","sql","sql-query","sqlite","sqlite3"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/assafmo.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}},"created_at":"2019-04-07T12:14:59.000Z","updated_at":"2023-12-24T20:31:28.000Z","dependencies_parsed_at":"2022-09-05T13:11:38.490Z","dependency_job_id":null,"html_url":"https://github.com/assafmo/SQLiteQueryServer","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assafmo%2FSQLiteQueryServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assafmo%2FSQLiteQueryServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assafmo%2FSQLiteQueryServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assafmo%2FSQLiteQueryServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/assafmo","download_url":"https://codeload.github.com/assafmo/SQLiteQueryServer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245722813,"owners_count":20661830,"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":["bulk-api","bulk-operation","csv","http-server","json","query-server","sql","sql-query","sqlite","sqlite3"],"created_at":"2024-10-30T04:24:14.967Z","updated_at":"2025-03-26T19:33:58.134Z","avatar_url":"https://github.com/assafmo.png","language":"Go","readme":"# SQLiteQueryServer\n\nBulk query SQLite database over the network.  \nWay faster than [SQLiteProxy](https://github.com/assafmo/SQLiteProxy)!\n\n[![CircleCI](https://circleci.com/gh/assafmo/SQLiteQueryServer.svg?style=shield\u0026circle-token=cda4af2f2b6cc0035287b25086c596d2ef44d9ce)](https://circleci.com/gh/assafmo/SQLiteQueryServer)\n[![Coverage Status](https://coveralls.io/repos/github/assafmo/SQLiteQueryServer/badge.svg?branch=master)](https://coveralls.io/github/assafmo/SQLiteQueryServer?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/assafmo/SQLiteQueryServer)](https://goreportcard.com/report/github.com/assafmo/SQLiteQueryServer)\n\n# Installation\n\n- Download a precompiled binary from https://github.com/assafmo/SQLiteQueryServer/releases\n- Or use `go get`:\n\n  ```bash\n  go get -u github.com/assafmo/SQLiteQueryServer\n  ```\n\n  This package uses `github.com/mattn/go-sqlite3`. Compilation errors might be resolved by reading https://github.com/mattn/go-sqlite3#compilation.\n\n- Or use Ubuntu PPA:\n\n  ```bash\n  curl -SsL https://assafmo.github.io/ppa/ubuntu/KEY.gpg | sudo apt-key add -\n  sudo curl -SsL -o /etc/apt/sources.list.d/assafmo.list https://assafmo.github.io/ppa/ubuntu/assafmo.list\n  sudo apt update\n  sudo apt install sqlitequeryserver\n  ```\n\n# Usage\n\n```\nUsage of SQLiteQueryServer:\n  -db string\n        Filesystem path of the SQLite database\n  -port uint\n        HTTP port to listen on (default 80)\n  -query string\n        SQL query to prepare for\n```\n\nNote: SQLiteQueryServer is optimized for the SELECT command. Other commands such as INSERT, UPDATE, DELETE, CREATE, etc might be slow because SQLiteQueryServer doesn't use transactions (yet). Also, the response format and error messages from these commands may be odd or unexpected.\n\n# Examples\n\n## Creating a server\n\n```bash\nSQLiteQueryServer --db \"$DB_PATH\" --query \"$PARAMETERIZED_SQL_QUERY\" --port \"$PORT\"\n```\n\n```bash\nSQLiteQueryServer --db ./test_db/ip_dns.db --query \"SELECT * FROM ip_dns WHERE dns = ?\" --port 8080\n```\n\nThis will expose the `./test_db/ip_dns.db` database with the query `SELECT * FROM ip_dns WHERE dns = ?` on port `8080`.  \nRequests will need to provide the query parameters.\n\n## Querying the server\n\n```bash\necho -e \"github.com\\none.one.one.one\\ngoogle-public-dns-a.google.com\" | curl \"http://localhost:8080/query\" --data-binary @-\n```\n\n```bash\necho -e \"$QUERY1_PARAM1,$QUERY1_PARAM2\\n$QUERY2_PARAM1,$QUERY2_PARAM2\" | curl \"http://$ADDRESS:$PORT/query\" --data-binary @-\n```\n\n```bash\ncurl \"http://$ADDRESS:$PORT/query\" -d \"$PARAM_1,$PARAM_2,...,$PARAM_N\"\n```\n\n- Request must be a HTTP POST to \"http://$ADDRESS:$PORT/query\".\n- Request body must be a valid CSV.\n- Request body must not have a CSV header.\n- Each request body line is a different query.\n- Each param in a line corresponds to a query param (a question mark in the query string).\n- Static query (without any query params):\n  - The request must be a HTTP GET to \"http://$ADDRESS:$PORT/query\".\n  - The query executes only once.\n\n## Getting a response\n\n```bash\necho -e \"github.com\\none.one.one.one\\ngoogle-public-dns-a.google.com\" | curl \"http://localhost:8080/query\" --data-binary @-\n```\n\n```json\n[\n  {\n    \"in\": [\"github.com\"],\n    \"headers\": [\"ip\", \"dns\"],\n    \"out\": [[\"192.30.253.112\", \"github.com\"], [\"192.30.253.113\", \"github.com\"]]\n  },\n  {\n    \"in\": [\"one.one.one.one\"],\n    \"headers\": [\"ip\", \"dns\"],\n    \"out\": [[\"1.1.1.1\", \"one.one.one.one\"]]\n  },\n  {\n    \"in\": [\"google-public-dns-a.google.com\"],\n    \"headers\": [\"ip\", \"dns\"],\n    \"out\": [[\"8.8.8.8\", \"google-public-dns-a.google.com\"]]\n  }\n]\n```\n\n- If response status is 200 (OK), response is a JSON array (`Content-Type: application/json`).\n- Each element in the array:\n  - Is a result of a query\n  - Has an \"in\" field which is an array of the input params (a request body line).\n  - Has an \"headers\" field which is an array of headers of the SQL query result.\n  - Has an \"out\" field which is an array of arrays of results. Each inner array is a result row.\n- Element #1 is the result of query #1, Element #2 is the result of query #2, and so forth.\n- Static query (without any query params):\n  - The response JSON has only one element.\n\n## Static query\n\n```bash\nSQLiteQueryServer --db ./test_db/ip_dns.db --query \"SELECT * FROM ip_dns\" --port 8080\n```\n\n```bash\ncurl \"http://localhost:8080/query\"\n```\n\n```json\n[\n  {\n    \"in\": [],\n    \"headers\": [\"ip\", \"dns\"],\n    \"out\": [\n      [\"1.1.1.1\", \"one.one.one.one\"],\n      [\"8.8.8.8\", \"google-public-dns-a.google.com\"],\n      [\"192.30.253.112\", \"github.com\"],\n      [\"192.30.253.113\", \"github.com\"]\n    ]\n  }\n]\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassafmo%2Fsqlitequeryserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fassafmo%2Fsqlitequeryserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassafmo%2Fsqlitequeryserver/lists"}