Skip to main content

Execute SQL queries inside a markdown document

Project description


Execute SQL queries inside a markdown document


  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 -o
  1. The output will contain the SQL query inside a SQL codeblock and the result in a table:
  SELECT oid,
         'hello ' || rolname || '!' AS greetings
  FROM pg_roles
  LIMIT 2;


    oid    greetings
    ------ -----------------------------
    33731  hello bob!
    33748  hello alice!


pip install pandoc-run-postgres


See examples in

Similar projects

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

pandoc-run-postgres-0.0.4.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

pandoc_run_postgres-0.0.4-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

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