(input_str, scope="USA")
| 34 | return related_tables |
| 35 | |
| 36 | def 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 |
nothing calls this directly
no outgoing calls
no test coverage detected