Skip to content
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

Implement get_homogeneous_pages and select_homogeneous_pages #90

Open
wants to merge 159 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
ff21c99
Impelement get_homogeneous_pages.
mattalbr Jul 11, 2023
eff5d52
Check in unit test for multi-page lookup.
mattalbr Jul 13, 2023
d37132b
Fix missing symbols.
mattalbr Jul 13, 2023
df7466c
Fix flake8 test_paging.py
mattalbr Jul 13, 2023
4843e68
Export get_homogeneous_pages.
mattalbr Jul 13, 2023
9985e4e
Actually import get_homogeneous_pages.
mattalbr Jul 13, 2023
bd486e1
Add PageRequest.
mattalbr Jul 13, 2023
e534243
Fix bad symbol.
mattalbr Jul 13, 2023
5e6fd6a
Extend gathered.
mattalbr Jul 13, 2023
f5075c3
Use Union instead of |.
mattalbr Jul 13, 2023
9aae97f
Use Tuple instead of tuple.
mattalbr Jul 13, 2023
cbefa30
Use Book instead of Animal.
mattalbr Jul 13, 2023
bb86b7e
More python 3.7 and fix wrong symbol name.
mattalbr Jul 13, 2023
cdd0fc2
Improve tests.
mattalbr Jul 13, 2023
2af1ca2
Remove unused db session.
mattalbr Jul 13, 2023
76c2939
Exclude sqlite.
mattalbr Jul 13, 2023
6867d83
s/dburl/no_sqlite_url
mattalbr Jul 13, 2023
19ff009
s/url/dburl
mattalbr Jul 13, 2023
abdef8a
Fix for loop variable.
mattalbr Jul 13, 2023
a5514cf
Per page should be at least 1.
mattalbr Jul 14, 2023
b7a34f5
Fix UNION ALL ordering which isn't guaranteed.
mattalbr Jul 14, 2023
2f4f4bd
NamedTuple is immutable.
mattalbr Jul 14, 2023
3909554
Trailing whitespace.
mattalbr Jul 14, 2023
3393641
Use uo instead of element to get ordering right for ROW_NUMBER.
mattalbr Jul 14, 2023
f985063
Use deque for extendleft functionality.
mattalbr Jul 14, 2023
e5feac2
Debugging info.
mattalbr Jul 14, 2023
46248d2
Testing.
mattalbr Jul 14, 2023
c5a606e
Add before preparing paging.
mattalbr Jul 14, 2023
3ccdd3e
author_id is nullable which doesn't work with paging.
mattalbr Jul 14, 2023
0e7cc0b
Actually end the test on success.
mattalbr Jul 14, 2023
1378936
Add a test for fetching columns.
mattalbr Jul 14, 2023
b610c69
Make test homogeneous.
mattalbr Jul 14, 2023
d46719f
Move page_identifier inside prepare_paging.
mattalbr Jul 14, 2023
bdac930
Add select_homogeneous_pages and refactor tests.
mattalbr Jul 14, 2023
1127c0f
flake8 fixes.
mattalbr Jul 14, 2023
24943ea
More flake8.
mattalbr Jul 14, 2023
5bb4c5d
Convert deque to list.
mattalbr Jul 14, 2023
29985c4
Test select_homogeneous_pages.
mattalbr Jul 14, 2023
87a6a08
Flake 8 violations.
mattalbr Jul 14, 2023
993e45f
Fix default.
mattalbr Jul 14, 2023
23ec6da
non-default before default.
mattalbr Jul 14, 2023
aff47d8
Add page_identifier
mattalbr Jul 14, 2023
dfee9dd
filter -> where.
mattalbr Jul 14, 2023
403a397
Add debugging.
mattalbr Jul 14, 2023
ead71a3
Fix select statements.
mattalbr Jul 14, 2023
685fca4
Go back to Book orm.
mattalbr Jul 14, 2023
ccb3e91
add a print statement.
mattalbr Jul 18, 2023
4f62fba
Start with the simplest test first.
mattalbr Jul 18, 2023
43694f0
flake8
mattalbr Jul 18, 2023
34c41b2
Print statement caused exception.
mattalbr Jul 18, 2023
db47749
Don't double order single selects.
mattalbr Jul 18, 2023
90e9ae7
Fix test_core..._empty_queries.
mattalbr Jul 18, 2023
8ecb334
flake8.
mattalbr Jul 18, 2023
6c33a0f
One more test.
mattalbr Jul 18, 2023
e230d1a
Try using sub-select for key generation.
mattalbr Jul 18, 2023
0917ceb
See if individualized selected works for select(Book)
mattalbr Jul 18, 2023
719440c
Try a different way of forming the union.
mattalbr Jul 18, 2023
e192516
flake8
mattalbr Jul 18, 2023
6b596a5
Backtrack on testing, plus add a more fundamental test.
mattalbr Jul 18, 2023
806ef9d
Add a test.
mattalbr Jul 18, 2023
fa5fd49
Only execute one subselect as necessary.
mattalbr Jul 18, 2023
1b9133b
flake8
mattalbr Jul 18, 2023
1909b8e
Clean up single query select.
mattalbr Jul 18, 2023
1af24f8
Uncomment test to send Anthony error.
mattalbr Jul 18, 2023
a13e1b2
Play around with corresponding_column
mattalbr Jul 18, 2023
ca3e0d3
Use raw_cols instead
mattalbr Jul 18, 2023
2a9baef
Try outer select.
mattalbr Jul 18, 2023
2b8ceeb
flake8
mattalbr Jul 18, 2023
b94a6e4
Try outer select based on original.
mattalbr Jul 18, 2023
bebaea3
This time use requests in the inner.
mattalbr Jul 18, 2023
ad4548f
Add extra columns.
mattalbr Jul 18, 2023
cf67e5d
Try remapping corresponding columns.
mattalbr Jul 18, 2023
fb1259c
Use column_descriptions.
mattalbr Jul 18, 2023
e520f2e
More flexible column mapping.
mattalbr Jul 18, 2023
a00da44
Add logging.
mattalbr Jul 18, 2023
106d0fa
Compare quoted to quoted.
mattalbr Jul 18, 2023
1af4901
Try using the remapped columns.
mattalbr Jul 18, 2023
7209925
Print page_to_rows.
mattalbr Jul 19, 2023
44eb2ee
Order outer select.
mattalbr Jul 19, 2023
b98d364
Fix extra columns kinda.
mattalbr Jul 19, 2023
014e1c5
Print literal bound statement.
mattalbr Jul 19, 2023
f080b0d
Try to fix f string.
mattalbr Jul 19, 2023
6de382d
Bail on f string.
mattalbr Jul 19, 2023
3328025
Try using .c
mattalbr Jul 19, 2023
5f22343
Select *
mattalbr Jul 19, 2023
e4f4c8b
Let's try .columns?
mattalbr Jul 19, 2023
948ab10
Try subquery.
mattalbr Jul 19, 2023
fbdc607
Add prints to check row equivalence.
mattalbr Jul 19, 2023
6d33e3d
Fix spelling mistake.
mattalbr Jul 19, 2023
ac95966
Compare __dict__
mattalbr Jul 19, 2023
ddc3fdc
Remove known bad assertions.
mattalbr Jul 19, 2023
8dcfe3f
Fix non-orm assertions.
mattalbr Jul 19, 2023
9aea2d6
Fix hasattr
mattalbr Jul 19, 2023
ac61edd
hasattr didn't work.
mattalbr Jul 19, 2023
1ce0889
Remove bad print.
mattalbr Jul 19, 2023
38d6e68
Try unpacking tuple in test just to see.
mattalbr Jul 19, 2023
61d1db6
More print info.
mattalbr Jul 19, 2023
9989b09
Test multiple ORM.
mattalbr Jul 19, 2023
0241782
Test multi-orm core.
mattalbr Jul 19, 2023
36147a9
Fix dict comparison.
mattalbr Jul 19, 2023
821e138
skip _sa_instance_state
mattalbr Jul 19, 2023
87af81b
Skip id too
mattalbr Jul 19, 2023
bfd7746
Skip popularity too.
mattalbr Jul 19, 2023
f912cfc
raw_columns print.
mattalbr Jul 19, 2023
e16e162
Print better
mattalbr Jul 19, 2023
3e23a84
Use annotations.
mattalbr Jul 19, 2023
09e62b7
flake8
mattalbr Jul 19, 2023
b3f3dd0
Skip the .entity for mapper.
mattalbr Jul 19, 2023
82b04e3
Only use mapper for ORM.
mattalbr Jul 19, 2023
bd19b19
Skip annotations.
mattalbr Jul 19, 2023
e4710dc
flake8
mattalbr Jul 19, 2023
a551b3a
Skip test.
mattalbr Jul 19, 2023
4fe5643
Try using select.from_statement
mattalbr Jul 19, 2023
a30ffb1
flake8
mattalbr Jul 19, 2023
507f498
Skip order by?
mattalbr Jul 19, 2023
8bd589f
Use the correct selectable.
mattalbr Jul 19, 2023
2d54d08
Try not selecting _page_identifier.
mattalbr Jul 19, 2023
1842d3c
Try using prepared_queries instead.
mattalbr Jul 19, 2023
a56ed32
Get rid of corresponding_column nonsense.
mattalbr Jul 19, 2023
e4fd214
Special case len(requests) == 1.
mattalbr Jul 19, 2023
8f39aef
flake8
mattalbr Jul 19, 2023
24f21a3
fix symbol.
mattalbr Jul 19, 2023
aad8bc9
Do we even need _annotations?
mattalbr Jul 19, 2023
1b81cbe
Use Table.
mattalbr Jul 19, 2023
3760d88
Comment out tests to use test_core_whole_models.
mattalbr Jul 19, 2023
d7a2f5c
flake8
mattalbr Jul 20, 2023
b82baed
Remove join in test.
mattalbr Jul 20, 2023
bc1cd2a
Run full test suite.
mattalbr Jul 20, 2023
8028a14
Finish skipping the rest of the tests.
mattalbr Jul 20, 2023
cf06942
Add a test that tests different extra columns.
mattalbr Jul 20, 2023
bd60085
Try using same extra columns everywhere.
mattalbr Jul 20, 2023
c667354
flake8
mattalbr Jul 20, 2023
1ec9089
flake8
mattalbr Jul 20, 2023
f0690f4
Fix backwards.
mattalbr Jul 20, 2023
aac2e3e
Switch from set to list and add prints.
mattalbr Jul 20, 2023
6047c64
Copy extra columns.
mattalbr Jul 20, 2023
787436d
Fix naming.
mattalbr Jul 20, 2023
30f90e3
fix name.
mattalbr Jul 20, 2023
2b4da29
Refactor.
mattalbr Jul 20, 2023
238c442
flake8
mattalbr Jul 20, 2023
ce37b08
Undefined orm.
mattalbr Jul 20, 2023
52e7d4d
Fix typing.
mattalbr Jul 20, 2023
8c3ed82
Same list copy mistake.
mattalbr Jul 20, 2023
9dd17c3
Needs distinct ordering.
mattalbr Jul 20, 2023
91f8698
Flake8
mattalbr Jul 20, 2023
473c6a7
Fix assertion.
mattalbr Jul 20, 2023
57df5bc
Preserve ordering in cached mappers.
mattalbr Jul 20, 2023
61477e1
Fix ordering.
mattalbr Jul 20, 2023
e72e27b
Fix callable.
mattalbr Jul 20, 2023
f0f9ed2
Another property.
mattalbr Jul 20, 2023
61685b6
Add one more unit test.
mattalbr Jul 20, 2023
70379cd
fix test.
mattalbr Jul 20, 2023
793710c
Fix test again.
mattalbr Jul 20, 2023
039d456
Attempt to refactor to fix orm as well.
mattalbr Jul 20, 2023
037ab1c
Flake8
mattalbr Jul 20, 2023
80e0f5e
flake8
mattalbr Jul 20, 2023
1c45508
Fix orm=False
mattalbr Jul 20, 2023
5e2980b
Cleanup.
mattalbr Jul 20, 2023
be87aad
Clarify version
mattalbr Jul 20, 2023
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
14 changes: 13 additions & 1 deletion sqlakeyset/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
from .paging import get_page, select_page, InvalidPage
from .paging import (
get_homogeneous_pages,
get_page,
select_homogeneous_pages,
select_page,
InvalidPage,
OrmPageRequest,
PageRequest,
)
from .results import (
Page,
Paging,
Expand All @@ -15,11 +23,15 @@
from .types import Keyset, Marker

__all__ = [
"get_homogeneous_pages",
"get_page",
"select_homogeneous_pages",
"select_page",
"serialize_bookmark",
"unserialize_bookmark",
"Page",
"PageRequest",
"OrmPageRequest",
"Paging",
"Keyset",
"Marker",
Expand Down
5 changes: 2 additions & 3 deletions sqlakeyset/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,8 @@ def derive_order_key(ocol, desc, index):
else:
return None

entity = desc["entity"]
expr = desc["expr"]

entity = desc.get("entity")
if isinstance(expr, Bundle):
for key, col in dict(expr.columns).items():
if strip_labels(col).compare(ocol.comparable_value):
Expand Down Expand Up @@ -409,7 +408,7 @@ def derive_order_key(ocol, desc, index):

# is an attribute with label
try:
if ocol.quoted_full_name == OC(expr).full_name:
if ocol.quoted_full_name == OC(expr).quoted_full_name:
return DirectColumn(ocol, index)
except sqlalchemy.exc.ArgumentError:
pass
Expand Down
Loading