Skip to content

Commit d5eb49c

Browse files
Update Hybrid_RAG_Test_Vedant/gemini_sql_router.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent e285d36 commit d5eb49c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Hybrid_RAG_Test_Vedant/gemini_sql_router.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ def query_all_cities_ranked(self):
9090

9191
def query_by_state(self, state_name):
9292
"""Query cities in a specific state"""
93-
query = f"SELECT city_name, population, state FROM city_stats WHERE state LIKE '%{state_name}%' ORDER BY population DESC"
94-
return self.execute_query(query)
95-
93+
query_text = text("SELECT city_name, population, state "
94+
"FROM city_stats WHERE state LIKE :state_name "
95+
"ORDER BY population DESC")
96+
return self.execute_query(query_text.params(state_name=f'%{state_name}%'))
9697
def process_population_query(self, query_text):
9798
"""Process a natural language query about population"""
9899
query_lower = query_text.lower()

0 commit comments

Comments
 (0)