MCPcopy Create free account
hub / github.com/caesarHQ/textSQL / get_featured_sql

Function get_featured_sql

api/app/api/utils/cached_queries/featured_queries.py:36–64  ·  view source on GitHub ↗
(input_str, scope="USA")

Source from the content-addressed store, hash-verified

34 return related_tables
35
36def get_featured_sql(input_str, scope="USA"):
37
38 if not EVENTS_ENGINE:
39 return False
40
41 params = {
42 "input_text": input_str,
43 "scope": scope
44 }
45 query = text("""
46 SELECT * FROM featured_queries
47 WHERE input_text ilike :input_text
48 AND app = :scope
49 """)
50
51 try:
52 with EVENTS_ENGINE.connect() as conn:
53 result = conn.execute(query, params)
54 conn.commit()
55 res = result.fetchall()
56 except Exception as e:
57 return False
58
59 if len(res) == 0:
60 return False
61
62 related_sql = res[0][2]
63
64 return related_sql

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected