MCPcopy Create free account
hub / github.com/BIT-DataLab/LakeBench / get_session

Method get_session

join/LSH/datasketch/storage.py:272–292  ·  view source on GitHub ↗
(cls, seeds, **kwargs)

Source from the content-addressed store, hash-verified

270
271 @classmethod
272 def get_session(cls, seeds, **kwargs):
273 _ = kwargs
274 keyspace = kwargs["keyspace"]
275 replication = kwargs["replication"]
276
277 if cls.__session is None:
278 # Allow dependency injection
279 session = kwargs.get("session")
280 if session is None:
281 cluster = c_cluster.Cluster(seeds)
282 session = cluster.connect()
283 cls.__session = session
284 if cls.__session.keyspace != keyspace:
285 if kwargs.get("drop_keyspace", False):
286 cls.__session.execute(cls.QUERY_DROP_KEYSPACE.format(keyspace))
287 cls.__session.execute(cls.QUERY_CREATE_KEYSPACE.format(
288 keyspace=keyspace,
289 replication=str(replication),
290 ))
291 cls.__session.set_keyspace(keyspace)
292 return cls.__session
293
294 @classmethod
295 def get_buffer(cls):

Callers 1

__init__Method · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected