{"id":16722670,"url":"https://github.com/ahojukka5/enkeksi","last_synced_at":"2026-05-18T08:33:59.793Z","repository":{"id":57426475,"uuid":"265494354","full_name":"ahojukka5/enkeksi","owner":"ahojukka5","description":"enkeksi takes a markdown-formatted input and executes the sql queries found in it, and returns a markdown-formatted output where the results of the sql queries have been added.","archived":false,"fork":false,"pushed_at":"2020-05-27T18:18:24.000Z","size":52,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T09:25:20.166Z","etag":null,"topics":["evaluator","markdown","process","sql","text"],"latest_commit_sha":null,"homepage":"https://enkeksi.readthedocs.io/","language":"Python","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/ahojukka5.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":"2020-05-20T08:03:52.000Z","updated_at":"2020-05-27T18:18:27.000Z","dependencies_parsed_at":"2022-09-19T06:00:21.384Z","dependency_job_id":null,"html_url":"https://github.com/ahojukka5/enkeksi","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahojukka5%2Fenkeksi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahojukka5%2Fenkeksi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahojukka5%2Fenkeksi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahojukka5%2Fenkeksi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahojukka5","download_url":"https://codeload.github.com/ahojukka5/enkeksi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243733969,"owners_count":20339212,"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":["evaluator","markdown","process","sql","text"],"created_at":"2024-10-12T22:35:22.942Z","updated_at":"2026-05-18T08:33:54.759Z","avatar_url":"https://github.com/ahojukka5.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# enkeksi - Markdown-SQL evaluator\n\n[![Python CI][ci-img]][ci-url]\n[![Coverate Status][coveralls-img]][coveralls-url]\n[![Documentation Status][documentation-img]][documentation-url]\n\nPackage author: Jukka Aho (@ahojukka5, ahojukka5@gmail.com)\n\nenkeksi takes a markdown-formatted input and executes the sql queries found in\nit, and returns a markdown-formatted output where the results of the sql queries\nhave been added. Package can be used, for example, to create a dynamic project\ndocumentation where SQL queries are automatically executed to get example\nresults in a dynamic manner. This way it is easy to spot from the non-working\ndocumentation is there is problems with the database.\n\nenkeksi comes with a command line tool `markdown-sql-eval` which can be used\nto process markdown files efficiently.\n\nProject is hosted in GitHub: \u003chttps://github.com/ahojukka5/enkeksi\u003e.\n\nDocumentation is hosted in ReadTheDocs: \u003chttps://enkeksi.readthedocs.io/\u003e.\n\nReleases are hosted in PyPi: \u003chttps://pypi.org/project/enkeksi/\u003e.\n\n## Installing package\n\nTo install the most recent package from Python Package Index (PyPi), use git:\n\n```bash\npip install enkeksi\n```\n\nTo install the development version, you can install the package directly from\nthe GitHub:\n\n```bash\npip install git+git://github.com/ahojukka5/enkeksi.git\n```\n\n## CLI Usage\n\nConsider the following demo markdown file:\n\n````markdown\n# Sample file\n\nHello, this is a sample file. Below, we initialize some test data to sqlite\ndatabase. It doesn't show in the final output, because of `--hide-input` flag.\n\n```sql\n--hide-input\nCREATE TABLE Movies (id INTEGER PRIMARY KEY, name TEXT, year INTEGER);\nINSERT INTO Movies (name, year) VALUES (\"Snow White\", 1937);\nINSERT INTO Movies (name, year) VALUES (\"Fantasia\", 1940);\n```\n\nTo list the content of the database, we need to use `SELECT` in SQL query. We\ncan use extra option `--caption='Table: Movies'` to add caption to output:\n\n```sql\n--hide-input --caption='Table: Movies'\nSELECT * FROM Movies;\n```\n\nSQL results are formatted using [tabulate](https://pypi.org/project/tabulate/).\nUsing option `--table-format` we can change how the end results looks like.\nBy default, `psgl` is used and there rest options can be found from tabulate's\ndocumentation. The total number of rows in database is:\n\n```sql\n--caption='With psql formatting'\nSELECT COUNT(*) AS 'Number of movies in database' FROM Movies;\n```\n\nOption `--hide-headers` can be used to hide the header row of the result.\n\n```sql\n--table-format='github' --hide-headers --caption='With github formatting and headers removed'\nSELECT COUNT(*) AS 'Now shown' FROM Movies;\n```\n````\n\nProcessing the file with `markdown-sql-eval`:\n\n```bash\nmarkdown-sql-eval examples/example2.md \u003e examples/example2_rendered.md\n```\n\nResult is:\n\n````markdown\n# Sample file\n\nHello, this is a sample file. Below, we initialize some test data to sqlite\ndatabase. It doesn't show in the final output, because of `--hide-input` flag.\n\nTo list the content of the database, we need to use `SELECT` in SQL query. We\ncan use extra option `--caption='Table: Movies'` to add caption to output:\n\n```text\nTable: Movies\n\n+------+------------+--------+\n|   id | name       |   year |\n|------+------------+--------|\n|    1 | Snow White |   1937 |\n|    2 | Fantasia   |   1940 |\n+------+------------+--------+\n```\n\nSQL results are formatted using [tabulate](https://pypi.org/project/tabulate/).\nUsing option `--table-format` we can change how the end results looks like.\nBy default, `psgl` is used and there rest options can be found from tabulate's\ndocumentation. The total number of rows in database is:\n\n```sql\nSELECT COUNT(*) AS 'Number of movies in database' FROM Movies;\n```\n\n```text\nWith psql formatting\n\n+--------------------------------+\n|   Number of movies in database |\n|--------------------------------|\n|                              2 |\n+--------------------------------+\n```\n\nOption `--hide-headers` can be used to hide the header row of the result.\n\n```sql\nSELECT COUNT(*) AS 'Now shown' FROM Movies;\n```\n\n```text\nWith github formatting and headers removed\n\n|---|\n| 2 |\n```\n````\n\nThe generated markdown file can then be added to your project documentation\nand hosted using e.g. mkdocs. For that idea, take a look of `docs/demo.md`,\nwhich is hosted in [here](https://enkeksi.readthedocs.io/en/latest/demo/),\nand generated from `docs/demo_tmpl.md`.\n\n## Contributing\n\nContributions are welcome as usual. If you have any good idea, and especially,\na better name for a package, raise an issue.\n\n[ci-img]: https://github.com/ahojukka5/enkeksi/workflows/Python%20CI/badge.svg\n[ci-url]: https://github.com/ahojukka5/enkeksi/actions\n[coveralls-img]: https://coveralls.io/repos/github/ahojukka5/enkeksi/badge.svg?branch=master\n[coveralls-url]: https://coveralls.io/github/ahojukka5/enkeksi?branch=master\n[documentation-img]: https://readthedocs.org/projects/enkeksi/badge/?version=latest\n[documentation-url]: https://enkeksi.readthedocs.io/en/latest/?badge=latest\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahojukka5%2Fenkeksi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahojukka5%2Fenkeksi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahojukka5%2Fenkeksi/lists"}