fastapi-sqlalchemy-toolkit 0.7.20__tar.gz → 0.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/PKG-INFO +1 -1
  2. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/fastapi_sqlalchemy_toolkit/model_manager.py +181 -5
  3. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/pyproject.toml +1 -1
  4. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/.flake8 +0 -0
  5. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/.github/workflows/docker-test.yml +0 -0
  6. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/.github/workflows/python-publish.yml +0 -0
  7. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/.gitignore +0 -0
  8. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/.pylintrc +0 -0
  9. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/AUTHORS +0 -0
  10. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/LICENSE +0 -0
  11. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/Makefile +0 -0
  12. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/README.md +0 -0
  13. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/benefits.md +0 -0
  14. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/db_validation.md +0 -0
  15. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/extension.md +0 -0
  16. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/filtering.md +0 -0
  17. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/index.md +0 -0
  18. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/ru/benefits.md +0 -0
  19. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/ru/db_validation.md +0 -0
  20. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/ru/extension.md +0 -0
  21. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/ru/filtering.md +0 -0
  22. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/ru/index.md +0 -0
  23. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/ru/sorting.md +0 -0
  24. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/ru/transactions.md +0 -0
  25. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/ru/usage.md +0 -0
  26. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/ru/utils.md +0 -0
  27. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/sorting.md +0 -0
  28. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/transactions.md +0 -0
  29. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/usage.md +0 -0
  30. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/docs/utils.md +0 -0
  31. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/examples/app/.env +0 -0
  32. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/examples/app/__init__.py +0 -0
  33. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/examples/app/api/__init__.py +0 -0
  34. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/examples/app/api/api.py +0 -0
  35. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/examples/app/api/deps.py +0 -0
  36. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/examples/app/api/endpoints/__init__.py +0 -0
  37. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/examples/app/api/endpoints/child.py +0 -0
  38. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/examples/app/config.py +0 -0
  39. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/examples/app/db.py +0 -0
  40. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/examples/app/main.py +0 -0
  41. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/examples/app/managers.py +0 -0
  42. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/examples/app/models.py +0 -0
  43. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/examples/app/schemas.py +0 -0
  44. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/fastapi_sqlalchemy_toolkit/__init__.py +0 -0
  45. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/fastapi_sqlalchemy_toolkit/filters.py +0 -0
  46. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/fastapi_sqlalchemy_toolkit/ordering.py +0 -0
  47. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/fastapi_sqlalchemy_toolkit/utils.py +0 -0
  48. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/mkdocs.yml +0 -0
  49. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/poetry.lock +0 -0
  50. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/requirements/base.txt +0 -0
  51. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/requirements/docs.txt +0 -0
  52. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/requirements/lint.txt +0 -0
  53. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/requirements/test.txt +0 -0
  54. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/tests/Dockerfile +0 -0
  55. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/tests/__init__.py +0 -0
  56. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/tests/conftest.py +0 -0
  57. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/tests/db.py +0 -0
  58. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/tests/docker-compose.yml +0 -0
  59. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/tests/models.py +0 -0
  60. {fastapi_sqlalchemy_toolkit-0.7.20 → fastapi_sqlalchemy_toolkit-0.8.0}/tests/test_public_methods.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastapi_sqlalchemy_toolkit
3
- Version: 0.7.20
3
+ Version: 0.8.0
4
4
  Summary: FastAPI SQLAlchemy Toolkit
5
5
  Project-URL: Homepage, https://github.com/e-kondr01/fastapi-sqlalchemy-toolkit
6
6
  Author-email: Egor Kondrashov <e.kondr01@gmail.com>
@@ -1,6 +1,6 @@
1
1
  # ruff: noqa: UP006
2
2
  from collections.abc import Callable, Iterable
3
- from typing import Any, Generic, List, TypeVar # noqa: UP035
3
+ from typing import Any, Generic, List, TypeVar, overload # noqa: UP035
4
4
 
5
5
  from fastapi import HTTPException, status
6
6
  from fastapi_pagination.bases import BasePage
@@ -234,6 +234,32 @@ class ModelManager(Generic[ModelT, CreateSchemaT, UpdateSchemaT]):
234
234
  return result.scalars().all()
235
235
  return None
236
236
 
