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: 'tuple' object has no attribute 'dtype' #108

Closed
georgipeev opened this issue Feb 1, 2023 · 4 comments · Fixed by #110
Closed

AttributeError: 'tuple' object has no attribute 'dtype' #108

georgipeev opened this issue Feb 1, 2023 · 4 comments · Fixed by #110
Assignees
Labels
bug Something isn't working

Comments

@georgipeev
Copy link

The above exception is thrown in any query that includes a LowCardinality(String) column. Regular String columns (including Nullable(String)) work fine. This problem does not happen with version 0.5.3.

Python version: 3.9
clickhouse_connect version: 0.5.4

Stack trace:

Closed HTTP response due to unexpected exception
Traceback (most recent call last):
  File "/home/gpeev/test.py", line 8, in <module>
    df = client.query_df("select ticker from vendor_data limit 10")
  File "/home/gpeev/venv/3.9/lib/python3.9/site-packages/clickhouse_connect/driver/client.py", line 255, in query_df
    return self._context_query(locals(), use_numpy=True).df_result
  File "/home/gpeev/venv/3.9/lib/python3.9/site-packages/clickhouse_connect/driver/client.py", line 583, in _context_query
    return self._query_with_context((self.create_query_context(**kwargs)))
  File "/home/gpeev/venv/3.9/lib/python3.9/site-packages/clickhouse_connect/driver/httpclient.py", line 195, in _query_with_context
    query_result = self._transform.parse_response(byte_source, context)
  File "/home/gpeev/venv/3.9/lib/python3.9/site-packages/clickhouse_connect/driver/transform.py", line 50, in parse_response
    first_block = get_block()
  File "/home/gpeev/venv/3.9/lib/python3.9/site-packages/clickhouse_connect/driver/transform.py", line 42, in get_block
    column = col_type.read_column(source, num_rows, context)
  File "/home/gpeev/venv/3.9/lib/python3.9/site-packages/clickhouse_connect/datatypes/base.py", line 128, in read_column
    column = self.read_column_data(source, num_rows, ctx)
  File "/home/gpeev/venv/3.9/lib/python3.9/site-packages/clickhouse_connect/datatypes/base.py", line 140, in read_column_data
    return self._read_low_card_column(source, num_rows, ctx)
  File "/home/gpeev/venv/3.9/lib/python3.9/site-packages/clickhouse_connect/datatypes/base.py", line 223, in _read_low_card_column
    if ctx.use_numpy and not (self.nullable and use_none) and keys.dtype != np.object_:
AttributeError: 'tuple' object has no attribute 'dtype'
@genzgd genzgd added the bug Something isn't working label Feb 1, 2023
@genzgd genzgd self-assigned this Feb 1, 2023
@genzgd
Copy link
Collaborator

genzgd commented Feb 1, 2023

Yes, this is broken. I should have a fix out later today.

@genzgd genzgd mentioned this issue Feb 1, 2023
2 tasks
@genzgd genzgd linked a pull request Feb 1, 2023 that will close this issue
2 tasks
@genzgd
Copy link
Collaborator

genzgd commented Feb 1, 2023

v0.5.5 released with a fix. Please validate if possible.

@georgipeev
Copy link
Author

The issue seems to be fixed in 0.5.5. Thanks!

@genzgd
Copy link
Collaborator

genzgd commented Feb 1, 2023

Thanks for the report and for trying new versions. Unfortunately I missed that test case but I hope you find the performance improvement for Pandas Dataframes was worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants