Skip to content

Orchestration Session State

Description

Records the state of an orchestration session, 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 stateful). Other Kernels might store results for functions and output defined in one cell can be used in later cells.

Table Definition
CREATE TABLE "orchestration_session_state" (
"orchestration_session_state_id" VARCHAR PRIMARY KEY NOT NULL,
"session_id" VARCHAR NOT NULL,
"session_entry_id" VARCHAR,
"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" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
"elaboration" TEXT CHECK(json_valid(elaboration) OR elaboration IS NULL),
FOREIGN KEY("session_id") REFERENCES "orchestration_session"("orchestration_session_id"),
FOREIGN KEY("session_entry_id") REFERENCES "orchestration_session_entry"("orchestration_session_entry_id"),
UNIQUE("orchestration_session_state_id", "from_state", "to_state")
)

Columns

NameTypeDefaultNullableParentsComment
orchestration_session_state_idVARCHARfalseorchestration_session_state primary key
session_idVARCHARfalseorchestration_sessionorchestration_session row this state describes
session_entry_idVARCHARtrueorchestration_session_entryorchestration_session_entry row this state describes (optional)
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_atTIMESTAMPTZCURRENT_TIMESTAMPtruewhen the transition occurred
elaborationTEXTtrueany elaboration needed for the state transition

Constraints

NameTypeDefinition
orchestration_session_state_idPRIMARY KEYPRIMARY KEY (orchestration_session_state_id)
- (Foreign key ID: 0)FOREIGN KEYFOREIGN KEY (session_entry_id) REFERENCES orchestration_session_entry (orchestration_session_entry_id) ON UPDATE NO ACTION ON DELETE NO ACTION MATCH NONE
- (Foreign key ID: 1)FOREIGN KEYFOREIGN KEY (session_id) REFERENCES orchestration_session (orchestration_session_id) ON UPDATE NO ACTION ON DELETE NO ACTION MATCH NONE
sqlite_autoindex_orchestration_session_state_2UNIQUEUNIQUE (orchestration_session_state_id, from_state, to_state)
sqlite_autoindex_orchestration_session_state_1PRIMARY KEYPRIMARY KEY (orchestration_session_state_id)
-CHECKCHECK(json_valid(transition_result) OR transition_result IS NULL)
-CHECKCHECK(json_valid(elaboration) OR elaboration IS NULL)

Indexes

NameDefinition
sqlite_autoindex_orchestration_session_state_2UNIQUE (orchestration_session_state_id, from_state, to_state)
sqlite_autoindex_orchestration_session_state_1PRIMARY KEY (orchestration_session_state_id)

Relations

er