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

String literal 'NONE' gets mapped to Python None value in result sets #68

Open
bryonjacob opened this issue Oct 8, 2017 · 3 comments
Open

Comments

@bryonjacob
Copy link
Contributor

In a SQL or SPARQL response, the literal string value 'NONE' (case-insensitive) is converted into the python value None:

>>> datadotworld.query('bryon/odin-2015-2016', 'SELECT ?value WHERE{ BIND("NONE" AS ?value)}', query_type='sparql').table
[OrderedDict([('value', None)])]
>>> datadotworld.query('bryon/odin-2015-2016', 'SELECT ?value WHERE{ BIND("ABCD" AS ?value)}', query_type='sparql').table
[OrderedDict([('value', 'ABCD')])]
>>> datadotworld.query('bryon/odin-2015-2016', 'SELECT "NONE" AS value').table
[OrderedDict([('value', None)])]
>>> datadotworld.query('bryon/odin-2015-2016', 'SELECT "ABCD" AS value').table
[OrderedDict([('value', 'ABCD')])]
@bryonjacob
Copy link
Contributor Author

UGH. so, this is because we are depending on the datapackage library which is hardcoded to treat any of these strings:

['null', 'none', 'nil', 'nan', '-']

as None when they occur as a value in a StringValue-typed column. In the context of returning query results from our servers, this is always wrong - we have the capacity to handle null results just fine explicitly.

bryonjacob added a commit that referenced this issue Oct 8, 2017
rflprr pushed a commit that referenced this issue Oct 10, 2017
* fix for #68

* updated version
@rflprr
Copy link
Contributor

rflprr commented Oct 10, 2017

Some work here is still necessary after Bryon's hotfix to ensure that there is no broader impact and, possibly, a simpler and more generalized solution.

@rflprr
Copy link
Contributor

rflprr commented Jul 30, 2018

Py: Small bugs

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

2 participants