sqlphilosophy 0.1.4__tar.gz → 0.1.6__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.

Potentially problematic release.


This version of sqlphilosophy might be problematic. Click here for more details.

Files changed (31) hide show
  1. {sqlphilosophy-0.1.4/src/sqlphilosophy.egg-info → sqlphilosophy-0.1.6}/PKG-INFO +1 -1
  2. sqlphilosophy-0.1.6/src/sqlphilosophy/VERSION +1 -0
  3. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/sql.py +20 -1
  4. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6/src/sqlphilosophy.egg-info}/PKG-INFO +1 -1
  5. sqlphilosophy-0.1.4/src/sqlphilosophy/VERSION +0 -1
  6. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/LICENSE +0 -0
  7. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/MANIFEST.in +0 -0
  8. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/README.md +0 -0
  9. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/pyproject.toml +0 -0
  10. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/setup.cfg +0 -0
  11. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/__init__.py +0 -0
  12. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/aio/__init__.py +0 -0
  13. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/aio/protocols.py +0 -0
  14. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/aio/query.py +0 -0
  15. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/aio/repository.py +0 -0
  16. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/audit/__init__.py +0 -0
  17. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/audit/context.py +0 -0
  18. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/audit/fields.py +0 -0
  19. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/audit/listener.py +0 -0
  20. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/audit/model.py +0 -0
  21. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/py.typed +0 -0
  22. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/sorting.py +0 -0
  23. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/sync/__init__.py +0 -0
  24. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/sync/protocols.py +0 -0
  25. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/sync/query.py +0 -0
  26. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/sync/repository.py +0 -0
  27. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy/types.py +0 -0
  28. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy.egg-info/SOURCES.txt +0 -0
  29. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy.egg-info/dependency_links.txt +0 -0
  30. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy.egg-info/requires.txt +0 -0
  31. {sqlphilosophy-0.1.4 → sqlphilosophy-0.1.6}/src/sqlphilosophy.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlphilosophy
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Portable SQLAlchemy repository kit: sync and async CRUD, statement builders, sort/pagination, and SQL helpers.
5
5
  Author-email: Josh Martin <denverprogrammer@gmail.com>
6
6
  License-Expression: MIT
@@ -0,0 +1 @@
1
+ 0.1.6
@@ -17,6 +17,7 @@ from sqlalchemy import desc
17
17
  from sqlalchemy import func
18
18
  from sqlalchemy import inspect as sa_inspect
19
19
  from sqlalchemy import literal_column
20
+ from sqlalchemy.exc import NoInspectionAvailable
20
21
  from sqlalchemy import select
21
22
  from sqlalchemy import update
22
23
  from sqlalchemy.orm import DeclarativeBase
@@ -42,6 +43,21 @@ from sqlphilosophy.types import SqlTable
42
43
  _ModelT = TypeVar("_ModelT", bound=DeclarativeBase)
43
44
 
44
45
 
46
+ def _mapped_model_class_for(value: object) -> type[DeclarativeBase] | None:
47
+ candidate: object = value if isinstance(value, type) else value.__class__
48
+
49
+ if not isinstance(candidate, type):
50
+ return None
51
+
52
+ try:
53
+ sa_inspect(candidate)
54
+ except NoInspectionAvailable:
55
+ if not hasattr(candidate, "__mapper__"):
56
+ return None
57
+
58
+ return cast(type[DeclarativeBase], candidate)
59
+
60
+
45
61
  def sql_table(table_name: str, *column_names: str) -> SqlTable:
46
62
  """Lightweight Core table — prefer ORM models unless you need Core performance."""
47
63
  return table(table_name, *[column(c) for c in column_names])
@@ -55,8 +71,11 @@ def get_column_value(entity: object) -> ApiObject:
55
71
  else:
56
72
  from sqlphilosophy.sync.repository import BaseRepository
57
73
 
74
+ model_cls = _mapped_model_class_for(entity)
75
+ if model_cls is None:
76
+ raise TypeError(f"{type(entity)!r} is not a mapped SQLAlchemy entity")
58
77
  try:
59
- insp = BaseRepository.inspect_model(type(entity))
78
+ insp = BaseRepository.inspect_model(model_cls)
60
79
  except Exception as exc:
61
80
  raise TypeError(f"{type(entity)!r} is not a mapped SQLAlchemy entity") from exc
62
81
  if not hasattr(insp, "mapper"):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlphilosophy
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Portable SQLAlchemy repository kit: sync and async CRUD, statement builders, sort/pagination, and SQL helpers.
5
5
  Author-email: Josh Martin <denverprogrammer@gmail.com>
6
6
  License-Expression: MIT
@@ -1 +0,0 @@
1
- 0.1.4
File without changes
File without changes
File without changes
File without changes