Skip to content

Commit cc5c5af

Browse files
authored
Merge pull request #8 from python-ellar/pagination
Feat: Pagination
2 parents ed448b1 + 8efc869 commit cc5c5af

27 files changed

+2101
-28
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010

1111
## Project Status
1212

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

ellar_sqlalchemy/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
__version__ = "0.0.1"
44

55
from .module import EllarSQLAlchemyModule
6+
from .pagination import LimitOffsetPagination, PageNumberPagination, paginate
7+
from .query import (
8+
first_or_404,
9+
first_or_404_async,
10+
get_or_404,
11+
get_or_404_async,
12+
one_or_404,
13+
one_or_404_async,
14+
)
615
from .schemas import MigrationOption, SQLAlchemyConfig
716
from .services import EllarSQLAlchemyService
817

@@ -11,4 +20,13 @@
1120
"EllarSQLAlchemyService",
1221
"SQLAlchemyConfig",
1322
"MigrationOption",
23+
"get_or_404_async",
24+
"get_or_404",
25+
"first_or_404_async",
26+
"first_or_404",
27+
"one_or_404_async",
28+
"one_or_404",
29+
"paginate",
30+
"PageNumberPagination",
31+
"LimitOffsetPagination",
1432
]

ellar_sqlalchemy/constant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
DATABASE_KEY = "__database__"
66
TABLE_KEY = "__table__"
77
ABSTRACT_KEY = "__abstract__"
8-
8+
PAGINATION_OPTIONS = "__PAGINATION_OPTIONS__"
99
NAMING_CONVERSION = {
1010
"ix": "ix_%(column_0_label)s",
1111
"uq": "uq_%(table_name)s_%(column_0_name)s",
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from .base import Paginator, PaginatorBase
2+
from .decorator import paginate
3+
from .view import LimitOffsetPagination, PageNumberPagination
4+
5+
__all__ = [
6+
"Paginator",
7+
"PaginatorBase",
8+
"paginate",
9+
"PageNumberPagination",
10+
"LimitOffsetPagination",
11+
]

0 commit comments

Comments
 (0)
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