Skip to content

Commit 59557e8

Browse files
authored
feat(duckdb-driver): Declare user agent information (#7490)
1 parent 566c67f commit 59557e8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/cubejs-duckdb-driver/src/DuckDBDriver.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import { Connection, Database } from 'duckdb';
1414
import { DuckDBQuery } from './DuckDBQuery';
1515
import { HydrationStream, transformRow } from './HydrationStream';
1616

17+
const { version } = require('../../package.json');
18+
1719
export type DuckDBDriverConfiguration = {
1820
dataSource?: string,
1921
initSql?: string,
@@ -55,8 +57,8 @@ export class DuckDBDriver extends BaseDriver implements DriverInterface {
5557

5658
protected async init(): Promise<InitPromise> {
5759
const token = getEnv('duckdbMotherDuckToken', this.config);
58-
59-
const db = new Database(token ? `md:?motherduck_token=${token}` : ':memory:');
60+
61+
const db = new Database(token ? `md:?motherduck_token=${token}&custom_user_agent=Cube/${version}` : ':memory:');
6062
// Under the hood all methods of Database uses internal default connection, but there is no way to expose it
6163
const defaultConnection = db.connect();
6264
const execAsync: (sql: string, ...params: any[]) => Promise<void> = promisify(defaultConnection.exec).bind(defaultConnection) as any;

0 commit comments

Comments
 (0)