A lite version of fastapi-filter for SQLAlchemy only
Project description
FastAPI filter
Compatibility
Required:
- Python: >=3.8, <3.12
- Fastapi: >=0.78, <0.93
- Pydantic: >=1.10.0, <2.0.0
Optional
- SQLAlchemy: >=1.4.36, <2.1.0
Installation
# Lite version
pip install fastapi-sqlalchemy-filter-lite
Documentation
This package was inspired by arthurio
The package is a lite version for SQLAlchemy only with a few modifications to it.
Please visit this site to view the full documentation: https://fastapi-filter.netlify.app/
Modifications / Additions
You can import the Filter
class and create a filter on the fly:
from fastapi_sqlalchemy_filter import Filter
user_dict = {'name': 'Jon Snow', 'clan': 'Targaryen'}
user_filter = Filter(**user_dict)
Package returns None
if an ordering field is not present on the class definition.
Note: No user action is needed on this part
This function was modified from:
...
@property
def ordering_values(self):
"""Check that the ordering field is present on the class definition."""
try:
return getattr(self, self.Constants.ordering_field_name)
except AttributeError:
raise AttributeError(
f"Ordering field {self.Constants.ordering_field_name} is not defined. "
"Make sure to add it to your filter class."
)
...
To
...
@property
def ordering_values(self):
"""Check that the ordering field is present on the class definition."""
if hasattr(self, self.Constants.ordering_field_name):
return getattr(self, self.Constants.ordering_field_name)
return None
...
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
File details
Details for the file fastapi_sqlalchemy_filter-0.2.2.tar.gz
.
File metadata
- Download URL: fastapi_sqlalchemy_filter-0.2.2.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fe8d655457f41a6bf65636dec8f227f193d41606c927355fae65ab56e12a522 |
|
MD5 | 8208cda37526b16254a49861cad5b97d |
|
BLAKE2b-256 | 2372a6d2058b65f5ed465d479af9c3691eaff565d6eb3e5541d159a3ca25b839 |
File details
Details for the file fastapi_sqlalchemy_filter-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: fastapi_sqlalchemy_filter-0.2.2-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c304f707f1a3f4a1a49cf3b075f514e7464e4143e459826cde527b0f86583a1 |
|
MD5 | 4d661ed2c4b3e499225fad07bb2fe74f |
|
BLAKE2b-256 | 601b4aab25738ab62e5621d04eda00f7cbede81f5ebf4b1a5541b00187e1ba1b |