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

ClickHouse error: Unrecognized type name: '<html>' #115

Open
Vikram1802 opened this issue Feb 28, 2024 · 1 comment
Open

ClickHouse error: Unrecognized type name: '<html>' #115

Vikram1802 opened this issue Feb 28, 2024 · 1 comment

Comments

@Vikram1802
Copy link

I'm running this simple query but getting the KeyError: '<html>'

async def fetch_data():
    try:
        async with aiohttp.ClientSession() as s:
            client = ChClient(s, url, user=user, password, compress_response=True)
            alive = await client.is_alive()
            print(f"Is ClickHouse alive? -> {alive}")
            fetch = await client.fetch("select id from customers where id > 200 limit 10")
            print(f"{fetch}")
    except ChClientError as e:
        print("ClickHouse error: {}".format(e))

Error:

KeyError: '<html>'

During handling of the above exception, another exception occurred:

ChClientError                             Traceback (most recent call last)
Cell In[23], line 5
      5 alive = await client.is_alive()
      6 print(f"Is ClickHouse alive? -> {alive}")
----> 7 fetch = await client.fetch("select id from customers where id > 200 limit 10")
       8 print(f"{fetch}")
File ~/volume/clickhouse/.venv/lib/python3.9/site-packages/aiochclient/client.py:265, in ChClient.fetch(self, query, json, params, query_id, decode, *args)
    239 async def fetch(
    240     self,
    241     query: str,
   (...)
    246     decode: bool = True,
    247 ) -> List[Record]:
    248     """Execute query and fetch all rows from query result at once in a list.
    249 
    250     :param query: Clickhouse query string.
   (...)
    263     :return: All rows from query.
    264     """
--> 265     return [
    266         row
    267         async for row in self._execute(
    268             query,
    269             *args,
    270             json=json,
    271             query_params=params,
    272             query_id=query_id,
    273             decode=decode,
    274         )
    275     ]

File ~/volume/clickhouse/.venv/lib/python3.9/site-packages/aiochclient/client.py:265, in <listcomp>(.0)
    239 async def fetch(
    240     self,
    241     query: str,
   (...)
    246     decode: bool = True,
    247 ) -> List[Record]:
    248     """Execute query and fetch all rows from query result at once in a list.
    249 
    250     :param query: Clickhouse query string.
   (...)
    263     :return: All rows from query.
    264     """
--> 265     return [
    266         row
    267         async for row in self._execute(
    268             query,
    269             *args,
    270             json=json,
    271             query_params=params,
    272             query_id=query_id,
    273             decode=decode,
    274         )
    275     ]

File ~/volume/clickhouse/.venv/lib/python3.9/site-packages/aiochclient/client.py:184, in ChClient._execute(self, query, json, query_params, query_id, decode, *args)
    182         yield rf.new(line)
    183 else:
--> 184     rf = RecordsFabric(
    185         names=await response.__anext__(),
    186         tps=await response.__anext__(),
    187         convert=decode,
    188     )
    189     async for line in response:
    190         yield rf.new(line)

File ~/volume/clickhouse/.venv/lib/python3.9/site-packages/aiochclient/records.py:91, in RecordsFabric.__init__(self, tps, names, convert)
     89 self.names = {key: index for (index, key) in enumerate(names)}
     90 if convert:
---> 91     self.converters = [
     92         what_py_converter(tp) for tp in tps.decode().strip().split("\t")
     93     ]
     94 else:
     95     self.converters = [
     96         empty_convertor for _ in tps.decode().strip().split("\t")
     97     ]

File ~/volume/clickhouse/.venv/lib/python3.9/site-packages/aiochclient/records.py:92, in <listcomp>(.0)
     89 self.names = {key: index for (index, key) in enumerate(names)}
     90 if convert:
     91     self.converters = [
---> 92         what_py_converter(tp) for tp in tps.decode().strip().split("\t")
     93     ]
     94 else:
     95     self.converters = [
     96         empty_convertor for _ in tps.decode().strip().split("\t")
     97     ]

File ~/volume/clickhouse/.venv/lib/python3.9/site-packages/aiochclient/_types.pyx:814, in aiochclient._types.what_py_converter()

File ~/volume/clickhouse/.venv/lib/python3.9/site-packages/aiochclient/_types.pyx:816, in aiochclient._types.what_py_converter()

File ~/volume/clickhouse/.venv/lib/python3.9/site-packages/aiochclient/_types.pyx:811, in aiochclient._types.what_py_type()

ChClientError: Unrecognized type name: '<html>'
@Maksim-Burtsev
Copy link
Contributor

Hi, @Vikram1802 !

Can you show DESCRIBE TABLE customers and tell what version of aiochclient you use in this example? And do you have any proxy like nginx/chproxy/etc.?

Looks like there is problem with ClickHouse or proxy (not library) and full result of http request will be look like "502" or something like that.

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