reconciler: Format BQL query
This commit is contained in:
parent
e764f3d0ef
commit
07d7737bd0
1 changed files with 13 additions and 1 deletions
|
@ -691,7 +691,19 @@ def main(arglist: Optional[Sequence[str]] = None,
|
||||||
entries, _, options = loader.load_file(args.beancount_file)
|
entries, _, options = loader.load_file(args.beancount_file)
|
||||||
# String concatenation looks bad, but there's no SQL injection possible here
|
# String concatenation looks bad, but there's no SQL injection possible here
|
||||||
# because BQL can't write back to the Beancount files. I hope!
|
# because BQL can't write back to the Beancount files. I hope!
|
||||||
query = f'SELECT filename, META("lineno") AS line, META("bank-statement") AS bank_statement, date, number(cost(position)), payee, ENTRY_META("entity") as entity, ANY_META("check-id") as check_id, narration where account = "{args.account}" and date >= {begin_date} and date <= {end_date}'
|
query = f"""
|
||||||
|
SELECT filename,
|
||||||
|
META("lineno") AS line,
|
||||||
|
META("bank-statement") AS bank_statement,
|
||||||
|
date,
|
||||||
|
number(cost(position)),
|
||||||
|
payee,
|
||||||
|
ENTRY_META("entity") as entity,
|
||||||
|
ANY_META("check-id") as check_id,
|
||||||
|
narration
|
||||||
|
WHERE account = "{args.account}"
|
||||||
|
AND date >= {begin_date}
|
||||||
|
AND date <= {end_date}"""
|
||||||
_, result_rows = run_query(entries, options, query)
|
_, result_rows = run_query(entries, options, query)
|
||||||
books_trans = sort_records([standardize_beancount_record(row) for row in result_rows])
|
books_trans = sort_records([standardize_beancount_record(row) for row in result_rows])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue