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_manybqueryRemove all annotations from the store.
closecommitGet the list of options that sqlite3 was compiled with.
Create an SQLite expression index based on the provided predicate.
Deserialise a geometry from a string or bytes.
Drop an index from the store.
dumpdumpsfeaturesReturns a list of the names of all indexes in the store.
iqueryitemskeysopenOptimize the database with VACUUM and ANALYZE.
patch_manyqueryremove_manySerialise a geometry to WKB with optional compression.
to_dataframevalues- Parameters
connection (Union[pathlib.Path, str, IO]) –
- 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
- create_index(name, where, analyze=True)[source]¶
Create an SQLite expression index based on the provided predicate.
Note that an expression index will only be used if the query expression (in the WHERE clause) exactly matches the expression used when creating the index (excluding minor inconsequential changes such as whitespace).
SQLite expression indexes require SQLite version 3.9.0 or higher.
- drop_index(name)[source]¶
Drop an index from the store.
- Parameters
name (str) – The name of the index to drop.
- Return type
None
- indexes()[source]¶
Returns a list of the names of all indexes in the store.
- Returns
The list of index names.
- Return type
List[str]
- optimize(vacuum=True, limit=1000)[source]¶
Optimize the database with VACUUM and ANALYZE.
- Parameters
vacuum (bool) – Whether to run VACUUM.
limit (int) – The approximate maximum number of rows to examine when running ANALYZE. If zero or negative, not limit will be used. For more information see https://www.sqlite.org/pragma.html#pragma_analysis_limit.
- Return type
None