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

Method __init__

keepercommander/storage/sqlite.py:47–63  ·  view source on GitHub ↗
(self, get_connection, schema, owner=None)

Source from the content-addressed store, hash-verified

45
46class SqliteLinkStorage(sqlite_dao.SqliteStorage, ILinkStorage):
47 def __init__(self, get_connection, schema, owner=None):
48 # type: (Callable[[], sqlite3.Connection], sqlite_dao.TableSchema, Union[str, int, None]) -> None
49
50 super(SqliteLinkStorage, self).__init__(get_connection, schema, owner)
51 if len(self.schema.primary_key) != 2:
52 raise ValueError('SqliteLinkStorage: Primary key to have two columns.')
53
54 object_column = self.schema.primary_key[1]
55 object_index_name = None
56 if self.schema.indexes:
57 for index_name, index_columns in self.schema.indexes.items():
58 if index_columns[0].lower() == object_column.lower():
59 object_index_name = index_name
60 break
61 if not object_index_name:
62 raise ValueError(
63 f'SqliteLinkStorage: Object UID column "{object_column}"is not indexed in table "{schema.table_name}".')
64
65 def put_links(self, links):
66 self.put(links)

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected