Files
zeekay 2e29e0db21 rename: it is Hanzo Datastore everywhere, not ClickHouse
The fork half-carried the upstream vendor's name: env vars had been moved to
DATASTORE_*, but every module path, identifier and doc string underneath still
said ClickHouse. A fork that reads like someone else's product in every import
is a vendored copy that never got renamed.

  insights/clickhouse/            -> insights/datastore/
  insights/insightsql/functions/  -> .../functions/datastore/
  products/live_debugger/backend/ -> .../backend/datastore/
  docker/, docs/handbook/         -> datastore/
  CLICKHOUSE_* identifiers        -> DATASTORE_* (164 files)
  manage.py migrate_clickhouse    -> migrate_datastore
  prose, comments, docstrings     -> Datastore (1000+ files)

The ORM moved with it: hanzoai/infi.clickhouse_orm now ships `datastore_orm`,
so consumers write `from datastore_orm import ...` rather than threading the
original vendor's `infi` org namespace through their imports. Repinned here to
that revision.

MIGRATION HISTORY. A package rename orphans the history table, because it keys
on package_name: the runner then sees zero applied migrations, replays from
0001 and dies on 0026. That already happened once here, silently blocking every
datastore migration until the rows were re-keyed by hand. So the rename carries
its own fixup — migrate_datastore now adopts history from prior package names
before migrating, idempotent and a no-op on a fresh database, with the list of
former names as the single place a future rename has to touch. The history
TABLE name is unchanged: it is persisted state, and renaming it is a data
migration rather than a rename.

Left with the vendor's name, because they are the vendor's: clickhouse-driver,
clickhouse-pool and clickhouse-connect are third-party PyPI packages we do not
fork, CLICKHOUSE_SKIP_USER_SETUP and CLICKHOUSE_SERVER_IMAGE configure the
upstream server image, and clickhouse.com doc links point at the real engine's
documentation.

Verified: 4257 Python files parse with 0 syntax errors, no `insights.clickhouse`
or `infi.clickhouse` references survive, and clickhouse_pool/_driver imports are
untouched.
2026-07-26 08:44:50 -07:00

51 lines
1.6 KiB
TypeScript

import { randomUUID } from 'crypto'
import { DatastoreTimestamp, ProjectId, RawDatastoreEvent, RawKafkaEvent } from '../../src/types'
/**
* Helper function to create RawDatastoreEvent for tests with sensible defaults.
*
* @param overrides - Partial RawDatastoreEvent to override defaults
* @returns Complete RawDatastoreEvent object
*
* @example
* const event = createTestRawDatastoreEvent({
* team_id: 123,
* event: '$pageview',
* distinct_id: 'user-abc'
* })
*/
export function createTestRawDatastoreEvent(overrides: Partial<RawDatastoreEvent> = {}): RawDatastoreEvent {
const now = new Date().toISOString() as DatastoreTimestamp
return {
uuid: randomUUID(),
event: 'test_event',
team_id: 1,
project_id: 1 as ProjectId,
distinct_id: 'test_distinct_id',
timestamp: now,
created_at: now,
properties: '{}',
elements_chain: '',
person_created_at: now,
person_properties: '{}',
person_mode: 'full',
historical_migration: false,
...overrides,
}
}
/**
* Helper function to create RawKafkaEvent for tests with sensible defaults.
* RawKafkaEvent extends RawDatastoreEvent with a project_id field.
*
* @param overrides - Partial RawKafkaEvent to override defaults
* @returns Complete RawKafkaEvent object
*/
export function createTestRawKafkaEvent(overrides: Partial<RawKafkaEvent> = {}): RawKafkaEvent {
return {
...createTestRawDatastoreEvent(overrides),
project_id: (overrides.project_id ?? overrides.team_id ?? 1) as ProjectId,
}
}