kodexa.model.persistence
Module Contents
Classes
The Sqlite persistence engine to support large scale documents (part of the V4 Kodexa Document Architecture) |
|
A simple cache based on ID'd objects, where we will build ID's for new |
|
The persistence manager supports holding the document and only flushing objects to the persistence layer |
Attributes
- kodexa.model.persistence.logger
- kodexa.model.persistence.EXCEPTION_INSERT = INSERT INTO content_exceptions (tag, message, exception_details, group_uuid, tag_uuid,...
- kodexa.model.persistence.FEATURE_INSERT = INSERT INTO ft (id, cn_id, f_type, binary_value, single, tag_uuid) VALUES (?,?,?,?,?,?)
- kodexa.model.persistence.FEATURE_DELETE = DELETE FROM ft where cn_id=? and f_type=?
- kodexa.model.persistence.CONTENT_NODE_INSERT = INSERT INTO cn (pid, nt, idx) VALUES (?,?,?)
- kodexa.model.persistence.CONTENT_NODE_UPDATE = UPDATE cn set pid=?, nt=?, idx=? WHERE id=?
- kodexa.model.persistence.CONTENT_NODE_PART_INSERT = INSERT INTO cnp (cn_id, pos, content, content_idx) VALUES (?,?,?,?)
- kodexa.model.persistence.NOTE_TYPE_INSERT = insert into n_type(name) values (?)
- kodexa.model.persistence.NODE_TYPE_LOOKUP = select id from n_type where name = ?
- kodexa.model.persistence.FEATURE_TYPE_INSERT = insert into f_type(name) values (?)
- kodexa.model.persistence.FEATURE_TYPE_LOOKUP = select id from f_type where name = ?
- kodexa.model.persistence.METADATA_INSERT = insert into metadata(id,metadata) values (1,?)
- kodexa.model.persistence.METADATA_DELETE = delete from metadata where id=1
- class kodexa.model.persistence.SqliteDocumentPersistence(document: kodexa.model.Document, filename: str = None, delete_on_close=False)
Bases:
objectThe Sqlite persistence engine to support large scale documents (part of the V4 Kodexa Document Architecture)
- get_all_tags()
select * from cn where id in (select cn_id from ft where f_type in (select id from f_type where name like ‘tag:%’))
- update_features(node)
- update_node(node)
- get_content_nodes(node_type, parent_node: kodexa.model.ContentNode, include_children)
- initialize()
- close()
- get_max_feature_id()
- __build_db()
- content_node_count()
- get_feature_type_id(feature)
- __resolve_f_type(feature)
- __resolve_n_type(n_type)
- __insert_node(node: kodexa.model.ContentNode, parent, execute=True)
- __clean_none_values(d)
- __update_metadata()
- __load_document()
- get_content_parts(new_node)
- __build_node(node_row)
- add_content_node(node, parent, execute=True)
- remove_feature(node, feature_type, name)
- get_children(content_node)
- get_child_ids(content_node)
- get_node(node_id)
- get_parent(content_node)
- update_metadata()
- __rebuild_from_document()
- sync()
- get_bytes()
- get_features(node)
- update_content_parts(node, content_parts)
- remove_content_node(node)
- remove_all_features(node)
- remove_all_features_by_id(node_id)
- get_next_node_id()
- get_tagged_nodes(tag, tag_uuid=None)
- add_exception(exception: kodexa.model.model.ContentException)
- class kodexa.model.persistence.SimpleObjectCache
Bases:
objectA simple cache based on ID’d objects, where we will build ID’s for new objects, store them and also a dirty flag so that it is easy to pull all dirty objects and store them as needed
- get_obj(obj_id)
- add_obj(obj)
- remove_obj(obj)
- get_dirty_objs()
- undirty(obj)
- class kodexa.model.persistence.PersistenceManager(document: kodexa.model.Document, filename: str = None, delete_on_close=False)
Bases:
objectThe persistence manager supports holding the document and only flushing objects to the persistence layer as needed.
This is implemented to allow us to work with large complex documents in a performance centered way.
- add_exception(exception: kodexa.model.model.ContentException)
- get_all_tags()
- get_tagged_nodes(tag, tag_uuid=None)
- initialize()
- get_parent(node)
- close()
- flush_cache()
- get_content_nodes(node_type, parent_node, include_children)
- get_bytes()
- update_metadata()
- add_content_node(node, parent)
- get_node(node_id)
- remove_content_node(node)
- get_children(node)
- update_node(node)
- update_content_parts(node, content_parts)
- get_content_parts(node)
- remove_feature(node, feature_type, name)
- get_features(node)
- add_feature(node, feature)