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

Strange excaption while using Enum. #428

Open
ikrivosheev opened this issue Mar 25, 2024 · 2 comments
Open

Strange excaption while using Enum. #428

ikrivosheev opened this issue Mar 25, 2024 · 2 comments

Comments

@ikrivosheev
Copy link

Describe the bug
After upgrade python to 3.11 we started get exceptions:

File "/usr/local/lib/python3.11/site-packages/clickhouse_driver/streams/native.py", line 74, in read
    column = read_column(self.context, column_type, n_rows,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/clickhouse_driver/columns/service.py", line 144, in read_column
    return col.read_data(n_items, buf)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/clickhouse_driver/columns/base.py", line 102, in read_data
    return self._read_data(n_items, buf, nulls_map=nulls_map)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/clickhouse_driver/columns/base.py", line 108, in _read_data
    return self.after_read_items(items, nulls_map)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/clickhouse_driver/columns/enumcolumn.py", line 48, in after_read_items
    return tuple(enum_cls(item).name for item in items)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/clickhouse_driver/columns/enumcolumn.py", line 48, in <genexpr>
    return tuple(enum_cls(item).name for item in items)
                 ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/enum.py", line 211, in __get__
    return self.fget(instance)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/enum.py", line 1247, in name
    return self._name_

AttributeError: 'Enum8' object has no attribute '_name_'

After this error every query to the server finished with the exception. Restart python process helps. I don't know this is a issue clickhouse_driver or aioch
I make new connection for every query.

To Reproduce
My colleges and I couldn't make this one.

Expected behavior
A clear and concise description of what you expected to happen.

Versions

  • clickhouse_driver 0.2.6
  • aioch 0.2
  • Python 3.11.5
@xzkostyan
Copy link
Member

Hi. Can you reproduce this without aioch?

@ikrivosheev
Copy link
Author

Hi. Can you reproduce this without aioch?

No, I cannot and I didn't try. Because my code depends on asyncio.
Well, maybe a problem is in the dynamic enum ganarated... But I couldn't find proofs.

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