Skip to main content

pandoc-run-postgres

Execute SQL queries inside a markdown document

Example

  1. Write a SQL query in a code block
    ``` run-postgres
    SELECT oid, 'hello ' || rolname || '!' AS greetings from pg_roles
      Limit 2;
    ```
  1. Call pandoc
export PGHOST=localhost
export PGDATABASE=foo
export PGUSER=bob
export PGPASSWORD=xxxxxxxx
pandoc --filter pandoc-run-postgres hello.md -o result.md
  1. 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

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)

Source distribution for pandoc-run-postgres 0.1.0
File Size Uploaded
pandoc_run_postgres-0.1.0.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pandoc-run-postgres 0.1.0
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page