237
+ @overload
238
+ async def get(
239
+ self,
240
+ session: AsyncSession,
241
+ options: List[Any] | Any | None = ...,
242
+ order_by: InstrumentedAttribute | UnaryExpression | None = ...,
243
+ where: Any | None = ...,
244
+ base_stmt: None = ...,
245
+ *,
246
+ unique: bool = ...,
247
+ **simple_filters: Any,
248
+ ) -> ModelT | None: ...
249
+
250
+ @overload
251
+ async def get(
252
+ self,
253
+ session: AsyncSession,
254
+ options: List[Any] | Any | None = ...,
255
+ order_by: InstrumentedAttribute | UnaryExpression | None = ...,
256
+ where: Any | None = ...,
257
+ base_stmt: Select = ...,
258
+ *,
259
+ unique: bool = ...,
260
+ **simple_filters: Any,
261
+ ) -> Row | None: ...
262
+
237
263
  async def get(
238
264
  self,
239
265
  session: AsyncSession,
@@ -280,6 +306,32 @@ class ModelManager(Generic[ModelT, CreateSchemaT, UpdateSchemaT]):
280
306
  return result.scalar_one_or_none()
281
307
  return result.first()
282
308
 
309
+ @overload
310
+ async def get_or_404(
311
+ self,
312
+ session: AsyncSession,
313
+ options: List[Any] | Any | None = ...,
314
+ order_by: InstrumentedAttribute | UnaryExpression | None = ...,
315
+ where: Any | None = ...,
316
+ base_stmt: None = ...,
317
+ *,
318
+ unique: bool = ...,
319
+ **simple_filters: Any,
320
+ ) -> ModelT: ...
321
+
322
+ @overload
323
+ async def get_or_404(
324
+ self,
325
+ session: AsyncSession,
326
+ options: List[Any] | Any | None = ...,
327
+ order_by: InstrumentedAttribute | UnaryExpression | None = ...,
328
+ where: Any | None = ...,
329
+ base_stmt: Select = ...,
330
+ *,
331
+ unique: bool = ...,
332
+ **simple_filters: Any,
333
+ ) -> Row: ...
334
+
283
335
  async def get_or_404(
284
336
  self,
285
337
  session: AsyncSession,
@@ -407,6 +459,30 @@ class ModelManager(Generic[ModelT, CreateSchemaT, UpdateSchemaT]):
407
459
  )
408
460
  return True
409
461
 
462
+ @overload
463
+ async def paginated_filter(
464
+ self,
465
+ session: AsyncSession,
466
+ order_by: InstrumentedAttribute | UnaryExpression | None = ...,
467
+ options: List[Any] | Any | None = ...,
468
+ where: Any | None = ...,
469
+ base_stmt: None = ...,
470
+ transformer: Callable | None = ...,
471
+ **simple_filters: Any,
472
+ ) -> BasePage[ModelT]: ...
473
+
474
+ @overload
475
+ async def paginated_filter(
476
+ self,
477
+ session: AsyncSession,
478
+ order_by: InstrumentedAttribute | UnaryExpression | None = ...,
479
+ options: List[Any] | Any | None = ...,
480
+ where: Any | None = ...,
481
+ base_stmt: Select = ...,
482
+ transformer: Callable | None = ...,
483
+ **simple_filters: Any,
484
+ ) -> BasePage[Row]: ...
485
+
410
486
  async def paginated_filter(
411
487
  self,
412
488
  session: AsyncSession,
@@ -416,7 +492,7 @@ class ModelManager(Generic[ModelT, CreateSchemaT, UpdateSchemaT]):
416
492
  base_stmt: Select | None = None,
417
493
  transformer: Callable | None = None,
418
494
  **simple_filters: Any,
419
- ) -> BasePage[ModelT | Row]:
495
+ ) -> BasePage[Any]:
420
496
  """
421
497
  Получение списка объектов с фильтрами и пагинацией.
422
498
 
@@ -443,6 +519,38 @@ class ModelManager(Generic[ModelT, CreateSchemaT, UpdateSchemaT]):
443
519
  stmt = self.assemble_stmt(base_stmt, order_by, options, where, **simple_filters)
444
520
  return await paginate(session, stmt, transformer=transformer)
445
521
 
522
+ @overload
523
+ async def paginated_list(
524
+ self,
525
+ session: AsyncSession,
526
+ order_by: InstrumentedAttribute | UnaryExpression | None = ...,
527
+ filter_expressions: dict[InstrumentedAttribute | Callable, Any] | None = ...,
528
+ nullable_filter_expressions: (
529
+ dict[InstrumentedAttribute | Callable, Any] | None
530
+ ) = ...,
531
+ options: List[Any] | Any | None = ...,
532
+ where: Any | None = ...,
533
+ base_stmt: None = ...,
534
+ transformer: Callable | None = ...,
535
+ **simple_filters: Any,
536
+ ) -> BasePage[ModelT]: ...
537
+
538
+ @overload
539
+ async def paginated_list(
540
+ self,
541
+ session: AsyncSession,
542
+ order_by: InstrumentedAttribute | UnaryExpression | None = ...,
543
+ filter_expressions: dict[InstrumentedAttribute | Callable, Any] | None = ...,
544
+ nullable_filter_expressions: (
545
+ dict[InstrumentedAttribute | Callable, Any] | None
546
+ ) = ...,
547
+ options: List[Any] | Any | None = ...,
548
+ where: Any | None = ...,
549
+ base_stmt: Select = ...,
550
+ transformer: Callable | None = ...,
551
+ **simple_filters: Any,
552
+ ) -> BasePage[Row]: ...
553
+
446
554
  async def paginated_list(
447
555
  self,
448
556
  session: AsyncSession,
@@ -456,7 +564,7 @@ class ModelManager(Generic[ModelT, CreateSchemaT, UpdateSchemaT]):
456
564
  base_stmt: Select | None = None,
457
565
  transformer: Callable | None = None,
458
566
  **simple_filters: Any,
459
- ) -> BasePage[ModelT | Row]:
567
+ ) -> BasePage[Any]:
460
568
  """
