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

Release 4.6.0 breaks with AttributeError: 'function' object has no attribute 'is_cacheable' #454

Closed
wouterdb opened this issue Jan 18, 2022 · 3 comments

Comments

@wouterdb
Copy link

In previously working code, we get

09:54:55    File "/home/jenkins/workspace/bics_sirius_master/env/lib64/python3.6/site-packages/pysirius/main.py", line 374, in get
09:54:55      value = next(iter, None)
09:54:55    File "/home/jenkins/workspace/bics_sirius_master/env/lib64/python3.6/site-packages/pysirius/clients.py", line 265, in get_by_query_iter
09:54:55      documents = self._mock_db.search(cast(queries.QueryLike, record_filter))
09:54:55    File "/home/jenkins/workspace/bics_sirius_master/env/lib64/python3.6/site-packages/tinydb/table.py", line 235, in search
09:54:55      if cond.is_cacheable():
09:54:55  AttributeError: 'function' object has no attribute 'is_cacheable'

The code that calls this is as follows:

      def record_filter(record: Json) -> bool:
            if record[main.TYPE_KEY] != service_type.fq_type():
                return False

            for key, value in query.items():
                if not helpers.match_key(record, key, value):
                    return False

            return True

        # QueryLike is either a Callable (class) or Dict.
        documents = self._mock_db.search(cast(queries.QueryLike, record_filter))
@msiemens
Copy link
Owner

Thanks for reporting, I'll see how to fix this and publish a release shortly!

@msiemens
Copy link
Owner

I've now released TinyDB 4.6.1 which should fix this issue. Can you verify that your code works with that version?

@wouterdb
Copy link
Author

I can confirm that it works!

Thank you for the quick response.

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