aries-askar icon indicating copy to clipboard operation
aries-askar copied to clipboard

✨ add ordering options to scan query

Open ff137 opened this issue 1 year ago • 2 comments

Relates to #290

Adds order_by functionality to paginated scan queries, to allow for custom ordering of fetched storage records.

ff137 avatar Jul 25 '24 10:07 ff137

Ready for review!

I wanted to test compatibility with ACA-Py, but building and installing the python wrapper from my local branch, and running pytest in ACA-Py, gives me:

...
INTERNALERROR>     get_library()
INTERNALERROR>   File "/root/anaconda3/envs/acapy/lib/python3.12/site-packages/aries_askar/bindings/__init__.py", line 44, in get_library
INTERNALERROR>     LIB.loaded
INTERNALERROR>   File "/root/anaconda3/envs/acapy/lib/python3.12/site-packages/aries_askar/bindings/lib.py", line 352, in loaded
INTERNALERROR>     self._lib = LibLoad(self.__class__.LIB_NAME)
INTERNALERROR>                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/root/anaconda3/envs/acapy/lib/python3.12/site-packages/aries_askar/bindings/lib.py", line 106, in __init__
INTERNALERROR>     self._load_library()
INTERNALERROR>   File "/root/anaconda3/envs/acapy/lib/python3.12/site-packages/aries_askar/bindings/lib.py", line 129, in _load_library
INTERNALERROR>     raise AskarError(
INTERNALERROR> aries_askar.error.AskarError: Library not found in path: aries_askar

This resolves when I revert to installing official pypi package with pip install aries_askar. So, there must be some extra step required when calling pip install . in the aries-askar/wrappers/python dir.

I tried adding aries-askar/target/release to LD_LIBRARY_PATH, but no dice.

If anyone can assist or direct me on how to set this up for local testing with ACA-Py, will be much appreciated!

ff137 avatar Jul 26 '24 12:07 ff137

A logical extension would be to add the custom ordering option to "fetch all" queries as well (in a future PR)

ff137 avatar Jul 26 '24 12:07 ff137

Good news! Managed to successfully test the changes locally 🚀 after copying target/release/libaries_askar.so to wrappers/python/aries_askar 🚚

Happy to confirm that all the ACA-Py tests pass using this branch's changes ✅ Will begin implementing the order_by functionality for ACA-Py soon™️

ff137 avatar Aug 05 '24 18:08 ff137

I think I'm gonna try add the ordering options for fetching all records -- not just for scanning. Makes sense imo to include it all in one PR

ff137 avatar Aug 15 '24 17:08 ff137

I've expanded ordering options to the fetch_all method as well.

I can confirm python wrapper works with changes (ACA-Py tests pass using this build).

JavaScript wrapper still has some tests that remain to be fixed ...

ff137 avatar Aug 16 '24 20:08 ff137

@andrewwhitehead Please let me know if you've had moment to review, if there are any additional steps necessary here. Maybe changing default behavior, or implementing some specific tests.

ACA-Py tests are passing with these changes here: https://github.com/hyperledger/aries-cloudagent-python/pull/3173

And our end-to-end tests, asserting unique results across pages, are passing now (as described here: https://github.com/hyperledger/aries-cloudagent-python/pull/3173#issuecomment-2297491140)

ff137 avatar Aug 19 '24 21:08 ff137