feat: pass telemetry project id to semantic daemon

This commit is contained in:
Andrey Avtomonov 2026-05-22 16:15:48 +02:00
parent 1c6c6c853f
commit 2cbafa3df6
7 changed files with 71 additions and 1 deletions

View file

@ -106,7 +106,10 @@ describe('createPythonSemanticLayerComputePort', () => {
columns: [{ name: 'orders.order_count' }],
plan: { sources_used: ['orders'] },
}));
const port = createPythonSemanticLayerComputePort({ runJson });
const port = createPythonSemanticLayerComputePort({
runJson,
projectId: 'hashed-project-id',
});
await expect(
port.query({
@ -125,6 +128,7 @@ describe('createPythonSemanticLayerComputePort', () => {
sources: [source],
dialect: 'postgres',
query: { measures: ['orders.order_count'], dimensions: [] },
projectId: 'hashed-project-id',
});
});

View file

@ -90,6 +90,7 @@ export interface PythonSemanticLayerComputeOptions {
cwd?: string;
env?: NodeJS.ProcessEnv;
runJson?: KtxDaemonJsonRunner;
projectId?: string;
}
/** @internal */
@ -238,6 +239,7 @@ export function createPythonSemanticLayerComputePort(
const command = options.command ?? 'python';
const args = options.args ?? ['-m', 'ktx_daemon'];
const runJson = options.runJson ?? runProcessJson({ command, args, cwd: options.cwd, env: options.env });
const projectId = options.projectId;
return {
async query(input) {
@ -245,6 +247,7 @@ export function createPythonSemanticLayerComputePort(
sources: input.sources,
dialect: input.dialect,
query: input.query,
...(projectId ? { projectId } : {}),
});
return {
sql: typeof raw.sql === 'string' ? raw.sql : '',