Extending UNIX grep to databases
-
Database queries are more complex than matching text.
-
Support for Nosql databases, e.g. Mongodb.
-
Customer demands:
-
Restrict input record sets.
-
Filter / page output.
-
-
Connection profile handling
-
Search level specification:
-
Whole database
-
Table(s)
-
Table column(s)
-
Recordsets
-
-
Output formatting, limiting/filtering and paging
| Command | File ~/.dbgrep/Profiles/postgresTest.cfg |
|---|---|
dbgrep --profile postgresTest ... |
|
dbgrep ... --equal 237 ❶ dbgrep ... --greater 4.43 ❷ dbgrep ... --like 'Smit%' ❸ dbgrep ... --like 'Smit%' --and --greater 4 ❹ dbgrep ... --range [-3:17] ❺
|
Search for integer values equal to 237. Return either of:
|
|
|
Search for numeric values being greater than 4.43. |
|
|
Texts starting with |
|
|
Conjunction: Records containing text starting with
|
|
|
Search for integer values between and including -3 and 17. |
A tool might be implemented either as a single command or as a terminal based application keeping state information.