461
569
  Получение списка объектов с фильтрами и пагинацией.
462
570
  Пропускает фильтры, значения которых None.
@@ -517,6 +625,36 @@ class ModelManager(Generic[ModelT, CreateSchemaT, UpdateSchemaT]):
517
625
 
518
626
  return await paginate(session, stmt, transformer=transformer)
519
627
 
628
+ @overload
629
+ async def filter(
630
+ self,
631
+ session: AsyncSession,
632
+ order_by: InstrumentedAttribute | UnaryExpression | None = ...,
633
+ options: List[Any] | Any | None = ...,
634
+ where: Any | None = ...,
635
+ base_stmt: None = ...,
636
+ limit: int | None = ...,
637
+ offset: int | None = ...,
638
+ *,
639
+ unique: bool = ...,
640
+ **simple_filters: Any,
641
+ ) -> List[ModelT]: ...
642
+
643
+ @overload
644
+ async def filter(
645
+ self,
646
+ session: AsyncSession,
647
+ order_by: InstrumentedAttribute | UnaryExpression | None = ...,
648
+ options: List[Any] | Any | None = ...,
649
+ where: Any | None = ...,
650
+ base_stmt: Select = ...,
651
+ limit: int | None = ...,
652
+ offset: int | None = ...,
653
+ *,
654
+ unique: bool = ...,
655
+ **simple_filters: Any,
656
+ ) -> List[Row]: ...
657
+
520
658
  async def filter(
521
659
  self,
522
660
  session: AsyncSession,
@@ -529,7 +667,7 @@ class ModelManager(Generic[ModelT, CreateSchemaT, UpdateSchemaT]):
529
667
  *,
530
668
  unique: bool = False,
531
669
  **simple_filters: Any,
532
- ) -> List[ModelT] | List[Row]:
670
+ ) -> List[Any]:
533
671
  """
534
672
  Получение списка объектов с фильтрами
535
673
 
@@ -573,6 +711,44 @@ class ModelManager(Generic[ModelT, CreateSchemaT, UpdateSchemaT]):
573
711
  return result.scalars().all()
574
712
  return result.all()
575
713
 
714
+ @overload
715
+ async def list(
716
+ self,
717
+ session: AsyncSession,
718
+ order_by: InstrumentedAttribute | UnaryExpression | None = ...,
719
+ filter_expressions: dict[InstrumentedAttribute | Callable, Any] | None = ...,
720
+ nullable_filter_expressions: (
721
+ dict[InstrumentedAttribute | Callable, Any] | None
722
+ ) = ...,
723
+ options: List[Any] | Any | None = ...,
724
+ where: Any | None = ...,
725
+ base_stmt: None = ...,
726
+ limit: int | None = ...,
727
+ offset: int | None = ...,
728
+ *,
729
+ unique: bool = ...,
730
+ **simple_filters: Any,
731
+ ) -> List[ModelT]: ...
732
+
733
+ @overload
734
+ async def list(
735
+ self,
736
+ session: AsyncSession,
737
+ order_by: InstrumentedAttribute | UnaryExpression | None = ...,
738
+ filter_expressions: dict[InstrumentedAttribute | Callable, Any] | None = ...,
739
+ nullable_filter_expressions: (
740
+ dict[InstrumentedAttribute | Callable, Any] | None
741
+ ) = ...,
742
+ options: List[Any] | Any | None = ...,
743
+ where: Any | None = ...,
744
+ base_stmt: Select = ...,
745
+ limit: int | None = ...,
746
+ offset: int | None = ...,
747
+ *,
748
+ unique: bool = ...,
749
+ **simple_filters: Any,
750
+ ) -> List[Row]: ...
751
+
576
752
  async def list(
577
753
  self,
578
754
  session: AsyncSession,
@@ -589,7 +765,7 @@ class ModelManager(Generic[ModelT, CreateSchemaT, UpdateSchemaT]):
589
765
  *,
590
766
  unique: bool = False,
591
767
  **simple_filters: Any,
592
- ) -> List[ModelT] | List[Row]:
768
+ ) -> List[Any]:
593
769
  """
594
770
  Получение списка объектов с фильтрами.
595
771
  Пропускает фильтры, значения которых None.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "fastapi_sqlalchemy_toolkit"
7
- version = "0.7.20"
7
+ version = "0.8.0"
8
8
  authors = [
9
9
  { name="Egor Kondrashov", email="e.kondr01@gmail.com" },
10
10
  ]