{"id":17694982,"url":"https://github.com/asg017/sqlite-docs","last_synced_at":"2025-05-13T01:28:47.891Z","repository":{"id":177938209,"uuid":"659472787","full_name":"asg017/sqlite-docs","owner":"asg017","description":"Document your SQLite tables and columns with in-line comments","archived":false,"fork":false,"pushed_at":"2023-07-01T21:00:58.000Z","size":19,"stargazers_count":24,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-01T05:41:19.201Z","etag":null,"topics":["sqlite","sqlite-extension"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/asg017.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}},"created_at":"2023-06-27T23:14:17.000Z","updated_at":"2025-02-28T20:02:46.000Z","dependencies_parsed_at":"2024-01-31T15:30:20.880Z","dependency_job_id":null,"html_url":"https://github.com/asg017/sqlite-docs","commit_stats":null,"previous_names":["asg017/sqlite-docs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asg017%2Fsqlite-docs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asg017%2Fsqlite-docs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asg017%2Fsqlite-docs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asg017%2Fsqlite-docs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asg017","download_url":"https://codeload.github.com/asg017/sqlite-docs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253853112,"owners_count":21974061,"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":["sqlite","sqlite-extension"],"created_at":"2024-10-24T13:50:42.820Z","updated_at":"2025-05-13T01:28:47.865Z","avatar_url":"https://github.com/asg017.png","language":"Rust","readme":"# `sqlite-docs`\n\nA SQLite extension, CLI, and library for documentating SQLite tables, columns, and extensions.\n\n**Warning**\n\n\u003e `sqlite-docs` is still young and not fully developed. Watch this repo or [subscribe to my newsletter](https://buttondown.email/alexgarcia) for updates. Also consider [sponsoring my work](https://github.com/sponsors/asg017) if you want this project to release earlier!\n\n`sqlite-docs` work with \"SQLite doc comments\" inside `CREATE TABLE` statements, similar to [Rust doc comments](https://doc.rust-lang.org/reference/comments.html#doc-comments), [Go Doc Comments](https://tip.golang.org/doc/comment), and [JSDoc](https://jsdoc.app/).\n\nSingle-line comments that start with an exclamation point (`--!`) are comments and descriptions for the entire table. Single line comments that start with a dash (`---`) are comments and description for the following column.\n\n```sql\ncreate table students(\n  --! All students that attend Foo University. One row per enrolled\n  --! student, active and historial.\n\n  --- ID assigned to the student at orientation.\n  --- @details https://foo.edu/students/id-format.html\n  --- @example 'S10483'\n  student_id text primary key,\n\n  --- Full name of the student, includes first and last name.\n  --- @example 'Alex Garcia'\n  name text,\n\n  --- Birthday of the student, in YYYY-MM-DD format.\n  --- @example '1970-01-01'\n  birthdate date,\n\n  --- Number of course units the student has completed, since\n  -- the last completed academic quarter.\n  -- @example 62.5\n  completed_units float\n);\n```\n\nOnce the tables in your database are documented, you can use the `sqlite-docs` CLI to generate documentation in different formats. Here's an example of generating a markdown data dictionary file:\n\n```bash\nsqlite-docs generate-markdown my.db -o README.md\n```\n\nOr a [Datasette `metadata.json`](https://docs.datasette.io/en/stable/metadata.html):\n\n```bash\nsqlite-docs generate-datasette my.db -o metadata.json\ndatasette my.db --metadata metadata.json\n```\n\nYou'll then find the table and column descriptions in a few places in Datasette's UI.\n\n|                                                                                                                                  |                                                                                                                                  |\n| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |\n| \u003cimg width=\"400px\" src=\"https://user-images.githubusercontent.com/15178711/249305336-17879f9b-70a3-4654-807b-01933fec0495.png\"/\u003e | \u003cimg width=\"400px\" src=\"https://user-images.githubusercontent.com/15178711/249305380-38875373-135d-4253-885e-3f53485adfe9.png\"/\u003e |\n\n## Specification\n\nSQLite doc comments support a few \"tags\", as denoted by the `@` sign at the beginning of the comment. These include:\n\n| Tag        | Supported for   | Description                                                                                                                       |\n| ---------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |\n| `@example` | Columns         | A SQLite literal of an example non-null value the column can contain.                                                             |\n| `@value`   | Columns         | A possible non-null value that a column could be. Meant to exhaustively list all enum options a column has                        |\n| `@details` | Columns, Tables | A link or instructions to find more information about the format/contents of a column, such as ID formats, datetime formats, etc. |\n| `@source`  | Tables          | A link or instructions to the raw source of the data backing at able.                                                             |\n| `@schema`  | Columns         |                                                                                                                                   |\n\n## Limitations\n\n### No `ALTER TABLE` support\n\nSQLite will by persist comments in `CREATE TABLE` statements, in the `sqlite_master` table.\n\nHowever, some `ALTER TABLE` statements will erase or modify these comments, such as with `ALTER TABLE x ADD COLUMN`, `ALTER TABLE x REMOVE COLUMN`, and more.\n\nIf you think your table will need `ALTER TABLE` statements in the future, then know that `sqlite-docs` comments may break. You can always create a new table with your new schema, import data from the old table to the new one, then delete the old table.\n\n### `sqlite-docs` tools use a weak parser\n\n`sqlite-docs` uses heuristics and simple line-by-line analysis to extract doc comments. It does not fully parse `CREATE TABLE` statements or use an AST. This means that certain valid SQL will not work with `sqlite-docs` including:\n\n- Column names with spaces or newline characters\n- Column definitions that span multiple lines\n- Multi-line comments `/* ... */`\n- `FOREIGN KEY` and other constraints\n\nIn the far future `sqlite-docs` will be able to handle all of these cases. If you'd like to see this happen sooner, consider [sponsoring my work](https://github.com/sponsors/asg017).\n\n### `sqlite-docs` is early in development\n\nIt'll get better and easier to use! `sqlite-docs` will most likely be distributed as:\n\n- A CLI for major platforms (MacOS, Linux, Windows etc.)\n- A SQLite extension in the [`sqlite-ecosystem`](https://github.com/asg017/sqlite-ecosystem)\n- A Datasette plugin\n- A high-level Python library for parsing indivudal statements\n- A low-level Rust library for parsing individual statements\n","funding_links":["https://github.com/sponsors/asg017"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasg017%2Fsqlite-docs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasg017%2Fsqlite-docs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasg017%2Fsqlite-docs/lists"}