fix: Disable session checking and optimize ClickHouse client config
This commit is contained in:
parent
8d7ecb4f39
commit
4dcb9c969e
@ -14,7 +14,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
def create_client():
|
def create_client():
|
||||||
"""
|
"""
|
||||||
Create a ClickHouse client with retry logic but without session management
|
Create a ClickHouse client without session management
|
||||||
"""
|
"""
|
||||||
clickhouse_password = os.getenv("CLICKHOUSE_PASSWORD")
|
clickhouse_password = os.getenv("CLICKHOUSE_PASSWORD")
|
||||||
if not clickhouse_password:
|
if not clickhouse_password:
|
||||||
@ -34,13 +34,18 @@ def create_client():
|
|||||||
password=clickhouse_password,
|
password=clickhouse_password,
|
||||||
secure=True,
|
secure=True,
|
||||||
connect_timeout=10,
|
connect_timeout=10,
|
||||||
send_receive_timeout=300
|
send_receive_timeout=300,
|
||||||
|
query_limit=0, # No query limit
|
||||||
|
compress=True, # Enable compression
|
||||||
|
settings={
|
||||||
|
'session_check': 0 # Disable session checking
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Test the connection with a simple query
|
# Test the connection with a simple query
|
||||||
try:
|
try:
|
||||||
client.query('SELECT 1')
|
client.query('SELECT 1')
|
||||||
logger.info(f"Successfully established connection")
|
logger.debug(f"Successfully established connection") # Changed to debug level
|
||||||
return client
|
return client
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Connection test failed: {str(e)}")
|
logger.error(f"Connection test failed: {str(e)}")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user