Tech Stack
We decided to build DBGrep using Python, as it's a language we were familiar with and it has a rich ecosystem of libraries and tools that can help us achieve our goals.
CLI Tech
We're using a library called typer to handle the command-line interface (CLI) for DBGrep. Typer is a great choice because it allows us to create user-friendly command-line applications with minimal code. It also provides features like automatic help generation and type checking, which can save us a lot of time and effort. As it's based on Click, we can also use all the features of Click, which is a powerful library for building command-line interfaces in Python.
Output Format
DBGrep's output is formatted using rich, a library that makes it easy to create beautiful and informative terminal output. Rich provides features like syntax highlighting, tables, and progress bars, which can help us present our data in a clear and visually appealing way.
ORM
For the ORM (Object-Relational Mapping) layer, we're using SQLAlchemy. SQLAlchemy is a powerful and flexible ORM that allows us to interact with databases in a Pythonic way. It provides a high-level API for working with databases, making it easy to perform common tasks like querying, inserting, and updating data. SQLAlchemy also supports a wide range of databases, so we can easily switch between different database backends if needed. We specifically chose not to include any database-specific code in the ORM layer, as we want to keep our codebase flexible and adaptable to different database backends.