FR: support environment variables in (favourite) queries
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 30/100
Direzione di ricerca
Inizia individuando la gestione delle query preferite di litecli e il punto di ingresso per i comandi \f; l’issue non indica alcun file sorgente o test. Leggi come vengono sostituiti gli argomenti $1/$2 esistenti, poi chiarisci se l’espansione dell’ambiente si applica solo alle query preferite o a tutte le query. Il lavoro è completo quando la sintassi concordata funziona con le varianti di database illustrate senza rompere i parametri di query esistenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 3.3k
- Fork
- 95
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di dbcli/litecli
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 66/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
Tutte le issue di dbcli/litecli
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
stephrobert/dsoxlab#238 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
sublimehq/package_control#1780 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
nwg-piotr/nwg-displays#145 ·