IPython Documentation

Table Of Contents

Previous topic

Module: html.services.sessions.handlers

Next topic

Module: html.terminal

This Page

Note

This documentation is for a development version of IPython. There may be significant differences from the latest stable release.

Module: html.services.sessions.sessionmanager

A base class session manager.

1 Class

class IPython.html.services.sessions.sessionmanager.SessionManager(**kwargs)

Bases: IPython.config.configurable.LoggingConfigurable

connection

Start a database connection

create_session(path=None, kernel_name=None)

Creates a session and returns its model

cursor

Start a cursor and create a database called ‘session’

delete_session(session_id)

Deletes the row in the session database with given session_id

get_session(**kwargs)

Returns the model for a particular session.

Takes a keyword argument and searches for the value in the session database, then returns the rest of the session’s info.

Parameters:

**kwargs : keyword argument

must be given one of the keywords and values from the session database (i.e. session_id, path, kernel_id)

Returns:

model : dict

returns a dictionary that includes all the information from the session described by the kwarg.

list_sessions()

Returns a list of dictionaries containing all the information from the session database

new_session_id()

Create a uuid for a new session

row_to_model(row)

Takes sqlite database session row and turns it into a dictionary

save_session(session_id, path=None, kernel_id=None)

Saves the items for the session with the given session_id

Given a session_id (and any other of the arguments), this method creates a row in the sqlite session database that holds the information for a session.

Parameters:

session_id : str

uuid for the session; this method must be given a session_id

path : str

the path for the given notebook

kernel_id : str

a uuid for the kernel associated with this session

Returns:

model : dict

a dictionary of the session model

session_exists(path)

Check to see if the session for a given notebook exists

update_session(session_id, **kwargs)

Updates the values in the session database.

Changes the values of the session with the given session_id with the values from the keyword arguments.

Parameters:

session_id : str

a uuid that identifies a session in the sqlite3 database

**kwargs : str

the key must correspond to a column title in session database, and the value replaces the current value in the session with session_id.