Example code in docs doesn't work when NodeNext is used for module resolution
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- node.js, typescript
調査の方向性
Databricks SQL driver のドキュメント URL にある TypeScript の例から始め、提供された package.json、Node 22、NodeNext の tsconfig 設定を使って失敗を再現します。ドキュメントに記載された imports が解決されるか、また NodeNext で例が正常にビルドできるかを確認します。例が動作するか、ドキュメントがサポート対象のセットアップを明確に反映していれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Using this tsconfig.json I can get the example code to build without error.
tsconfig.json:
{
"compilerOptions": {
"lib": ["ES2022"],
"outDir": "./dist",
"rootDir": "./src",
"target": "ES2022",
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
}
}
Code from website - https://docs.databricks.com/en/dev-tools/nodejs-sql-driver.html#language-TypeScript:
import { DBSQLClient } from '@databricks/sql';
import IDBSQLSession from '@databricks/sql/dist/contracts/IDBSQLSession';
import IOperation from '@databricks/sql/dist/contracts/IOperation';
const serverHostname: string = process.env.DATABRICKS_SERVER_HOSTNAME || '';
const httpPath: string = process.env.DATABRICKS_HTTP_PATH || '';
const token: string = process.env.DATABRICKS_TOKEN || '';
if (serverHostname == '' || httpPath == '' || token == '') {
throw new Error("Cannot find Server Hostname, HTTP Path, or personal access token. " +
"Check the environment variables DATABRICKS_SERVER_HOSTNAME, " +
"DATABRICKS_HTTP_PATH, and DATABRICKS_TOKEN.");
}
const client: DBSQLClient = new DBSQLClient();
const connectOptions = {
host: serverHostname,
path: httpPath,
token: token
};
client.connect(connectOptions)
.then(async client => {
const session: IDBSQLSession = await client.openSession();
const queryOperation: IOperation = await session.executeStatement(
'SELECT * FROM samples.nyctaxi.trips LIMIT 2',
{
runAsync: true,
maxRows: 10000 // This option enables the direct results feature.
}
);
const result = await queryOperation.fetchAll();
await queryOperation.close();
console.table(result);
await session.close();
client.close();
})
.catch((error) => {
console.error(error);
});
However, when changing the tsconfig to use NodeNext (like the below):
{
"compilerOptions": {
"lib": ["ES2022"],
"outDir": "./dist",
"rootDir": "./src",
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
}
}
I see the following error on the imports:
Cannot find module '@databricks/sql/dist/contracts/IDBSQLSession' or its corresponding type declarations.ts(2307)
Cannot find module '@databricks/sql/dist/contracts/IOperation' or its corresponding type declarations.ts(2307)
Versions:
- node 22
- this is the package.json:
{
"name": "example",
"version": "1.0.0",
"description": "show example of issue",
"main": "index.js",
"type": "module",
"scripts": {
"build": "tsc"
},
"author": "",
"license": "ISC",
"dependencies": {
"@databricks/sql": "^1.9.0"
},
"devDependencies": {
"typescript": "^5.6.3",
"typescript-eslint": "^8.14.0"
}
}
- 主要言語
- TypeScript
- スター
- 36
- フォーク
- 50
- 平均マージ
- 13時間 46分
- マージ済み PR(30日)
- 9
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
databricks/databricks-sql-nodejs のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
engineer-bot
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
databricks/databricks-sql-nodejs#274 · コメント 1 件 · リアクション 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
databricks/databricks-sql-nodejs の issue をすべて見る
似ている issue
-
S: triage
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
fix(errors): EHOSTUNREACH from a happy-eyeballs connect is reported as a resolver error (STAMP-80) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
snapshot-labs/stamp#666 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
GauravKarakoti/SecureFlow#1070 · コメント 1 件 ·
-
feature:Languages/Translations good first issue ready Web
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
digitalfabrik/integreat-app#4394 ·