Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

improvement: auto-install sqlglot when using mo.sql in wasm (#3900)

Myles Scolnick21d3156bbf4e
diff --git a/frontend/src/core/islands/worker/worker.tsx b/frontend/src/core/islands/worker/worker.tsx
index 692f5146f5..9e15fb6ee8 100644
--- a/frontend/src/core/islands/worker/worker.tsx
+++ b/frontend/src/core/islands/worker/worker.tsx
@@ -89,6 +89,7 @@ const requestHandler = createRPCRequestHandler({
// Add pandas and duckdb to the code
code = `import pandas\n${code}`;
code = `import duckdb\n${code}`;
+ code = `import sqlglot\n${code}`;
}
await self.pyodide.loadPackagesFromImports(code, {
diff --git a/frontend/src/core/wasm/worker/bootstrap.ts b/frontend/src/core/wasm/worker/bootstrap.ts
index 917ffbe29c..342520a95a 100644
--- a/frontend/src/core/wasm/worker/bootstrap.ts
+++ b/frontend/src/core/wasm/worker/bootstrap.ts
@@ -165,6 +165,7 @@ export class DefaultWasmController implements WasmController {
// We need pandas and duckdb for mo.sql
code = `import pandas\n${code}`;
code = `import duckdb\n${code}`;
+ code = `import sqlglot\n${code}`;
}
// Add:
diff --git a/frontend/src/core/wasm/worker/worker.ts b/frontend/src/core/wasm/worker/worker.ts
index 7061fa7b81..5a879ee115 100644
--- a/frontend/src/core/wasm/worker/worker.ts
+++ b/frontend/src/core/wasm/worker/worker.ts
@@ -140,6 +140,7 @@ const requestHandler = createRPCRequestHandler({
// Add pandas and duckdb to the code
code = `import pandas\n${code}`;
code = `import duckdb\n${code}`;
+ code = `import sqlglot\n${code}`;
}
await self.pyodide.loadPackagesFromImports(code, {