Files
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

34 lines
1.3 KiB
Python

import sqlalchemy as db
from sqlalchemy.sql.ddl import CreateTable
from datastore_connect.cc_sqlalchemy.datatypes.sqltypes import UInt64, UInt32, DateTime
from datastore_connect.cc_sqlalchemy.ddl.tableengine import ReplicatedMergeTree, ReplacingMergeTree
from datastore_connect.cc_sqlalchemy.dialect import DatastoreDialect
dialect = DatastoreDialect()
replicated_mt_ddl = """\
CREATE TABLE `replicated_mt_test` (`key` UInt64) Engine ReplicatedMergeTree('/datastore/tables/repl_mt_test',\
'{replica}') ORDER BY key\
"""
replacing_mt_ddl = """\
CREATE TABLE `replacing_mt_test` (`key` UInt32, `date` DateTime) Engine ReplacingMergeTree(date) ORDER BY key\
"""
def test_table_def():
metadata = db.MetaData()
table = db.Table('replicated_mt_test', metadata, db.Column('key', UInt64),
ReplicatedMergeTree(order_by='key', zk_path='/datastore/tables/repl_mt_test',
replica='{replica}'))
ddl = str(CreateTable(table).compile('', dialect=dialect))
assert ddl == replicated_mt_ddl
table = db.Table('replacing_mt_test', metadata, db.Column('key', UInt32), db.Column('date', DateTime),
ReplacingMergeTree(ver='date', order_by='key'))
ddl = str(CreateTable(table).compile('', dialect=dialect))
assert ddl == replacing_mt_ddl