Skip to content

Commit 06261de

Browse files
committed
Revert "duckdb connector"
This reverts commit 7c33e2d.
1 parent 7c33e2d commit 06261de

File tree

7 files changed

+6
-199
lines changed

7 files changed

+6
-199
lines changed

docs/duckdb-test.html

Lines changed: 0 additions & 36 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
"vite": "^7.0.0"
6464
},
6565
"devDependencies": {
66-
"@duckdb/node-api": "^1.3.2-alpha.26",
6766
"@eslint/js": "^9.29.0",
6867
"@types/jsdom": "^21.1.7",
6968
"@types/markdown-it": "^14.1.2",
@@ -78,14 +77,10 @@
7877
"vitest": "^3.2.4"
7978
},
8079
"peerDependencies": {
81-
"@duckdb/node-api": "^1.3.2-alpha.26",
8280
"postgres": "^3.4.7",
8381
"snowflake-sdk": "^2.1.3"
8482
},
8583
"peerDependenciesMeta": {
86-
"@duckdb/node-api": {
87-
"optional": true
88-
},
8984
"postgres": {
9085
"optional": true
9186
},

src/databases/duckdb.ts

Lines changed: 0 additions & 78 deletions
This file was deleted.

src/databases/index.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import type {ColumnSchema, QueryParam} from "../runtime/index.js";
22

3-
export type DatabaseConfig = DuckDBConfig | SnowflakeConfig | PostgresConfig;
4-
5-
export type DuckDBConfig = {
6-
type: "duckdb";
7-
};
3+
export type DatabaseConfig = SnowflakeConfig | PostgresConfig;
84

95
export type SnowflakeConfig = {
106
type: "snowflake";
@@ -27,10 +23,6 @@ export type PostgresConfig = {
2723
ssl?: boolean;
2824
};
2925

30-
export type DatabaseContext = {
31-
cwd: string;
32-
};
33-
3426
export type QueryTemplateFunction = (
3527
strings: string[],
3628
...params: QueryParam[]
@@ -43,13 +35,8 @@ export type SerializableQueryResult = {
4335
date: Date;
4436
};
4537

46-
export async function getDatabase(
47-
config: DatabaseConfig,
48-
context: DatabaseContext
49-
): Promise<QueryTemplateFunction> {
38+
export async function getDatabase(config: DatabaseConfig): Promise<QueryTemplateFunction> {
5039
switch (config.type) {
51-
case "duckdb":
52-
return (await import("./duckdb.js")).default(config, context);
5340
case "snowflake":
5441
return (await import("./snowflake.js")).default(config);
5542
case "postgres":
@@ -58,7 +45,3 @@ export async function getDatabase(
5845
throw new Error(`unsupported database type: ${config["type"]}`);
5946
}
6047
}
61-
62-
export function isDefaultDatabase(name: string): name is "postgres" | "duckdb" {
63-
return name === "postgres" || name === "duckdb";
64-
}

src/lib/error.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/vite/observable.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import type {TemplateLiteral} from "acorn";
77
import {JSDOM} from "jsdom";
88
import type {PluginOption, IndexHtmlTransformContext} from "vite";
99
import type {DatabaseConfig} from "../databases/index.js";
10-
import {getDatabase, isDefaultDatabase} from "../databases/index.js";
11-
import {isEnoent} from "../lib/error.js";
10+
import {getDatabase} from "../databases/index.js";
1211
import type {Cell, Notebook} from "../lib/notebook.js";
1312
import {deserialize} from "../lib/serialize.js";
1413
import {Sourcemap} from "../javascript/sourcemap.js";
@@ -121,19 +120,13 @@ export function observable({
121120
const cacheName = `${cell.database}-${hash}.json`;
122121
const cachePath = join(cacheDir, cacheName);
123122
if (!existsSync(cachePath)) {
124-
let config: DatabaseConfig | undefined;
125123
try {
126124
const configPath = join(dir, ".observable", "databases.json");
127125
const configStream = createReadStream(configPath, "utf-8");
128126
const configs = (await json(configStream)) as Record<string, DatabaseConfig>;
129-
config = configs[cell.database];
130-
} catch (error) {
131-
if (!isEnoent(error)) throw error;
132-
}
133-
if (isDefaultDatabase(cell.database)) config ??= {type: cell.database};
134-
if (!config) throw new Error(`database not found: ${cell.database}`);
135-
try {
136-
const database = await getDatabase(config, {cwd: dir});
127+
const config = configs[cell.database];
128+
if (!config) throw new Error(`database not found: ${cell.database}`);
129+
const database = await getDatabase(config);
137130
const results = await database.call(null, [value]);
138131
await mkdir(cacheDir, {recursive: true});
139132
await writeFile(cachePath, JSON.stringify(results));

yarn.lock

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -830,49 +830,6 @@
830830
enabled "2.0.x"
831831
kuler "^2.0.0"
832832

833-
"@duckdb/node-api@^1.3.2-alpha.26":
834-
version "1.3.2-alpha.26"
835-
resolved "https://registry.yarnpkg.com/@duckdb/node-api/-/node-api-1.3.2-alpha.26.tgz#3c0a69819343f565fad70ba187568e05f783bf13"
836-
integrity sha512-2gLtgJaiguAuPbXuS4NCthbIfEHo72FIF9514FKxg7sYY0gGJP1DgCpvBKdisyhWtBkNJ+jjn2p2PmRqkgZabQ==
837-
dependencies:
838-
"@duckdb/node-bindings" "1.3.2-alpha.26"
839-
840-
841-
version "1.3.2-alpha.26"
842-
resolved "https://registry.yarnpkg.com/@duckdb/node-bindings-darwin-arm64/-/node-bindings-darwin-arm64-1.3.2-alpha.26.tgz#3ba44763941ae11257e1edee7879a815ec4e2ae9"
843-
integrity sha512-SioksFdehT2TWuGx6otWM2bCJ6kjD4Nq9r6xHCA4gvko1MBESIm+XhwvwcnGx2IaXTzKRZ+DPxNTPobPX18lpQ==
844-
845-
846-
version "1.3.2-alpha.26"
847-
resolved "https://registry.yarnpkg.com/@duckdb/node-bindings-darwin-x64/-/node-bindings-darwin-x64-1.3.2-alpha.26.tgz#208ae84f4bf299742996de2d99c35732a5739d96"
848-
integrity sha512-RZ1n2Vtzit8YLl9kjfuH17nZd5MOLZoWTlDo0rv2EuIgslC7XLbxK3ZH6jiUQ+VEGRZAjXWvwtPOFNvQQ3+LhQ==
849-
850-
851-
version "1.3.2-alpha.26"
852-
resolved "https://registry.yarnpkg.com/@duckdb/node-bindings-linux-arm64/-/node-bindings-linux-arm64-1.3.2-alpha.26.tgz#b588bae3d42eedba14adf577f173fe29a833a8ba"
853-
integrity sha512-vhHmoiQpkeXb0PbhsLEEmulG05BxO1elNhHVMLobdAwVfoGEPE3fZkH4bPgvTGywwZC7ccqMFwMjYTTOIIJvLg==
854-
855-
856-
version "1.3.2-alpha.26"
857-
resolved "https://registry.yarnpkg.com/@duckdb/node-bindings-linux-x64/-/node-bindings-linux-x64-1.3.2-alpha.26.tgz#63475d3e54661f9ef9c058572233d473602e7ddf"
858-
integrity sha512-tLzo/lGu5DXrDZhogI8N9ohhByU8UzGnBFFE/0blBuZ/g5SonvTL0yq1zE/NCkLSmDSBtqibz3ehZ1rZuBBQTQ==
859-
860-
861-
version "1.3.2-alpha.26"
862-
resolved "https://registry.yarnpkg.com/@duckdb/node-bindings-win32-x64/-/node-bindings-win32-x64-1.3.2-alpha.26.tgz#1c01fcde529cfc983993ef51ce22876d5d958c4c"
863-
integrity sha512-wNZmvYgnkUS3/pC9RQNO6yJeI8EANxB5LAyERJMHtMKrF6LB1nTEYmFbSlVJQ9n10qtNxKv/fF47AAAovOnG6g==
864-
865-
866-
version "1.3.2-alpha.26"
867-
resolved "https://registry.yarnpkg.com/@duckdb/node-bindings/-/node-bindings-1.3.2-alpha.26.tgz#cc01b752a1eb251ef24e672a8b2bcbb10b76d4e0"
868-
integrity sha512-066o5XrzesZnF/qhNlpmFwDxvIXNYQWr48bjw/ecyLfUcpcvqE0MyL1/zV5oScfcf7hSd/dSntRVzUnQmJCwXg==
869-
optionalDependencies:
870-
"@duckdb/node-bindings-darwin-arm64" "1.3.2-alpha.26"
871-
"@duckdb/node-bindings-darwin-x64" "1.3.2-alpha.26"
872-
"@duckdb/node-bindings-linux-arm64" "1.3.2-alpha.26"
873-
"@duckdb/node-bindings-linux-x64" "1.3.2-alpha.26"
874-
"@duckdb/node-bindings-win32-x64" "1.3.2-alpha.26"
875-
876833
"@esbuild/[email protected]":
877834
version "0.25.5"
878835
resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.25.5.tgz#4e0f91776c2b340e75558f60552195f6fad09f18"

0 commit comments

Comments
 (0)