Library for easy interaction with SQLAlchemy and Pydantic.
Project description
SQLAlchemyCoreCatalyst
Your Library Name is a Python library that simplifies interactions with databases using SQLAlchemy and Pydantic. It provides a convenient way to define database models and perform CRUD (Create, Read, Update, Delete) operations with ease.
Installation
You can install Your Library Name using pip
:
pip install sqlalchemy-core-catalyst
Getting Started
Here is an example of how to use Your Library Name to interact with a database:
import asyncio
from pydantic import BaseModel
from database import Database
from declare_table import DeclareTable
from query import Query
# Thus, the user object represents the table "user" in the database with defined columns and their properties.
# This object can be used to create, update and execute queries to this table in SQLAlchemy.
# metadata = sa.MetaData()
# user = sa.Table(
# "user",
# metadata,
# sa.Column("id", sa.Integer, primary_key=True),
# sa.Column("login", sa.String, nullable=False),
# sa.Column("hash", sa.String, nullable=False),
# sa.Column("salt", sa.String, nullable=False),
# sa.Column("is_admin", sa.Boolean, default=False),
# sa.Column("is_user", sa.Boolean, default=True)
# )
class UserABC(BaseModel):
login: str
hash: str
salt: str
is_admin: bool = False
is_user: bool = True
class TableUser(UserABC, DeclareTable):
# Is a variable that becomes a table object that represents a table in the database.
# In this case, it is a table named "user".
_table = None
async def run():
db = Database()
db.init(db_host="db_host", db_name="db_name", db_user="db_user", db_pass="db_pass")
Query.set_database(db)
user = await TableUser.query().filter_by(id=1).one()
print(user)
asyncio.run(run())
Try out and explore various examples in our playground here.
Features
-
Database Interaction: Simplify working with databases using SQLAlchemy. Define database tables with Pydantic models and perform queries with ease.
-
Easy Configuration: Configure the library with simple parameters to connect to your database. No need for complex setup procedures.
-
Pydantic Integration: Seamlessly integrate Pydantic models to define the structure of your data.
-
Simplified Queries: Execute database queries with a straightforward and intuitive API, reducing the complexity of SQL.
-
Asynchronous Support: Utilize asynchronous programming for efficient database interactions.
-
Highly Extensible: Customize and extend the library to suit your specific project requirements.
-
Documentation: Comprehensive documentation and examples to guide you through using the library effectively.
-
Open Source: Licensed under the MIT License, allowing you to use and modify the library freely.
-
Community Support: Active community and support for questions and issues.
These features make Your Library Name a powerful tool for managing database interactions, providing simplicity, flexibility, and efficiency.
Documentation
For in-depth documentation, code examples, and additional resources, please visit the official documentation.
License
This project is open-source and licensed under the MIT License. For complete details, see the LICENSE file included with the project.
Acknowledgments
Please feel free to customize and expand this README according to the specific features, use cases, and documentation links associated with your library.
Project details
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 sqlalchemy_core_catalyst-0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5a5449af010d0be6c1c7a633c3aa56d3f98ba3fc2892dd331d1f30cb3a99097 |
|
MD5 | 8bcdeac875b2529420fcc889e86035d8 |
|
BLAKE2b-256 | 3dd3fa18e97c47f79e42d2fc1c856af9ad5b9c3332cb5ffaef4e916c4b482c82 |
Hashes for sqlalchemy_core_catalyst-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bf00ed3e8aa91e74c03f04f0dd9bf3940c131ac8d491b094f99991448f8c32f |
|
MD5 | c110c1eebeab33a5eb8ffb5fd4d4ab4b |
|
BLAKE2b-256 | b1acf369fa99c4ef272c1f55c4e7d0b1373d1f2e39f06959f5127d47b97a5686 |