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

AttributeError: 'SQLACondition' object has no attribute 'bindname' #5

Closed
linozen opened this issue Mar 15, 2022 · 3 comments · Fixed by #6
Closed

AttributeError: 'SQLACondition' object has no attribute 'bindname' #5

linozen opened this issue Mar 15, 2022 · 3 comments · Fixed by #6

Comments

@linozen
Copy link
Contributor

linozen commented Mar 15, 2022

Thanks for the great utility!

I frequently run into the error below when the code in mixins/sqla.py tries to run a .ilike( ... ). All the other operators work fine. Here is a full trace:

  File "/opt/bitnami/python/lib/python3.7/site-packages/boolean_parser/parsers/sqla.py", line 54, in filter
    for condition in self.conditions]
  File "/opt/bitnami/python/lib/python3.7/site-packages/boolean_parser/parsers/sqla.py", line 54, in <listcomp>
    for condition in self.conditions]
  File "/opt/bitnami/python/lib/python3.7/site-packages/boolean_parser/parsers/sqla.py", line 54, in filter
    for condition in self.conditions]
  File "/opt/bitnami/python/lib/python3.7/site-packages/boolean_parser/parsers/sqla.py", line 54, in <listcomp>
    for condition in self.conditions]
  File "/opt/bitnami/python/lib/python3.7/site-packages/boolean_parser/mixins/sqla.py", line 135, in filter
    condition = self._filter_one(model, field=field, condition=condition)
  File "/opt/bitnami/python/lib/python3.7/site-packages/boolean_parser/mixins/sqla.py", line 186, in _filter_one
    '%' + bindparam(self.bindname, value) + '%')
AttributeError: 'SQLACondition' object has no attribute 'bindname'
@havok2063
Copy link
Owner

Hi @linozen thanks for using the package. Glad you're finding it helpful. Can you provide an example I could use to try to reproduce the error you're seeing? It may be the case that I haven't accounted for all the sqlalchemy operators.

@linozen
Copy link
Contributor Author

linozen commented Mar 22, 2022

So I eventually fixed this by simply removing bindname. Here's the fix: linozen@3e28cdc

@havok2063
Copy link
Owner

I realize now that this block had old code in it (self.bindname) and that's why it was failing. A simple change would be to replace self.bindname with self.fullname, but I left further details in my PR review.

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

Successfully merging a pull request may close this issue.

2 participants