Execute SQL queries inside a markdown document
Project description
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
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
Built Distribution
Close
Hashes for pandoc-run-postgres-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7549f1b760cfc229d0e4d7b9583bc0f583e49f237b0ace149df404114aaa84a2 |
|
MD5 | dabb2b53ab91b76741cede17d530f96e |
|
BLAKE2b-256 | 9ee1e6aa4e8eaa5581b9e192185a0f4aff95f39e4357ba9b646b4fe12f7ce282 |
Close
Hashes for pandoc_run_postgres-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75273be2bdb379aba3835162f1fafcfc6068f429f16335e776d338c6d0cf6802 |
|
MD5 | 052d8d89b2eaf29c45e81fd703cb478a |
|
BLAKE2b-256 | e4e901138d2680ad926b3d9b988ef22e852e1a281129f7a25022b1cef79181a8 |