Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/util/db-schema/jupyter.ts
Views: 687
import { Table } from "./types";1import { CREATED_BY, ID, CREATED } from "./crm";2import { SCHEMA as schema } from "./index";34// The jupyter api log has one entry each time a computation5// actually gets performed. Nothing is logged when a request6// is satisfied using the cache.78Table({9name: "jupyter_api_log",10fields: {11id: ID,12created: CREATED,13analytics_cookie: {14title: "Analytics Cookie",15type: "string",16desc: "The analytics cookie for the user that asked this question.",17},18account_id: CREATED_BY,19hash: {20type: "string",21desc: "Hash of the input history, input, kernel, project_id, and path.",22},23total_time_s: {24type: "number",25desc: "Total amount of time the API call took in seconds.",26},27tag: {28type: "string",29desc: "A string that the client can include that is useful for analytics later",30},31project_id: {32desc: "Optional project that is used for this evaluation.",33type: "uuid",34render: { type: "project_link" },35},36path: {37desc: "Optional path that is used for this evaluation.",38type: "string",39},40kernel: {41type: "string",42},43history: {44title: "History",45type: "array",46pg_type: "TEXT[]",47desc: "The previous inputs",48render: {49type: "json",50},51},52input: {53title: "Input",54type: "string",55desc: "Input text that was sent to kernel",56render: {57type: "code",58},59},60expire: {61type: "timestamp",62desc: "expire a log entry after 1 month",63},64},65rules: {66desc: "Jupyter Kernel Execution Log",67primary_key: "id",68pg_indexes: ["created", "hash"],69},70});7172Table({73name: "crm_jupyter_api_log",74rules: {75virtual: "jupyter_api_log",76primary_key: "id",77user_query: {78get: {79pg_where: [],80admin: true,81fields: {82id: null,83created: null,84hash: null,85account_id: null,86analytics_cookie: null,87project_id: null,88path: null,89kernel: null,90history: null,91input: null,92tag: null,93total_time_s: null,94},95},96},97},98fields: schema.jupyter_api_log.fields,99});100101Table({102name: "jupyter_api_cache",103fields: {104id: ID,105hash: {106type: "string",107desc: "Hash of the input history, input, kernel, project_id, and path.",108},109created: CREATED,110last_active: {111type: "timestamp",112desc: "When this cache entry was last requested",113},114output: {115title: "Output",116type: "array",117pg_type: "JSONB[]",118desc: "Output from running the computation",119render: {120type: "json",121},122},123expire: {124type: "timestamp",125desc: "this is last_active + 1 month",126},127},128rules: {129desc: "Jupyter Kernel Execution Log",130primary_key: "id",131pg_indexes: ["created", "hash"],132},133});134135Table({136name: "crm_jupyter_api_cache",137rules: {138virtual: "jupyter_api_cache",139primary_key: "id",140user_query: {141get: {142pg_where: [],143admin: true,144fields: {145id: null,146hash: null,147created: null,148last_active: null,149count: null,150output: null,151},152},153},154},155fields: schema.jupyter_api_cache.fields,156});157158159