Skip to main content

No project description provided

Project description

Beancount INquiry

A CLI tool to INject parameters into Beancount queries specified in your ledger

Usage

Beancount INquiry will inject parameters into query directives specified in your ledger file using pythons .format function, and so uses the same syntax. Here is an example query directive with two parameters:

2025-01-01 query "balance" "SELECT date, account, sum(number) as total WHERE account ~ '{}' AND date >= {} ORDER BY account"

And then pass in the ledger, the name of the query, and the list of parameters

bean-inquiry ledger.beancount balance Assets 2014-05-01

You can also use indexed placeholders:

2025-01-01 query "balance" "SELECT date, {0}, sum(number) as total WHERE {0} ~ '{1}' AND date >= {2} ORDER BY {0}"
...
bean-inquiry ledger.beancount balance account Assets:Bank 2025-05-01

And named placeholders, with parameter keys separated with a colon:

2025-01-01 query "balance" "SELECT date, {select}, sum(number) as total WHERE {select} ~ '{account}' AND date >= {date} ORDER BY {select}"
...
bean-inquiry ledger.beancount balance select:account account:Assets:Bank date:2025-05-01

See the --help for more options

bean-inquiry --help

Options

Usage: bean-inquiry [OPTIONS] LEDGER [NAME] [PARAMS]...

Beancount INquiry - A CLI tool to inject parameters INto Beancount queries located in your ledger.

╭─ Arguments ─────────────────────────────────────────────────────────────────╮ │ * ledger FILE The Beancount ledger file to parse [required] │ │ name [NAME] The name of the query to parse │ │ params [PARAMS]... List of parameters to parse │ ╰─────────────────────────────────────────────────────────────────────────────╯ ╭─ Options ───────────────────────────────────────────────────────────────────╮ │ --format -f [text|csv] Output format: 'text' or 'csv' │ │ [default: text] │ │ --check -c Check a query for what parameters │ │ are needed │ │ --list -l List all queries available in │ │ ledger │ │ --install-completion Install completion for the │ │ current shell. │ │ --show-completion Show completion for the current │ │ shell, to copy it or customize │ │ the installation. │ │ --help Show this message and exit. │ ╰─────────────────────────────────────────────────────────────────────────────╯

Installation

Pipx (recommended)

Install using pipx from PyPi

pipx install beancount-inquiry
bean-inquiry --help

Build from source using pipx

Clone this repository and install systemwide using pipx:

git clone https://github.com/aleyoscar/beancount-inquiry.git
cd beancount-inquiry
pipx install .
bean-inquiry --help

Run using poetry

Clone this repository and run using poetry

git clone https://github.com/aleyoscar/beancount-inquiry.git
cd beancount-inquiry
poetry install
poetry run bean-inquiry

Dependencies

This project uses typer for the CLI and beanquery for running the queries

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

bean_inquiry-0.2.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

bean_inquiry-0.2.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file bean_inquiry-0.2.0.tar.gz.

File metadata

  • Download URL: bean_inquiry-0.2.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.11.9 Windows/10

File hashes

Hashes for bean_inquiry-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9a319a7d13f421895c5eb0d3f11f81cc9f8f1dc0c669588ca801862e9b7d6088
MD5 15dad6746165d73525584c8a9da6e855
BLAKE2b-256 d5a0b76e4afb69ec2448d404c3fce2b45955afdc95cc45b3e98dd52ba9810820

See more details on using hashes here.

File details

Details for the file bean_inquiry-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: bean_inquiry-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.11.9 Windows/10

File hashes

Hashes for bean_inquiry-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5749b3c212bf8470e1f9a0120347414f136c9706f99b62e036b38f8cec22896
MD5 7dabc61a12a0b7bf097c47152894128c
BLAKE2b-256 bc3646eacd87b1cd2dd4c69df522ef95527562384738de4edb8d5a82e0fa1a13

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