Files
zeekay 073c1bf61e rename: zero ClickHouse — datastore_driver speaks X-Datastore-*
The wire protocol was the last holdout and it was not cosmetic: the Hanzo
Datastore server reads X-Datastore-User, and answers a request bearing
X-ClickHouse-User with 401. Verified against the live server, both directions.
So a client still sending the old headers is not merely off-brand, it cannot
authenticate over HTTP.

Everything else follows: types, dialects, error modules, docstrings and doc
links now name Datastore, and doc URLs point at docs.hanzo.ai/datastore rather
than the upstream vendor's site. Zero occurrences of the old name remain.

Still cut from the pinned upstream version, so behaviour is unchanged.
2026-07-26 11:06:05 -07:00

49 lines
1.1 KiB
Python

import logging
logger = logging.getLogger(__name__)
# Keep in sync with Datastore priorities
# https://github.com/Datastore/Datastore/blob/master/src/Interpreters/InternalTextLogsQueue.cpp
log_priorities = (
'Unknown',
'Fatal',
'Critical',
'Error',
'Warning',
'Notice',
'Information',
'Debug',
'Trace',
'Test',
)
num_priorities = len(log_priorities)
def log_block(block):
if block is None:
return
column_names = [x[0] for x in block.columns_with_types]
for row in block.get_rows():
row = dict(zip(column_names, row))
if 1 <= row['priority'] <= num_priorities:
priority = log_priorities[row['priority']]
else:
priority = row[0]
# thread_number in servers prior 20.x
thread_id = row.get('thread_id') or row['thread_number']
logger.info(
'[ %s ] [ %s ] {%s} <%s> %s: %s',
row['host_name'],
thread_id,
row['query_id'],
priority,
row['source'],
row['text']
)