SQLiteStore

class SQLiteStore(connection=':memory:', compression='zlib', compression_level=9)[source]

SQLite backed annotation store.

Uses and rtree index for fast spatial queries.

Methods

append_many

clear

Remove all annotations from the store.

close

commit

compile_options

Get the list of options that sqlite3 was compiled with.

deserialise_geometry

Deserialise a geometry from a string or bytes.

dump

dumps

features

iquery

items

keys

open

patch_many

query

remove_many

serialise_geometry

Serialise a geometry to WKB with optional compression.

to_dataframe

values

Parameters

connection (Union[pathlib.Path, str]) –

Return type

None

clear()[source]

Remove all annotations from the store.

Return type

None

static compile_options()[source]

Get the list of options that sqlite3 was compiled with.

Example

>>> for opt in SQLiteRTreeStore.compile_options():
>>>     print(opt)
COMPILER=gcc-7.5.0
ENABLE_COLUMN_METADATA
ENABLE_DBSTAT_VTAB
ENABLE_FTS3
ENABLE_FTS3_PARENTHESIS
ENABLE_FTS3_TOKENIZER
ENABLE_FTS4
ENABLE_FTS5
ENABLE_JSON1
ENABLE_LOAD_EXTENSION
ENABLE_PREUPDATE_HOOK
ENABLE_RTREE
ENABLE_SESSION
ENABLE_STMTVTAB
ENABLE_UNLOCK_NOTIFY
ENABLE_UPDATE_DELETE_LIMIT
HAVE_ISNAN
LIKE_DOESNT_MATCH_BLOBS
MAX_SCHEMA_RETRY=25
MAX_VARIABLE_NUMBER=250000
OMIT_LOOKASIDE
SECURE_DELETE
SOUNDEX
TEMP_STORE=1
THREADSAFE=1
Return type

List[str]

deserialise_geometry(data)[source]

Deserialise a geometry from a string or bytes.

Parameters

data (bytes or str) – The serialised representation of a Shapely geometry.

Returns

The deserialised Shapely geometry.

Return type

Geometry

serialise_geometry(geometry)[source]

Serialise a geometry to WKB with optional compression.

Converts shapely geometry objects to well-known binary (WKB) and applies optional compression.

Parameters

geometry (Geometry) – The Shapely geometry to be serialised.

Returns

The serialised geometry.

Return type

bytes or str