diff --git a/packages/context/src/scan/description-generation.ts b/packages/context/src/scan/description-generation.ts index ba61fb62..f4ad2d35 100644 --- a/packages/context/src/scan/description-generation.ts +++ b/packages/context/src/scan/description-generation.ts @@ -457,7 +457,7 @@ export class KtxDescriptionGenerator { } } - const sampleTable = input.connector.sampleTable; + const sampleTable = input.connector.sampleTable?.bind(input.connector); let sampleData: KtxTableSampleResult | null = null; let fallbackReason: 'capability_missing' | 'sampling_failed' | 'empty_sample' | null = null; @@ -678,7 +678,7 @@ export class KtxDescriptionGenerator { }); columnValues = []; } else { - const sampleColumn = input.connector.sampleColumn; + const sampleColumn = input.connector.sampleColumn.bind(input.connector); try { const sample = await retryAsync( () => diff --git a/packages/context/src/scan/relationship-profiling.ts b/packages/context/src/scan/relationship-profiling.ts index fa6acfac..ac1e063e 100644 --- a/packages/context/src/scan/relationship-profiling.ts +++ b/packages/context/src/scan/relationship-profiling.ts @@ -214,6 +214,9 @@ function sampleAggregateSql(driver: KtxConnectionDriver, innerSql: string): stri if (driver === 'postgres') { return `(SELECT STRING_AGG(CAST(value AS TEXT), CHR(31)) FROM (${innerSql}) AS relationship_profile_values)`; } + if (driver === 'duckdb') { + return `(SELECT STRING_AGG(CAST(value AS VARCHAR), CHR(31)) FROM (${innerSql}) AS relationship_profile_values)`; + } if (driver === 'bigquery') { return `(SELECT STRING_AGG(CAST(value AS STRING), '\\u001F') FROM (${innerSql}) AS relationship_profile_values)`; }