Skip to main content

Execute SQL queries inside a markdown document

Project description

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

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.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pandoc_run_postgres-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file pandoc_run_postgres-0.1.0.tar.gz.

File metadata

  • Download URL: pandoc_run_postgres-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for pandoc_run_postgres-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7b99327aaad1e8979c2578d55c0818aed5bb5507d0af6463bbe38c07c195ffe8
MD5 de3a5dc9983a7bc51dabf53db927e426
BLAKE2b-256 4d45ac1351144468ae136461d2f92603a3d100b6488c24bdfdfa80c25a35ae14

See more details on using hashes here.

File details

Details for the file pandoc_run_postgres-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pandoc_run_postgres-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89e874d913a5777d8576188cfb93386c92dc8f98a56bc1da4ecc5e4c5171daba
MD5 ccfc41cbc27b33d916db243fb6c51e1a
BLAKE2b-256 0613b2e0028054c9fd2069a0bc26a1704b5bf9c7de61bb7ac192e8255949bb25

See more details on using hashes here.

Supported by

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