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

Row Value Misused Error #29

Closed
topbloc-beiswenger opened this issue Jul 9, 2019 · 7 comments
Closed

Row Value Misused Error #29

topbloc-beiswenger opened this issue Jul 9, 2019 · 7 comments

Comments

@topbloc-beiswenger
Copy link

The code that I'm using is very similar to the example provided in the README:

qs = Vendor.objects.filter(client__pk=client_id)
page_size = 2
paginator = CursorPaginator(qs, ordering=('-completed_date', '-id'))
page = paginator.page(first=page_size, after=after)
data = {
    'objects': [p for p in page],
    'has_next': True,
    'last_cursor': paginator.cursor(page[-1])
}
return data

This is working for the first request with the after argument defaulted to None, but as soon as the after argument is added, I receive the following error row value misused. This error is caused mainly by the line queryset = queryset.annotate(_cursor=Tuple(*[o.lstrip('-') for o in self.ordering])). When accessing the queryset variable after this line, I receive the error row value misused. I'm using Django 2.1.5 and sqlite3 2.6.0.

@Drarok
Copy link
Contributor

Drarok commented Jul 9, 2019

You’ll need a much newer version of SQLite in order for this to work as mentioned in PR #28.

SQLite 2.6.0 was released 2002-07-18, which is positively ancient for software.

Row values were added to SQLite version 3.15.0 (2016-10-14).

#28

@topbloc-beiswenger
Copy link
Author

topbloc-beiswenger commented Jul 17, 2019

Sorry, I should have been more specific. I'm using Python 3.7.0 which has sqlite3 version 2.6.0 as a Python package. But, the sqlite version on my computer is 3.24.0.

@Drarok
Copy link
Contributor

Drarok commented Jul 18, 2019

Can you check what sqlite3.sqlite_version is set to?

import sqlite3
sqlite3.sqlite_version

@topbloc-beiswenger
Copy link
Author

Yep, it's version 3.24.0. I did try upgrade to 3.28.0 but was still getting the same error.

@craigfay
Copy link

@Drarok @topbloc-beiswenger Any resolution here? I'm having the same experience. Looks like it's related to using a DateTimeField for ordering.

Good: paginator = CursorPaginator(qs, ordering=('-id',))
Error: paginator = CursorPaginator(qs, ordering=('-created_at', '-id'))

sqlite3: 3.28.0
python: 3.7.6
django: 3.1
django-cursor-pagination: 0.1.4
django-utils-six: 2.0

@topbloc-beiswenger
Copy link
Author

@craigfay Our team switched to postgres in local development to match our server configuration. This was able to fix the issue. Sorry, but I never found a way to resolve the error with sqlite.

@thommor
Copy link
Contributor

thommor commented Nov 22, 2022

Closing as stale

@thommor thommor closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants