8000 feat: duckdb-wasm query UI [DRAFT] by mattrothenberg · Pull Request #39 · githubocto/flat-viewer · GitHub
[go: up one dir, main page]

Skip to content

feat: duckdb-wasm query UI [DRAFT] #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft
Prev Previous commit
Next Next commit
switch statement for db initialization
  • Loading branch information
Matt Rothenberg committed May 16, 2022
commit c83b98c3b562c2d4cb70055516d29481548faac7
17 changes: 12 additions & 5 deletions src/components/db-explorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,20 @@ function DBExplorerInner(props: DBExplorerInnerProps) {

try {
await db.registerFileText(filename, content);
extension === "csv"
? await c.insertCSVFromPath(filename, {
switch (extension) {
case "csv":
await c.insertCSVFromPath(filename, {
name: filenameWithoutExtension,
})
: await c.insertJSONFromPath(filename, {
});
break;
case "json":
await c.insertJSONFromPath(filename, {
name: filenameWithoutExtension,
});
break;
default:
break;
}
setDbStatus("success");
setQuery(`select * from '${filenameWithoutExtension}'`);
} catch (e) {
Expand Down Expand Up @@ -162,7 +169,7 @@ function DBExplorerInner(props: DBExplorerInnerProps) {
<CodeMirror
value={query}
height={"120px"}
className="w-full"
className="w-full font-mono"
extensions={[
sql({
defaultTable: filenameWithoutExtension,
Expand Down
0