mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-13 08:15:14 +02:00
feat: pass telemetry project id to semantic daemon
This commit is contained in:
parent
1c6c6c853f
commit
2cbafa3df6
7 changed files with 71 additions and 1 deletions
|
|
@ -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',
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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 : '',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue