dev_helpers
is a Python package designed to simplify the development process by providing a collection of essential development tools, all conveniently stored in one place. The package aims to enhance the developer experience, making it easier to perform common tasks. Key components of this package include the DatabaseHandler, for managing database connections and operations,.
If the package is published, do a normal pip installation (as shown below)
pip install dev_helper
Till it is released and published in PIPY, the installation steps are the following:
- Clone the project:
git clone https://github.com/ElCaptaine/dev_helper.git
- Go into the directory:
cd path/to/folder/of/dev_helper
- Either do in the root dir of the project:
pip install -e .
python setup.py install
That's it. If you want to also contribute please also install the test requirements
(pip install -e .[tests]
)
The DatabaseHandler
is a crucial component of dev_helper
, designed to streamline database-related tasks.
It simplifies database connections, session management, and query execution.
For detailed information on how to use the DatabaseHandler
,
refer to the documentation.
from dev_helper import DatabaseHandler
# Example usage
db_handler = DatabaseHandler(config_file=".db.conf", section="test_database")
with db_handler as session:
results = session.execute_query("SELECT * FROM your_table")
print(results)
If you want to test locally, please make sure that Docker is installed, and ensure that the .db.conf file has an entry like test_helper_database.
Also, make sure that the PostgreSQL container is set up and running. For example:
docker run --name postgres-container \
-e POSTGRES_USER=test_user \
-e POSTGRES_PASSWORD=test_password \
-p 5432:5432 \
-d postgres:latest
This guide introduces the Database Visualizer script, which provides a graphical representation of relationships between tables in a database.
The Database Visualizer script:
- Connects to the specified database.
- Retrieves information about table relationships.
- Generates a graph that visually represents these relationships.
- Allows customization of graph layout and saving the graph image.
To use the Database Visualizer:
- Run the script with Python.
- Specify the database to visualize using the
--db_spec
option. - Optionally, provide additional arguments like
--path
,--layout
, and--show
for customization.
python database_visualizer.py --db_spec my_database --path /path/to/save/graph --layout shell_layout --show
This command visualizes the relationships in the my_database
database, saves the graph image to the specified path, uses the shell_layout
for graph layout, and displays the graph plot.
Ensure you have the necessary dependencies installed, and provide the appropriate database specification.
For detailed information and advanced usage, refer to the documentation.
If you would like to contribute to dev_helpers
or report issues, please check the contribution guidelines.
This project is licensed under the MIT License — see the LICENSE file for details.
- The
dev_helpers
package is built upon the collaborative efforts of the developer community. - Special thanks to the contributors for their valuable input.
Happy coding with dev_helpers
! 🚀