sqlphilosophy 0.1.3__tar.gz → 0.1.4__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.3/src/sqlphilosophy.egg-info → sqlphilosophy-0.1.4}/PKG-INFO +1 -1
  2. sqlphilosophy-0.1.4/src/sqlphilosophy/VERSION +1 -0
  3. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/sql.py +14 -4
  4. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/sync/repository.py +5 -8
  5. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4/src/sqlphilosophy.egg-info}/PKG-INFO +1 -1
  6. sqlphilosophy-0.1.3/src/sqlphilosophy/VERSION +0 -1
  7. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/LICENSE +0 -0
  8. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/MANIFEST.in +0 -0
  9. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/README.md +0 -0
  10. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/pyproject.toml +0 -0
  11. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/setup.cfg +0 -0
  12. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/__init__.py +0 -0
  13. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/aio/__init__.py +0 -0
  14. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/aio/protocols.py +0 -0
  15. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/aio/query.py +0 -0
  16. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/aio/repository.py +0 -0
  17. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/audit/__init__.py +0 -0
  18. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/audit/context.py +0 -0
  19. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/audit/fields.py +0 -0
  20. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/audit/listener.py +0 -0
  21. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/audit/model.py +0 -0
  22. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/py.typed +0 -0
  23. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/sorting.py +0 -0
  24. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/sync/__init__.py +0 -0
  25. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/sync/protocols.py +0 -0
  26. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/sync/query.py +0 -0
  27. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy/types.py +0 -0
  28. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy.egg-info/SOURCES.txt +0 -0
  29. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy.egg-info/dependency_links.txt +0 -0
  30. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/src/sqlphilosophy.egg-info/requires.txt +0 -0
  31. {sqlphilosophy-0.1.3 → sqlphilosophy-0.1.4}/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.3
3
+ Version: 0.1.4
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.4
@@ -49,10 +49,20 @@ def sql_table(table_name: str, *column_names: str) -> SqlTable:
49
49
 
50
50
  def get_column_value(entity: object) -> ApiObject:
51
51
  """Return mapped column values for an ORM entity instance."""
52
- insp = sa_inspect(type(entity), raiseerr=False)
53
- if insp is None:
54
- raise TypeError(f"{type(entity)!r} is not a mapped SQLAlchemy entity")
55
- return {attr.key: getattr(entity, attr.key) for attr in insp.mapper.column_attrs}
52
+ instance_state = sa_inspect(entity, raiseerr=False)
53
+ if instance_state is not None and hasattr(instance_state, "mapper"):
54
+ mapper = instance_state.mapper
55
+ else:
56
+ from sqlphilosophy.sync.repository import BaseRepository
57
+
58
+ try:
59
+ insp = BaseRepository.inspect_model(type(entity))
60
+ except Exception as exc:
61
+ raise TypeError(f"{type(entity)!r} is not a mapped SQLAlchemy entity") from exc
62
+ if not hasattr(insp, "mapper"):
63
+ raise TypeError(f"{type(entity)!r} is not a mapped SQLAlchemy entity")
64
+ mapper = insp.mapper
65
+ return {attr.key: getattr(entity, attr.key) for attr in mapper.column_attrs}
56
66
 
57
67
 
58
68
  def row_mapping(row: object) -> RowMapping:
@@ -14,7 +14,6 @@ from sqlalchemy.orm import Session
14
14
  from sqlalchemy.orm.interfaces import LoaderOption
15
15
  from sqlphilosophy.sorting import ListQuery
16
16
  from sqlphilosophy.sorting import SortConfig
17
- from sqlphilosophy.sql import apply_mappings_page
18
17
  from sqlphilosophy.sql import delete_by_ids_model
19
18
  from sqlphilosophy.sql import partial_update_model
20
19
  from sqlphilosophy.sql import rows_mapping
@@ -114,13 +113,11 @@ class BaseRepository[T: DeclarativeBase]:
114
113
  params: RowMapping | None = None,
115
114
  ) -> list[RowMapping]:
116
115
  """Execute ``stmt`` with limit/offset; return normalized row mappings."""
117
- return apply_mappings_page(
118
- self.session,
119
- stmt,
120
- limit=limit,
121
- offset=offset,
122
- params=params,
123
- )
116
+ if limit < 0:
117
+ raise ValueError("limit must be >= 0")
118
+ if offset < 0:
119
+ raise ValueError("offset must be >= 0")
120
+ return self.fetch_statement_mappings(stmt.limit(limit).offset(offset), params)
124
121
 
125
122
  def fetch_sorted_mappings(
126
123
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlphilosophy
3
- Version: 0.1.3
3
+ Version: 0.1.4
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.3
File without changes
File without changes
File without changes
File without changes