Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Querying a view with a boolean type key raises a CloudantArgumentError #494

Closed
rajahaidar opened this issue Apr 16, 2021 · 2 comments · Fixed by #504
Closed

Querying a view with a boolean type key raises a CloudantArgumentError #494

rajahaidar opened this issue Apr 16, 2021 · 2 comments · Fixed by #504

Comments

@rajahaidar
Copy link

rajahaidar commented Apr 16, 2021

Bug Description

1. Steps to reproduce and the simplest code sample possible to demonstrate the issue

Create a cloudant database view, and attempt to query the view using the python-cloudant library as follows:

results = database.get_view_result('_design/doc', 'view-name', raw_result=True, key=False)

The above code will raise a CloudantArgumentError due to the validation on this line

if (not isinstance(val, RESULT_ARG_TYPES[key]) or

2. What you expected to happen

The expected outcome would be that the view get filtered by the boolean type key instead of raising the error

I removed the validation locally and reinitiated the view query, and the key filtered fine from the CouchDB library end i.e. their library accepted a boolean type for the key argument

3. What actually happened

A CloudantArgumentError was raised when trying to filter by a boolean value for the argument key

Environment details

Python 3.9.2
Database server: IBM Cloudant

@rajahaidar
Copy link
Author

Please let me know if you would like me to submit a PR with a fix for this

@emlaver
Copy link
Member

emlaver commented Apr 16, 2021

Hi @rajahaidar thanks for bringing this to our attention. Yes, please open a PR that includes the fix and a test case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants