Skip to content

Feat: Pagination #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@

## Project Status

- [ ] Overall Completion - 80% done
- [ ] Overall Completion - 85% done
- [ ] Tests - 90% Complete
- [x] Model class to create SQLAlchemy Models and Declarative Base
- [x] SQLAlchemy model export to dictionary through `model.dict(exclude={'x', 'y', 'z'})`
- [x] Support multiple database configurations in Models and in Query
- [x] Session to manage Model metadata
- [x] Service to manage Engine and Session creation and Migration initialization for async and sync Engines and Sessions
- [x] Alembic env.py with async first `run_migrations_online` action
- [x] Expose all alembic commands to Ellar CLI
- [x] Module to config and setup SQLAlchemy dependencies and migration
- [ ] SQLAlchemy Pagination for both templating and API routes
- [x] File and Image SQLAlchemy Columns integrated with ellar storage
- [x] Model class that transforms to SQLAlchemy Models or DeclarativeBase based on configuration
- [x] Pydantic-like way to exporting model to dictionary object eg:`model.dict(exclude={'x', 'y', 'z'})`
- [x] Support multiple database useful in models and queries
- [x] Session management during request scope and outside request
- [x] Service to manage SQLAlchemy Engine and Session creation, and Migration for async and sync Engines and Sessions
- [x] Async first approach to database migration using Alembic
- [x] Expose all Alembic commands to Ellar CLI
- [x] Module to config and setup SQLAlchemy dependencies and migration path
- [x] SQLAlchemy Pagination for both Templating and API routes
- [x] File and Image SQLAlchemy Columns integration with ellar storage
- [ ] SQLAlchemy Django Like Query
- [ ] Documentation

Expand Down
18 changes: 18 additions & 0 deletions ellar_sqlalchemy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
__version__ = "0.0.1"

from .module import EllarSQLAlchemyModule
from .pagination import LimitOffsetPagination, PageNumberPagination, paginate
from .query import (
first_or_404,
first_or_404_async,
get_or_404,
get_or_404_async,
one_or_404,
one_or_404_async,
)
from .schemas import MigrationOption, SQLAlchemyConfig
from .services import EllarSQLAlchemyService

Expand All @@ -11,4 +20,13 @@
"EllarSQLAlchemyService",
"SQLAlchemyConfig",
"MigrationOption",
"get_or_404_async",
"get_or_404",
"first_or_404_async",
"first_or_404",
"one_or_404_async",
"one_or_404",
"paginate",
"PageNumberPagination",
"LimitOffsetPagination",
]
2 changes: 1 addition & 1 deletion ellar_sqlalchemy/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
DATABASE_KEY = "__database__"
TABLE_KEY = "__table__"
ABSTRACT_KEY = "__abstract__"

PAGINATION_OPTIONS = "__PAGINATION_OPTIONS__"
NAMING_CONVERSION = {
"ix": "ix_%(column_0_label)s",
"uq": "uq_%(table_name)s_%(column_0_name)s",
Expand Down
11 changes: 11 additions & 0 deletions ellar_sqlalchemy/pagination/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from .base import Paginator, PaginatorBase
from .decorator import paginate
from .view import LimitOffsetPagination, PageNumberPagination

__all__ = [
"Paginator",
"PaginatorBase",
"paginate",
"PageNumberPagination",
"LimitOffsetPagination",
]
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy