Skip to main content

enkeksi takes a markdown-formatted input and executes the sql queries found in it, and returns a pretty markdown-formatted output where the results of the SQL queries have been added. To make usage of package easy, enkeksi comes with a command line tool markdown-sql-eval which can be used to process markdown files. Project is developed and hosted in GitHub: https://github.com/ahojukka5/enkeksi.

Project description

enkeksi - Markdown-SQL evaluator

Python CI Coverate Status

Package author: Jukka Aho (@ahojukka5, ahojukka5@gmail.com)

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. Package can be used, for example, to create a dynamic project documentation where SQL queries are automatically executed to get example results in a dynamic manner. This way it is easy to spot from the non-working documentation is there is problems with the database.

enkeksi comes with a command line tool markdown-sql-eval which can be used to process markdown files efficiently.

Project is hosted in GitHub: https://github.com/ahojukka5/enkeksi.

Installing package

To install the most recent package from Python Package Index (PyPi), use git:

pip install enkeksi

To install the development version, you can install the package directly from the GitHub:

pip install git+git://github.com/ahojukka5/enkeksi.git

CLI Usage

Consider the following demo markdown file:

# Sample file

Hello, this is a sample file. Below, we initialize some test data to sqlite
database. It doesn't show in the final output, because of `hide_input` flag.

```sql hide_input
CREATE TABLE Movies (id INTEGER PRIMARY KEY, name TEXT, year INTEGER);
INSERT INTO Movies (name, year) VALUES ("Snow White", 1937);
INSERT INTO Movies (name, year) VALUES ("Fantasia", 1940);
```

To list the content of the database, we need to use `SELECT` in SQL query:

```sql
SELECT * FROM Movies;
```

The total number of rows in database is:

```sql
SELECT COUNT(*) AS 'Number of movies in database' FROM Movies;
```

Processing the file with markdown-sql-eval:

markdown-sql-eval examples/example2.md

Result is:

# Sample file

Hello, this is a sample file. Below, we initialize some test data to sqlite
database. It doesn't show in the final output, because of `hide_input` flag.

To list the content of the database, we need to use `SELECT` in SQL query:

```sql
SELECT * FROM Movies;
```

```text
+------+------------+--------+
|   id | name       |   year |
|------+------------+--------|
|    1 | Snow White |   1937 |
|    2 | Fantasia   |   1940 |
+------+------------+--------+
```

The total number of rows in database is:

```sql
SELECT COUNT(*) AS 'Number of movies in database' FROM Movies;
```

```text
+--------------------------------+
|   Number of movies in database |
|--------------------------------|
|                              2 |
+--------------------------------+
```

The generated markdown file can then be added to your project documentation and hosted using e.g. mkdocs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

enkeksi-0.1.3.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

enkeksi-0.1.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file enkeksi-0.1.3.tar.gz.

File metadata

  • Download URL: enkeksi-0.1.3.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for enkeksi-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a85083b2f3346ee2bee194cb3d5f32d9d0b0dc74be114e8bbe206150b30a4de5
MD5 9db8f76fa0210a75996e02a73d7b8e9c
BLAKE2b-256 d70f4baa745212cd6eb0455237d5c7b80c44372441a622a6252f8795a1fbd151

See more details on using hashes here.

File details

Details for the file enkeksi-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: enkeksi-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for enkeksi-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2ddd3723b6bdbe253f019b21421a8061c0409f1782a30571a54f758e9324a5a6
MD5 00eefda9e48833c7ad2c975a1bb93884
BLAKE2b-256 51c15bc1521252ef9dab48f3fd16323ee428c88325384a7357bd17e4babe44dc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page