Skip to content

Commit

Permalink
fix: use dbt target-path value [skip ci](#1456)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeRego committed Feb 28, 2022
1 parent 9636ae5 commit 8f14534
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/backend/src/dbt/dbtCliClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ import * as fs from 'fs/promises';
import yaml, { load as loadYaml } from 'js-yaml';
import path from 'path';
import { DbtError, ParseError } from '../errors';
import Logger from '../logger';
import { DbtClient } from '../types';

type DbtProjectConfig = {
targetDir: string;
};

type RawDbtProjectConfig = {
'target-path'?: string;
'target-dir'?: string;
};

Expand All @@ -44,7 +46,7 @@ export const getDbtConfig = async (
throw new Error('dbt_project.yml not valid');
}
return {
targetDir: config['target-dir'] || '/target',
targetDir: config['target-path'] || config['target-dir'] || '/target',
};
};

Expand Down Expand Up @@ -109,6 +111,7 @@ export class DbtCliClient implements DbtClient {
dbtArgs.push('--profile', this.profileName);
}
try {
Logger.debug(`Running dbt command: dbt ${dbtArgs.join(' ')}`);
const dbtProcess = await execa('dbt', dbtArgs, {
all: true,
stdio: ['pipe', 'pipe', process.stderr],
Expand Down Expand Up @@ -195,6 +198,7 @@ export class DbtCliClient implements DbtClient {
fileType: 'JSON' | 'YML' = 'JSON',
): Promise<any> {
try {
Logger.debug(`Load dbt artifact: ${fullPath}`);
const file = await fs.readFile(fullPath, 'utf-8');
if (fileType === 'JSON') {
return JSON.parse(file);
Expand Down

0 comments on commit 8f14534

Please sign in to comment.