API¶ log module-attribute ¶ log = get_logger('ogc') model_as_pickle ¶ model_as_pickle(obj: object) -> bytes Converts model object to bytes Source code in ogc/db.py 16 17 18 19def model_as_pickle(obj: object) -> bytes: """Converts model object to bytes""" output: bytes = dill.dumps(obj) return output pickle_to_model ¶ pickle_to_model(obj: bytes) -> t.Any Converts pickled bytes to object Source code in ogc/db.py 22 23 24def pickle_to_model(obj: bytes) -> t.Any: """Converts pickled bytes to object""" return dill.loads(obj) connect ¶ connect() -> SqliteExtDatabase Get the associated database file Returns: Type Description SqliteExtDatabase Connection to sqlite database Source code in ogc/db.py 27 28 29 30 31 32 33 34 35 36 37def connect() -> SqliteExtDatabase: """Get the associated database file Returns: Connection to sqlite database """ p = Path(__file__).cwd() / ".ogc-cache" p.mkdir(parents=True, exist_ok=True) return SqliteExtDatabase( str(p / "data.db"), pragmas=(("journal_mode", "wal"), ("foreign_keys", 1)) ) cache_path ¶ cache_path() -> Path Returns where to store files Source code in ogc/db.py 40 41 42 43 44def cache_path() -> Path: """Returns where to store files""" p = Path(__file__).cwd() / ".ogc-cache/nodes" p.mkdir(parents=True, exist_ok=True) return p