dissect.database.sqlite3.sqlite3¶
Module Contents¶
Classes¶
Functions¶
Attributes¶
- dissect.database.sqlite3.sqlite3.ENCODING¶
- dissect.database.sqlite3.sqlite3.PAGE_TYPES¶
- dissect.database.sqlite3.sqlite3.SERIAL_TYPES¶
- dissect.database.sqlite3.sqlite3.SQLITE3_HEADER_MAGIC = b'SQLite format 3\x00'¶
- class dissect.database.sqlite3.sqlite3.SQLite3(fh: pathlib.Path | BinaryIO, wal: dissect.database.sqlite3.wal.WAL | pathlib.Path | BinaryIO | None = None, checkpoint: dissect.database.sqlite3.wal.Checkpoint | int | None = None)¶
SQLite3 database class.
Loads a SQLite3 database from the given file-like object or path. If a path is provided (or can be deduced from the file-like object), a WAL file will be automatically looked for with a few common suffixes. Optionally a WAL file-like object or path can be directly provided to read changes from the WAL (this takes priority over the aforementioned WAL lookup). Additionally, a specific checkpoint from the WAL can be applied.
- Parameters:
fh – The path or file-like object to open a SQLite3 database on.
wal – The path or file-like object to open a SQLite3 WAL file on.
checkpoint – The checkpoint to apply from the WAL file. Can be a
Checkpointobject or an integer index.
- Raises:
InvalidDatabase – If the file-like object does not look like a SQLite3 database based on the header magic.
References
- fh¶
- path¶
- wal = None¶
- checkpoint = None¶
- header¶
- encoding¶
- page_size¶
- usable_page_size¶
- page_count¶
- page¶
- __repr__() str¶
- __enter__() Self¶
Return
selfupon entering the runtime context.
- __exit__(_: type[BaseException] | None, __: BaseException | None, ___: types.TracebackType | None) bool¶
- close() None¶
Close the database and WAL.
- checkpoints() collections.abc.Iterator[SQLite3]¶
Yield instances of the database at all available checkpoints in the WAL file, if applicable.
- raw_page(num: int) bytes¶
Retrieve the raw frame data for the given page number.
Reads the page from a checkpoint, if this class was initialized with a WAL checkpoint.
If a WAL is available, will first check if the WAL contains a more recent version of the page, otherwise it will read the page from the database file.
References
- class dissect.database.sqlite3.sqlite3.Column(name: str, description: str)¶
Describes a column of a sqlite table.
- SPACE = '\\s'¶
- EXPRESSION = '\\(.+?\\)'¶
- STRING = '[\'\\"].+?[\'\\"]'¶
- TOKENIZER_EXPRESSION¶
- name¶
- default_value = None¶
- __eq__(other: object) bool¶
- __repr__() str¶
- class dissect.database.sqlite3.sqlite3.Table(sqlite: SQLite3, type_: str, name: str, table_name: str, page: int, sql: str)¶
- sqlite¶
- type¶
- name¶
- table_name¶
- page¶
- sql¶
- columns = []¶
- primary_key = None¶
- __repr__() str¶
- class dissect.database.sqlite3.sqlite3.Index(sqlite: SQLite3, type_: str, name: str, table_name: str, page: int, sql: str)¶
- sqlite¶
- type¶
- name¶
- table_name¶
- page¶
- sql¶
- __repr__() str¶
- class dissect.database.sqlite3.sqlite3.Row(table: Table, cell: Cell)¶
- __iter__() collections.abc.Iterator[tuple[str, Any]]¶
- __getitem__(key: str) Any¶
- __getattr__(key: str) Any¶
- __repr__() str¶
- get(key: str, default: Any = None) Any¶
- class dissect.database.sqlite3.sqlite3.Empty¶
- class dissect.database.sqlite3.sqlite3.Page(sqlite: SQLite3, num: int)¶
- sqlite¶
- num¶
- data¶
- offset¶
- header¶
- right_page = None¶
- cell_pointers¶
- cell¶
- __repr__() str¶
- open() io.BytesIO¶
- class dissect.database.sqlite3.sqlite3.Cell(page: Page, offset: int)¶
- page¶
- offset¶
- size = None¶
- key = None¶
- left_page = None¶
- max_payload_size¶
- min_payload_size¶
- __repr__() str¶
- property types: list[int]¶
- dissect.database.sqlite3.sqlite3.walk_tree(sqlite: SQLite3, page: Page) collections.abc.Iterator[Cell]¶
- dissect.database.sqlite3.sqlite3.read_record(fh: BinaryIO, encoding: str) tuple[list[int], list[int | float | str | bytes | None]]¶
- dissect.database.sqlite3.sqlite3.varint(fh: BinaryIO) int¶