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

Query('foo').bar results in errors #117

Closed
msiemens opened this Issue Oct 13, 2016 · 2 comments

Comments

2 participants
@msiemens
Owner

msiemens commented Oct 13, 2016

Source:

>>> from tinydb import Query
>>> Query('foo').bar

Stack trace:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\tinydb\queries.py", line 113, in __getattr__
    return Query(self._path + [item])
TypeError: cannot concatenate 'str' and 'list' objects
TypeError: Can't convert 'list' object to str implicitly

Discovered by @mikeckennedy when creating https://github.com/mikeckennedy/tinydb-sample-blog. We should really change the API here so people don't use it by accident in a way that breaks their programs.

@msiemens msiemens self-assigned this Oct 13, 2016

@msiemens msiemens changed the title from Query('something') results in errors to Query('foo').bar results in errors Oct 13, 2016

@eugene-eeo

This comment has been minimized.

Show comment
Hide comment
@eugene-eeo

eugene-eeo Oct 14, 2016

Contributor

Make the constructor's signature *arg?

Contributor

eugene-eeo commented Oct 14, 2016

Make the constructor's signature *arg?

@msiemens msiemens closed this in 43246a4 Jan 16, 2017

@msiemens

This comment has been minimized.

Show comment
Hide comment
@msiemens

msiemens Jan 16, 2017

Owner

I've now solved this by removing the Query constructor parameter altogether. The parameter was never intended to be used by the user anyway so this should be the most elegant solution.

Owner

msiemens commented Jan 16, 2017

I've now solved this by removing the Query constructor parameter altogether. The parameter was never intended to be used by the user anyway so this should be the most elegant solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment