Files
connect/examples/clear_test_databases.py
zeekay 75dd1132bd rename: zero ClickHouse — datastore_connect 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

23 lines
796 B
Python

#!/usr/bin/env python3 -u
import os
import datastore_connect
def main():
host = os.getenv('DATASTORE_CONNECT_TEST_HOST', 'localhost')
port = int(os.getenv('DATASTORE_CONNECT_TEST_PORT', '8123'))
password = os.getenv('DATASTORE_CONNECT_TEST_PASSWORD', '')
client = datastore_connect.get_client(host=host, port=port, password=password)
database_result = client.query("SELECT name FROM system.databases WHERE name ilike '%test%'").result_rows
for database_row in database_result:
database:str = database_row[0]
if database.startswith('dbt_datastore') or database.startswith('datastore_connect'):
print(f'DROPPING DATABASE `{database}`')
client.command(f'DROP DATABASE IF EXISTS {database}')
if __name__ == '__main__':
main()