To get started with the Examples and code examples, follow these steps:
-
Clone the repository:
git clone -
Install Poetry:
curl -sSL https://install.python-poetry.org | python3 – -
Install the project dependencies:
poetry install -
Set up the database configuration:
- Modify the
config.ini
file with your database credentials. - Ensure that the required database is set up and accessible.
- Run the code examples and Examples using Poetry:
poetry run python script_name.py
Learn how to manage database migrations using Alembic, a powerful database migration tool for SQLAlchemy. Understand the process of synchronizing the database schema with your application code as it evolves over time.
Example Highlights:
- Setting up Alembic configuration
- Creating and running migrations
- Handling offline and online migrations
Master the basic CRUD operations (Create, Read, Update, Delete) in SQLAlchemy. Explore different techniques for creating, reading, updating, and deleting records from a database using SQLAlchemy’s powerful ORM capabilities.
Example Highlights:
- Creating records
- Retrieving records
- Updating records
- Deleting records
Learn how to seed your database with sample data using Faker, a Python library for generating fake data. Discover techniques for populating your database with realistic test data to facilitate development and testing.
Example Highlights:
- Generating fake data with Faker
- Seeding records for teachers, students, subjects, grades, and groups
Build a command-line interface (CLI) tool to perform database operations. Create a user-friendly interface that allows users to execute CRUD operations on the database using command-line arguments.
Example Highlights:
- Parsing command-line arguments with argparse
- Implementing create, read, update, and delete functionality
- Handling exceptions and error messages
Explore advanced database query techniques using SQLAlchemy. Learn how to perform complex queries to retrieve specific information from the database, such as aggregations, filtering, sorting, and joining multiple tables.
Example Highlights:
- Aggregating data and calculating averages
- Filtering and sorting results
- Joining tables and retrieving related data
- Executing complex queries
Contributions to this repository are welcome! If you have any improvements, bug fixes, or additional Examples/code examples to share, feel free to submit a pull request or open an issue. Let’s learn and grow together!
This project is licensed under the MIT License.
https://github.com/remmover/database_CRUD_operations_console
Leave a Reply