-
Notifications
You must be signed in to change notification settings - Fork 78
Pagination fix #198
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
base: main
Are you sure you want to change the base?
Pagination fix #198
Conversation
@Simon128 is this ready for review? |
It's ready for review. What do you use to generate the github pages from the docs folder? Is there something I can install to serve them locally, to checkout my changes in the doc? Also, be aware that a lot of files have been changed by the "ruff format" command. If you don't want this, we can just revert that single commit. |
@Simon128 you can just install mkdocs material and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, @Simon128, great PR!
- Maybe we could have a type mapping that handles some specific cases directly, and the fallback could be using python_type. We could even let the user specify this information
- Very nice solution
- Won't this break if some part of the cursor has commas? Maybe we could use json encoding or url safe encoding. Not sure how often this would happen though
def encode_cursor(cursor_values):
"""Encode cursor values safely for URL transmission"""
cursor_json = json.dumps(cursor_values)
encoded = base64.urlsafe_b64encode(cursor_json.encode()).decode()
return encoded
def decode_cursor(cursor_string):
"""Decode a cursor from URL-safe Base64 to original values"""
try:
decoded_json = base64.urlsafe_b64decode(cursor_string.encode()).decode()
return json.loads(decoded_json)
except Exception as e:
raise ValueError(f"Invalid cursor format: {e}")
- I think adding a deprecation warning is a good approach to avoid redundancy, we can drop it in the next major release
- I think we can go with an opt in approach, something like:
- Add a configuration parameter
require_qualified_sort_columns
defaulting to False - When False (default):
- Check if column names are unique across all tables
- If unique, use the column without qualification
- If not unique, issue a warning and use the column from the main table
- The warning should explicitly state which table's column is being used
- Suggest using a fully qualified name in future code for clarity
- When True:
- Require fully qualified column names
- Raise an exception for ambiguous column names
- Add a configuration parameter
Then we eventually can make default True
for require_qualified_sort_columns
and after some time remove the parameter entirely. Of course at least one major version before each of these changes
Plus, since your at it, maybe take a look at this one as well |
Pull Request Template for FastCRUD
Description
This pull request is about fixing issue #197 including some pagination related changes listed below.
Changes
Considerations
Tests
All test stuff was equivalently added to sqlalchemy and sqlmodel.
Checklist
Additional Notes
Not done yet (have to check the code style stuff and add to the documentation). But wanted to get early feedback as well as open the discussion to the points of considerations.