# SQL query and slots values

**URL:** <https://forum.rasa.com/t/sql-query-and-slots-values/41864>\
**Category:** Rasa Open Source\
**Created:** [March 30, 2021, 8:48am UTC](https://forum.rasa.com/t/sql-query-and-slots-values/41864 "2021-03-30T08:48:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![M\_Salamin](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@M\_Salamin](https://forum.rasa.com/u/M_Salamin)\
**Post date:** [March 30, 2021, 8:48am UTC](https://forum.rasa.com/t/sql-query-and-slots-values/41864/1 "2021-03-30T08:48:33Z")

</div>

Hello. I have this code embedded with custom actions, it works fine until it reaches to the query line

> conn = mysql.connector.connect(host=“localhost”,
> 
> > 
> 
> - 
> 
> ```
> port="3306",
> 
> ```
> 
> > 
> 
> - 
> 
> ```
> user="root",
> 
> ```
> 
> > 
> 
> - 
> 
> ```
> password="",
> 
> ```
> 
> > 
> 
> - 
> 
> ```
> database="chatbot_db")
> 
> ```
> 
> > 
> 
> - 
> 
> ```
> mycursor = conn.cursor()
> 
> ```
> 
> > 
> 
> - 
> 
> ```
> branch_tawjihi=tracker.get_slot("branch_of_tawjihi")
> 
> ```
> 
> > 
> 
> - 
> 
> ```
> mark_branch=tracker.get_slot("mark_of_branch")
> 
> ```
> 
> > 
> 
> - 
> 
> ```
> print("\n\n"+branch_tawjihi+"\n\n"+mark_branch+"\n\n"+"before query execution\n")
> 
> ```
> 
> > 
> 
> - 
> 
> ```
> mycursor.execute("""SELECT major_name FROM chatbot_db.majors WHERE 
> 
> ```
> 
> > 
> 
> - 
> 
> ```
> min_gpa<={mark} AND tawjihi_branch LIKE {branch}""".format
> 
> ```
> 
> > 
> 
> - 
> 
> ```
> (mark = float(mark_branch), branch = branch_tawjihi))
> 
> ```
> 
> > 
> 
> - 
> 
> ```
> result= mycursor.fetchall()
> 
> ```
> 
> > 
> 
> - 
> 
> ```
> print("after query and before loop")
> 
> ```
> 
> > 
> 
> - 
> 
> ```
> print(text=(result))
> 
> ```

the slots values are printed but then as i mentioned above, it goes to the except and show failure message. I also tried to give static data in the query but nothing changes. glad to any help…
