import clickhouse_connect
client = clickhouse_connect.get_client(host='localhost', username='default', password='atlife789')
def execute_query(client,trans_query):
try:
data = client.query(trans_query)
dataset = pd.DataFrame(data.result_rows,columns=data.column_names)
return dataset
except Exception as e:
print(f'Erron on executing the query as {e}.')
return pd.DataFrame()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter