Skip to content

code_notebook_state

Description

Records the state of a notebook’s cells’ executions, computations, and results for Kernels that are stateful. For example, a SQL Notebook Cell that creates tables should only be run once (meaning it’s statefule). Other Kernels might store results for functions and output defined in one cell can be used in later cells.

Table Definition
CREATE TABLE "code_notebook_state" (
"code_notebook_state_id" VARCHAR PRIMARY KEY NOT NULL,
"code_notebook_cell_id" VARCHAR NOT NULL,
"from_state" TEXT NOT NULL,
"to_state" TEXT NOT NULL,
"transition_result" TEXT CHECK(json_valid(transition_result) OR transition_result IS NULL),
"transition_reason" TEXT,
"transitioned_at" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"elaboration" TEXT CHECK(json_valid(elaboration) OR elaboration IS NULL),
"created_at" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"created_by" TEXT DEFAULT 'UNKNOWN',
"updated_at" TIMESTAMP,
"updated_by" TEXT,
"deleted_at" TIMESTAMP,
"deleted_by" TEXT,
"activity_log" TEXT,
FOREIGN KEY("code_notebook_cell_id") REFERENCES "code_notebook_cell"("code_notebook_cell_id"),
UNIQUE("code_notebook_cell_id", "from_state", "to_state")
)

Columns

NameTypeDefaultNullableParentsComment
code_notebook_state_idVARCHARfalsecode_notebook_state primary key
code_notebook_cell_idVARCHARfalsecode_notebook_cellcode_notebook_cell row this state describes
from_stateTEXTfalsethe previous state (set to “INITIAL” when it’s the first transition)
to_stateTEXTfalsethe current state; if no rows exist it means no state transition occurred
transition_resultTEXTtrueif the result of state change is necessary for future use
transition_reasonTEXTtrueshort text or code explaining why the transition occurred
transitioned_atTIMESTAMPCURRENT_TIMESTAMPtruewhen the transition occurred
elaborationTEXTtrueany elaboration needed for the state transition
created_atTIMESTAMPCURRENT_TIMESTAMPtrue
created_byTEXT’UNKNOWN’true
updated_atTIMESTAMPtrue
updated_byTEXTtrue
deleted_atTIMESTAMPtrue
deleted_byTEXTtrue
activity_logTEXTtrue{“isSqlDomainZodDescrMeta”:true,“isJsonSqlDomain”:true}

Constraints

NameTypeDefinition
code_notebook_state_idPRIMARY KEYPRIMARY KEY (code_notebook_state_id)
- (Foreign key ID: 0)FOREIGN KEYFOREIGN KEY (code_notebook_cell_id) REFERENCES code_notebook_cell (code_notebook_cell_id) ON UPDATE NO ACTION ON DELETE NO ACTION MATCH NONE
sqlite_autoindex_code_notebook_state_2UNIQUEUNIQUE (code_notebook_cell_id, from_state, to_state)
sqlite_autoindex_code_notebook_state_1PRIMARY KEYPRIMARY KEY (code_notebook_state_id)
-CHECKCHECK(json_valid(transition_result) OR transition_result IS NULL)
-CHECKCHECK(json_valid(elaboration) OR elaboration IS NULL)

Indexes

NameDefinition
sqlite_autoindex_code_notebook_state_2UNIQUE (code_notebook_cell_id, from_state, to_state)
sqlite_autoindex_code_notebook_state_1PRIMARY KEY (code_notebook_state_id)

Relations

er