This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: reorganize to unify multiple SQL notebook types
- Loading branch information
Showing
25 changed files
with
3,305 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
// local: ../../../netspective-labs/sql-aide | ||
// remote: https://raw.githubusercontent.com/netspective-labs/sql-aide/v0.14.7 | ||
// remote: https://raw.githubusercontent.com/netspective-labs/sql-aide/v0.14.8 | ||
|
||
export * as path from "https://deno.land/[email protected]/path/mod.ts"; | ||
export * as ws from "https://raw.githubusercontent.com/netspective-labs/sql-aide/v0.14.7/lib/universal/whitespace.ts"; | ||
export * as SQLa from "https://raw.githubusercontent.com/netspective-labs/sql-aide/v0.14.7/render/mod.ts"; | ||
export * as SQLa_typ from "https://raw.githubusercontent.com/netspective-labs/sql-aide/v0.14.7/pattern/typical/mod.ts"; | ||
export * as callable from "https://raw.githubusercontent.com/netspective-labs/sql-aide/v0.14.7/lib/reflect/callable.ts"; | ||
export * as ulid from "https://deno.land/[email protected]/ulid/mod.ts"; | ||
export * as ws from "https://raw.githubusercontent.com/netspective-labs/sql-aide/v0.14.8/lib/universal/whitespace.ts"; | ||
export * as user from "https://raw.githubusercontent.com/netspective-labs/sql-aide/v0.14.8/lib/universal/os-user.ts"; | ||
export * as SQLa from "https://raw.githubusercontent.com/netspective-labs/sql-aide/v0.14.8/render/mod.ts"; | ||
export * as SQLa_typ from "https://raw.githubusercontent.com/netspective-labs/sql-aide/v0.14.8/pattern/typical/mod.ts"; | ||
export * as callable from "https://raw.githubusercontent.com/netspective-labs/sql-aide/v0.14.8/lib/reflect/callable.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-env --allow-run --allow-sys | ||
import { cell, TypicalCodeNotebook } from "./notebook/code.ts"; | ||
import { lifecycle as lcm } from "./models/mod.ts"; | ||
|
||
export class BootstrapNotebook extends TypicalCodeNotebook { | ||
readonly codeNbModels = lcm.codeNotebooksModels(); | ||
readonly serviceModels = lcm.serviceModels(); | ||
|
||
constructor() { | ||
super("bootstrap", { | ||
code_notebook_kernel_id: "SQL", | ||
kernel_name: "SQLite SQL Statements", | ||
mime_type: "application/sql", | ||
file_extn: ".sql", | ||
}); | ||
} | ||
|
||
bootstrapDDL() { | ||
return this.SQL` | ||
${this.codeNbModels.informationSchema.tables} | ||
${this.codeNbModels.informationSchema.tableIndexes} | ||
`; | ||
} | ||
|
||
bootstrapSeedDML() { | ||
return [ | ||
this.kernelUpsertStmt({ | ||
code_notebook_kernel_id: "SQL", | ||
kernel_name: "SQLite SQL Statements", | ||
mime_type: "application/sql", | ||
file_extn: ".sql", | ||
}), | ||
this.kernelUpsertStmt({ | ||
code_notebook_kernel_id: "DenoTaskShell", | ||
kernel_name: "Deno Task Shell", | ||
mime_type: "application/x-deno-task-sh", | ||
file_extn: ".deno-task-sh", | ||
}), | ||
]; | ||
} | ||
|
||
// note `once_` pragma means it must only be run once in the database; this | ||
// `once_` pragma does not mean anything to the code_notebook_* infra but the | ||
// naming convention does tell `surveilr` migration lifecycle how to operate | ||
// the cell at runtime initiatlize of the RSSD. | ||
@cell() | ||
v001_once_initialDDL() { | ||
// deno-fmt-ignore | ||
return this.SQL` | ||
-- ${this.tsProvenanceComment(import.meta.url)} | ||
${this.serviceModels.informationSchema.tables} | ||
${this.serviceModels.informationSchema.tableIndexes}`; | ||
} | ||
} | ||
|
||
// this will be used by any callers who want to serve it as a CLI with SDTOUT | ||
if (import.meta.main) { | ||
const SQL = await TypicalCodeNotebook.SQL(new BootstrapNotebook()); | ||
console.log(SQL.join("\n")); | ||
} |
Oops, something went wrong.
8581622
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failed to deploy: