Skip to content

Commit

Permalink
chore(parquet-exporter): use relative dirname for duckdb schema
Browse files Browse the repository at this point in the history
  • Loading branch information
karlprieb committed Oct 1, 2024
1 parent 09b81c2 commit 7b84680
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/workers/parquet-exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import {
workerData,
} from 'node:worker_threads';
import * as winston from 'winston';
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';

const EXPORT_COMPLETE = 'export-complete';
const EXPORT_ERROR = 'export-error';
Expand Down Expand Up @@ -518,9 +520,12 @@ if (!isMainThread) {
const db = await Database.create(duckDbPath);
const connection = await db.connect();

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

try {
const duckDbSchema = readFileSync(
'./src/database/duckdb/schema.sql',
`${__dirname}/../database/duckdb/schema.sql`,
'utf8',
);
await connection.exec(duckDbSchema);
Expand Down

0 comments on commit 7b84680

Please sign in to comment.