<jupyter_start><jupyter_text>Initialization and show all tables in default database<jupyter_code>from clickhouse_driver import Client

client = Client('clickhouse')
client.execute('SHOW TABLES')<jupyter_output><empty_output><jupyter_text>1. Query All<jupyter_code>res = client.execute('SELECT * FROM syslog')

len(res)<jupyter_output><empty_output><jupyter_text>2. Match Query<jupyter_code>client.execute("SELECT raw FROM syslog WHERE hostname='for.org'")<jupyter_output><empty_output><jupyter_text>3. Multi Match<jupyter_code>res = client.execute("SELECT raw FROM syslog WHERE hostname='for.org' OR application='ahmadajmi' ")
len(res)<jupyter_output><empty_output><jupyter_text>4. String QueryNeed match all fields which is trival 5. Term Query<jupyter_code>res = client.execute("SELECT raw FROM syslog WHERE lowerUTF8(raw) LIKE '%pretty%' ")
len(res)<jupyter_output><empty_output><jupyter_text>6. Range Query<jupyter_code>res = client.execute("SELECT raw FROM syslog WHERE version >= 2 ")
len(res)<jupyter_output><empty_output><jupyter_text>7. Exist Query<jupyter_code>res = client.execute("SELECT raw FROM syslog WHERE application is not NULL ")
len(res)<jupyter_output><empty_output><jupyter_text>8. Regex Query<jupyter_code>res = client.execute("SELECT raw FROM syslog WHERE match(hostname, 'up.*') ")
len(res)<jupyter_output><empty_output><jupyter_text>10. Count aggregation<jupyter_code>client.execute("SELECT count(version) FROM syslog ")<jupyter_output><empty_output><jupyter_text>11. Cardinality aggregation<jupyter_code>client.execute("SELECT count(distinct(priority)) FROM syslog ")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12192118226600986, 'fraction_numerical': 0.008620689655172414, 'mean_word_length': 10.443661971830986, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '234365', 'license': 'Apache-2.0', 'n_tokens_mistral': 571, 'n_tokens_neox': 555, 'n_words': 103, 'path': 'notebook/notebooks/Clickhouse Query.ipynb', 'repo_name': 'cr7258/clickhouse-lab', 'size': '1624'}