MCPcopy Create free account
hub / github.com/cisco/mindmeld / get

Method get

mindmeld/query_cache.py:203–224  ·  view source on GitHub ↗

Get a cached ProcessedQuery by id. Note: this call should never fail as it is required that the row_id exist in the database before this method is called. Exceptions may be thrown in the case of database corruption. The method caches the previously retrieved elemen

(self, row_id)

Source from the content-addressed store, hash-verified

201
202 @lru_cache(maxsize=1)
203 def get(self, row_id):
204 """
205 Get a cached ProcessedQuery by id. Note: this call should never fail as
206 it is required that the row_id exist in the database before this method
207 is called. Exceptions may be thrown in the case of database corruption.
208
209 The method caches the previously retrieved element because it is common
210 for a set of iterators (examples and labels) to retrieve the same row_id
211 in sequence. The cache prevents extra db lookups in this case.
212
213 Args:
214 row_id(integer): The unique id returned by QueryCache.key_to_row_id() or
215 QueryCache.put().
216 Returns:
217 ProcessedQuery: The ProcessedQuery associated with the identifier.
218 """
219 cursor = self.connection.cursor()
220 cursor.execute("""
221 SELECT query FROM queries WHERE rowid=(?);
222 """, (row_id,))
223 row = cursor.fetchone()
224 return ProcessedQuery.from_cache(json.loads(row[0]))
225
226 def get_value(self, domain, intent, query_text):
227 row_id = self.key_to_row_id(self.get_key(domain, intent, query_text))

Callers 15

get_valueMethod · 0.95
get_queryMethod · 0.95
get_entitiesMethod · 0.95
constants.pyFile · 0.45
create_augmentorMethod · 0.45
dvcFunction · 0.45
run_serverFunction · 0.45
converseFunction · 0.45
buildFunction · 0.45
evaluateFunction · 0.45
predictFunction · 0.45

Calls 2

executeMethod · 0.45
from_cacheMethod · 0.45

Tested by 15

test_status_endpointFunction · 0.36
test_durationFunction · 0.36
test_intervalFunction · 0.36
test_numberFunction · 0.36
test_ordinalFunction · 0.36
test_phone_numberFunction · 0.36
test_credit_cardFunction · 0.36
test_temperatureFunction · 0.36
test_timeFunction · 0.36
_firstMethod · 0.36