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

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

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

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

msiemens opened this issue Oct 13, 2016 · 2 comments
Assignees

Comments

@msiemens
Copy link
Owner

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 Query('something') results in errors Query('foo').bar results in errors Oct 13, 2016
@eugene-eeo
Copy link
Contributor

Make the constructor's signature *arg?

@msiemens
Copy link
Owner Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants