History Backend Sqlite – xonsh.history.sqlite

Implements the xonsh history backend via sqlite3.

class xonsh.history.sqlite.SqliteHistory(gc=True, filename=None, **kwargs)[source]

Xonsh history backend implemented with sqlite3.

Represents a xonsh session’s history.

sessionidint, uuid, str, optional

Current session identifier, will generate a new sessionid if not set.

all_items(newest_first=False, session_id=None)[source]

Display all history items.


Append a command item into history.

cmd: dict

This dict contains information about the command that is to be added to the history list. It should contain the keys inp, rtn and ts. These key names mirror the same names defined as instance variables in the HistoryEntry class.


A collection of information about the shell history.

dict or collections.OrderedDict

Contains history information as str key pairs.


Display history items of current session.

run_gc(size=None, blocking=True)[source]

Run the garbage collector.

size: None or tuple of a int and a string

Determines the size and units of what would be allowed to remain.

blocking: bool

If set blocking, then wait until gc action finished.

class xonsh.history.sqlite.SqliteHistoryGC(wait_for_shell=True, size=None, filename=None, *args, **kwargs)[source]

Shell history garbage collection.

Thread responsible for garbage collecting old history.

May wait for shell (and for xonshrc to have been loaded) to start work.


Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.