{"id":29613689,"url":"https://github.com/ivanbgd/sqlite-client-rust","last_synced_at":"2026-05-15T22:04:41.318Z","repository":{"id":286921274,"uuid":"962971285","full_name":"ivanbgd/sqlite-client-rust","owner":"ivanbgd","description":"SQLite client","archived":false,"fork":false,"pushed_at":"2025-04-09T01:11:56.000Z","size":87,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-20T22:16:14.670Z","etag":null,"topics":["sqlite","sqlite-client","sqlite-database","sqlite3","sqlite3-database"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/ivanbgd.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":"2025-04-09T00:45:21.000Z","updated_at":"2025-04-09T01:15:19.000Z","dependencies_parsed_at":"2025-04-09T02:23:47.091Z","dependency_job_id":"68bba1f7-8b3e-4e91-b6e0-ac1e0b0d2f01","html_url":"https://github.com/ivanbgd/sqlite-client-rust","commit_stats":null,"previous_names":["ivanbgd/sqlite-client-rust"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ivanbgd/sqlite-client-rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanbgd%2Fsqlite-client-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanbgd%2Fsqlite-client-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanbgd%2Fsqlite-client-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanbgd%2Fsqlite-client-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanbgd","download_url":"https://codeload.github.com/ivanbgd/sqlite-client-rust/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanbgd%2Fsqlite-client-rust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000678,"owners_count":26082837,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["sqlite","sqlite-client","sqlite-database","sqlite3","sqlite3-database"],"created_at":"2025-07-20T22:10:15.079Z","updated_at":"2025-10-08T22:00:04.770Z","avatar_url":"https://github.com/ivanbgd.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQLite Client\n\n# Sample Databases\n\nTo make it easy to test queries locally, we've added a sample database in the\nroot of this repository: `sample.db`.\n\nThis contains two tables: `apples` \u0026 `oranges`. You can use this to test your\nimplementation for the first 6 stages.\n\nYou can explore this database by running queries against it like this:\n\n```sh\n$ sqlite3 sample.db \"select id, name from apples\"\n1|Granny Smith\n2|Fuji\n3|Honeycrisp\n4|Golden Delicious\n```\n\nThere are two other databases that you can use:\n\n1. `superheroes.db`:\n    - This is a small version of the test database used in the table-scan stage.\n    - It contains one table: `superheroes`.\n    - It is ~1MB in size.\n2. `companies.db`:\n    - This is a small version of the test database used in the index-scan stage.\n    - It contains one table: `companies`, and one index: `idx_companies_country`\n    - It is ~7MB in size.\n\nThese aren't included in the repository because they're large in size. You can\ndownload them by running this script:\n\n```sh\n./download_sample_databases.sh\n```\n\nIf the script doesn't work for some reason, you can download the databases\ndirectly from [here](https://github.com/codecrafters-io/sample-sqlite-databases).\n\n# Running the Program\n\nThe program works from the command line, and supports the so-called dot-commands (CLI commands) as well as\nSQL commands.\n\nSupported SQL commands can be supplied in lower, upper or mixed-case, i.e., they are case-insensitive.  \nThe same is true of the supplied table and column names.\n\nValues in the `WHERE` clause are case-sensitive.\n\nSupported dot-commands are also case-insensitive.\n\n## CLI Commands (dot-commands)\n\n- To emulate `$ sqlite3 sample.db .dbinfo`:\n\n```shell\n$ ./run.sh sample.db .dbinfo\ndatabase page size: 4096\nnumber of pages: 4\nnumber of tables: 3\ntext encoding: utf-8\n```\n\n- To emulate `$ sqlite3 sample.db .tables`:\n\n```shell\n$ ./run.sh sample.db .tables\napples oranges\n```\n\n- To emulate `$ sqlite3 companies.db .index` or `$ sqlite3 companies.db .indexes`:\n\n```shell\n$ ./run.sh companies.db .index\n$ ./run.sh companies.db .indexes\nidx_companies_country\n```\n\n## SQL Commands\n\n### Count number of rows in a table\n\n```shell\n$ ./run.sh sample.db \"SELECT COUNT(*) FROM apples\"\n4\n```\n\n### Select from a single column\n\n```shell\n$ ./run.sh sample.db \"SELECT name FROM apples\"\nGranny Smith\nFuji\nHoneycrisp\nGolden Delicious\n```\n\nAdditionally, `LIMIT` is supported.\n\n```shell\n$ ./run.sh sample.db \"SELECT name FROM apples LIMIT 3\"\nGranny Smith\nFuji\nHoneycrisp\n```\n\n### Select from multiple columns\n\n```shell\n$ ./run.sh sample.db \"SELECT name, color FROM apples\"\nGranny Smith|Light Green\nFuji|Red\nHoneycrisp|Blush Red\nGolden Delicious|Yellow\n```\n\n```shell\n$ ./run.sh sample.db \"SELECT * FROM apples\"\n1|Granny Smith|Light Green\n2|Fuji|Red\n3|Honeycrisp|Blush Red\n4|Golden Delicious|Yellow\n```\n\nAdditionally, `LIMIT` is supported.\n\n```shell\n$ ./run.sh sample.db \"SELECT id, name, color FROM apples LIMIT 10\"\n1|Granny Smith|Light Green\n2|Fuji|Red\n3|Honeycrisp|Blush Red\n4|Golden Delicious|Yellow\n```\n\n### Select Using Where\n\n```shell\n$ ./run.sh sample.db \"SELECT id, name, color FROM apples WHERE color = 'Blush Red'\"\n3|Honeycrisp|Blush Red\n```\n\nAdditionally, `LIMIT` is supported.\n\n```shell\n$ ./run.sh sample.db \"SELECT id, name, color FROM apples WHERE color = 'Blush Red' LIMIT 1\"\n3|Honeycrisp|Blush Red\n```\n\n### Large Databases and Tables\n\nLarge tables, spanning multiple pages, are supported.\n\n```shell\n$ ./run.sh superheroes.db \"SELECT id, name FROM superheroes WHERE eye_color = 'Pink Eyes'\"\n297|Stealth (New Earth)\n790|Tobias Whale (New Earth)\n1085|Felicity (New Earth)\n2729|Thrust (New Earth)\n3289|Angora Lapin (New Earth)\n3913|Matris Ater Clementia (New Earth)\n```\n\n### Indexes\n\nIndexes are also supported.\n\nRather than reading all rows in a table and then filtering in-memory,\nwe use an index to perform a more intelligent search.\n\nTo test whether our implementation actually uses an index, their tester uses a database that is ~1GB in size\nand expects our program to return query results in less than 3 seconds.\n\nThe test database contains a `companies` table with an index named `idx_companies_country` on the `country` column.\n\nWe can download a small version of the `companies` database to test locally.\n\n```shell\n$ ./run.sh companies.db \"SELECT id, name FROM companies WHERE country = 'eritrea'\"\n121311|unilink s.c.\n2102438|orange asmara it solutions\n5729848|zara mining share company\n6634629|asmara rental\n```\n\nWe can assume that all queries run by the tester will include `country` in the `WHERE` clause,\nso they can be served by the index.\nThe tester will run multiple randomized queries and expect all of them to return results in under 3 seconds.\n\nSince the table `superheroes` is smaller than `companies`, we can add an index to it and also work with it.\n\n```shell\n$ sqlite3 superheroes.db \"CREATE INDEX idx_superheroes_eye_color on superheroes (eye_color)\"\n\n$ ./run.sh superheroes.db \"SELECT id, name FROM superheroes LIMIT 10\"\n$ ./run.sh superheroes.db \"SELECT id, name FROM superheroes WHERE eye_color = 'Pink Eyes' LIMIT 3\"\n```\n\n# Additional Notes\n\n## The Companies Database\n\nThe local (smaller) version of the `Companies` database can be used for testing of use of index that exists\non the `Country` column of the `Companies` table.\n\nThe file \"test_dbs/countries_by_count_desc.txt\" contains all countries and their counts sorted by count\nin descending order. It was obtained with:\n\n```shell\n$ sqlite3 test_dbs/companies.db \"SELECT country, COUNT(*) FROM companies GROUP BY country ORDER BY COUNT(*) DESC\" \u003e test_dbs/countries_by_count_desc.txt\n```\n\nThe file \"test_dbs/countries_by_country.txt\" contains all countries and their counts sorted by country name.\nIt was obtained with:\n\n```shell\n$ sqlite3 test_dbs/companies.db \"SELECT country, COUNT(*) FROM companies GROUP BY country ORDER BY country\" \u003e test_dbs/countries_by_country.txt\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanbgd%2Fsqlite-client-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanbgd%2Fsqlite-client-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanbgd%2Fsqlite-client-rust/lists"}