MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / __init__

Method __init__

keepercommander/storage/sqlite_dao.py:198–213  ·  view source on GitHub ↗
(self, get_connection, schema, owner=None)

Source from the content-addressed store, hash-verified

196
197class SqliteStorage:
198 def __init__(self, get_connection, schema, owner=None):
199 # type: (Callable[[], sqlite3.Connection], TableSchema, Union[str, int, None]) -> None
200 if not callable(get_connection):
201 raise ValueError(f'"get_connection" should be callable.')
202 self.get_connection = get_connection
203 if not isinstance(schema, TableSchema):
204 raise ValueError(f'"schema": Invalid type. TableSchema expected')
205 self.schema = schema
206 self.owner = None
207 if owner:
208 if not schema.owner_column:
209 raise ValueError(f'"owner": schema does not define owner column.')
210 if not isinstance(owner, schema.owner_column_type or str):
211 raise ValueError(f'"owner": Invalid type. {(schema.owner_column_type or str).__name__} expected')
212 self.owner = owner
213 self._queries = {} # type: Dict[str, str]
214
215 def _populate_data_object(self, values): # type: (Sequence[Any]) -> Any
216 obj = self.schema.class_type()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected