pandoc-run-postgres
Execute SQL queries inside a markdown document
Example
- Write a SQL query in a code block
``` run-postgres
SELECT oid, 'hello ' || rolname || '!' AS greetings from pg_roles
Limit 2;
```
- Call pandoc
export PGHOST=localhost
export PGDATABASE=foo
export PGUSER=bob
export PGPASSWORD=xxxxxxxx
pandoc --filter pandoc-run-postgres hello.md -o result.md
- The output will contain the SQL query inside a SQL codeblock and the result in a table:
```sql
SELECT oid,
'hello ' || rolname || '!' AS greetings
FROM pg_roles
LIMIT 2;
```
oid greetings
------ -----------------------------
33731 hello bob!
33748 hello alice!
Install
pip install pandoc-run-postgres
Configuration
See examples in sample.md.
Similar projects
- pandoc-filter-runsql for MySQL
- Jupyter's ipython-sql
Metadata
Release files for pandoc-run-postgres 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pandoc_run_postgres-0.1.0.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pandoc_run_postgres-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / pandoc_run_postgres-0.1.0.tar.gz
| Download URL | pandoc_run_postgres-0.1.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b99327aaad1e8979c2578d55c0818aed5bb5507d0af6463bbe38c07c195ffe8
|
|
BLAKE2b-256 checksum How to use checksums |
4d45ac1351144468ae136461d2f92603a3d100b6488c24bdfdfa80c25a35ae14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Release files / pandoc_run_postgres-0.1.0-py3-none-any.whl
| Download URL | pandoc_run_postgres-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89e874d913a5777d8576188cfb93386c92dc8f98a56bc1da4ecc5e4c5171daba
|
|
BLAKE2b-256 checksum How to use checksums |
0613b2e0028054c9fd2069a0bc26a1704b5bf9c7de61bb7ac192e8255949bb25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|