A Controller Interface for basic CRUD operations with SQLModel/SQLAlchemy
Project description
sqlmodel-controller
A Controller Interface for basic CRUD operations with SQLModel/SQLAlchemy
Overview
The library supports advanced features like complex filtering, joins, and custom queries. Refer to the documentation for detailed examples and API reference.
sqlmodel-controller is a Python library that provides a simple and efficient way to perform CRUD (Create, Read, Update, Delete) operations using SQLModel and SQLAlchemy. It offers a high-level abstraction layer that simplifies database interactions in your applications.
Features
- Easy-to-use Controller interface for CRUD operations
- Seamless integration with SQLModel and SQLAlchemy
- Flexible query building and filtering
- Support for pagination and sorting
- Asynchronous operations support
- Support for multiple database types (MySQL, SQLite, PostgreSQL)
Development Guide
This guide will help you set up the project for development and testing.
Prerequisites
- Python 3.8 or higher
- pip (Python package installer)
- Git
Installation
$ pip install sqlmodel-controller
---> 100%
Successfully installed sqlmodel-controller
Configuration
- Create a
.env
file in the project root directory with the following content:
DB_TYPE=mysql
DB_NAME=test
DB_USER=root
DB_PASSWORD=root
DB_HOST=localhost
DB_PORT=3306
This will use SQLite for development. You can change these settings to use MySQL or PostgreSQL if needed.
Development Workflow
-
Create a new branch for your feature or bug fix:
git checkout -b feature/your-feature-name
-
Make your changes and write tests for new functionality.
-
Run the tests to ensure everything is working:
pytest
-
Commit your changes:
git commit -am "Add your commit message here"
-
Push your changes to your fork:
git push origin feature/your-feature-name
-
Create a pull request on GitHub.
Code Style
This project follows PEP 8 style guide. You can use tools like flake8
or black
to ensure your code adheres to the style guide:
Documentation
When adding new features or making changes, please update the relevant documentation in the docs/
directory and add docstrings to your functions and classes.
Troubleshooting
If you encounter any issues during setup or testing, please check the following:
-
Ensure your Python version is 3.8 or higher:
python --version
-
Make sure all dependencies are installed correctly:
pip list
-
Verify that your
.env
file is set up correctly and in the right location.
If you still face issues, please open an issue on the GitHub repository with details about your environment and the problem you're experiencing.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sqlmodel_controller-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8faa8e190b9125f6c4bb08738ae7d0b66e62ae46c1d075233b7cddae0becbb90 |
|
MD5 | d71067020843973d767d517668c607cd |
|
BLAKE2b-256 | fc2f9c4b574933c9ece3e1ae915cc50a90cf5f40007ddfde1b9290d576acb7c7 |
Hashes for sqlmodel_controller-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f688977cd54d195772cd35faee65d25440f1c0e385da12eba26fa7f2294e71a4 |
|
MD5 | b1679dabeb605f086187e58455c46fe3 |
|
BLAKE2b-256 | 7b2be4f59b87bcdae0c7311fe284e83280afc096a7a9e1ef376cb902c6fad9f2 |