Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

FR: support environment variables in (favourite) queries

オープン
#163 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python, sqlite
領域
cli, database

調査の方向性

まず、litecli のお気に入りクエリの処理と \f コマンドのエントリポイントを見つけます。この issue ではソースファイルやテストは指定されていません。既存の $1/$2 引数がどのように置換されるかを読み、その後、環境変数の展開がお気に入りクエリだけに適用されるのか、すべてのクエリに適用されるのかを明確にします。合意した構文が、例示されたデータベースのバリエーション全体で、既存のクエリパラメーターを壊さずに機能すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

I'd love to see support for using environment variables in favourite queries, or even in all queries.

The use case is that I have several very similar databases where favourite queries all need to take a parameter to indicate what 'variant' of the database I'm currently using, or I have to copy configuration files for each database file and alter one value in each query filter.

Say, the different values are 'foo' and 'bar', and I have to either do:

favquery1 = '''select ...
    from some_table
    where parameter='$1'
    and other_paramater='$2'
'''
favquery2 = '''select ...
    from some_other_table sot inner join a_third_table att on sot.id = att.sot_id
    where sot.parameter='$1'
    and att.column_name ='$2'
'''

and then run \f favquery1 foo 42 and \f favquery2 bar 45, or I copy the configuration file multiple times and hardcode the parameter in each.

If, instead, I could use environment variables (syntax suggestion, feel free to come up with better syntax, this is based on bash):

favquery1 = '''select ...
    from some_table
    where parameter='${PARAMETER}'
    and other_paramater='$1'
'''
favquery2 = '''select ...
    from some_other_table sot inner join a_third_table att on sot.id = att.sot_id
    where sot.parameter='${PARAMETER}'
    and att.column_name ='$1'
'''

and then start each litecli instance with a different environment variable and use the exact same favourites for each database:

$ PARAMETER=foo litecli foo_database.sqlite
foo_database.sqlite> \f favquery1 42

and

$ PARAMETER=bar litecli bar_database.sqlite
bar_database.sqlite> \f favquery1 42
主要言語
Python
スター
3.3k
フォーク
95
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dbcli/litecli のほかの issue

dbcli/litecli の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。