target-clickhouse
Version:
A Singer target for Clickhouse
38 lines (37 loc) • 1.37 kB
TypeScript
import { ISourceMeta } from "./jsonSchemaInspector";
import TargetConnection from "./TargetConnection";
declare type PKValue = string | number;
declare type PKValues = PKValue[];
declare type SourceMetaPK = {
rootValues: PKValues | undefined;
parentValues: PKValues | undefined;
values: PKValues;
levelValues: PKValues | undefined;
};
interface RecordProcessorConfig {
batchSize: number;
translateValues: boolean;
autoEndTimeoutMs: number;
}
export default class RecordProcessor {
private readonly meta;
private readonly clickhouse;
private readonly config;
private readonly level;
readonly hasChildren: boolean;
private readonly isWithParentPK;
private readonly isRoot;
private readonly children;
private ingestionCtx?;
private bufferedDatasToStream;
private readonly currentPkMappings;
constructor(meta: ISourceMeta, clickhouse: TargetConnection, config: RecordProcessorConfig, level?: number);
pushRecord(data: Record<string, any>, abort: (err: Error) => void, maxVer: number, parentMeta?: SourceMetaPK, rootVer?: number, indexInParent?: number, messageCount?: number): void;
endIngestion(): Promise<void>;
buildSQLInsertField(): string[];
private isInitialized;
private sendBufferedDatasToStream;
private startIngestion;
private buildSQLInsertValues;
}
export {};