fix: allow dbt ingest to discover warehouse schemas (#20)

Co-authored-by: Andrey Avtomonov <7889985+andreybavt@users.noreply.github.com>
This commit is contained in:
Andrey Avtomonov 2026-05-12 10:25:56 +02:00 committed by GitHub
parent 106ce161ee
commit 9d3b1015cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 122 additions and 11 deletions

View file

@ -38,6 +38,31 @@ const baseTable: SemanticLayerSource = {
measures: [],
};
describe('listConnectionIdsWithNames', () => {
it('discovers local KTX connection ids from semantic-layer directories', async () => {
const configService = {
listFiles: vi.fn().mockResolvedValue({
files: [
'semantic-layer/warehouse/_schema/public.yaml',
'semantic-layer/dbt-main/orders.yaml',
'semantic-layer/.gitkeep',
],
}),
};
const catalog = connectionCatalog();
catalog.listEnabledConnections.mockImplementation(async (ids: string[]) =>
ids.map((id) => ({ id, name: id, connectionType: id === 'warehouse' ? 'postgres' : 'dbt' })),
);
const service = new SemanticLayerService(configService as never, catalog, pythonPort);
await expect(service.listConnectionIdsWithNames()).resolves.toEqual([
{ id: 'dbt-main', name: 'dbt-main', connectionType: 'dbt' },
{ id: 'warehouse', name: 'warehouse', connectionType: 'postgres' },
]);
expect(catalog.listEnabledConnections).toHaveBeenCalledWith(['dbt-main', 'warehouse']);
});
});
describe('composeOverlay', () => {
it('carries top-level segments from overlay into the composed source', () => {
const overlay = {