Skip to content

Commit

Permalink
Second attempt: add searchGroup function to MySQL script
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenstyffe committed Apr 18, 2019
1 parent 3895172 commit 1aba340
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Infrastructure/Python/mysql_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,3 +555,18 @@ def postRequest(user_id, group_id):
connection.close()
return 0

def searchGroup(name):
connection = pymysql.connect(host='35.185.248.192', user='Stephen', password='StephenSEProject', db='app_db', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor)
cursor = connection.cursor()

selectStatement = "select LeaderID, GroupColor, GroupDescription from `record` where GroupName = %s;"

try:
cursor.execute(selectStatement, (name))
result = cursor.fetchall()
connection.close()
return result
except:
connection.close()
return 0

0 comments on commit 1aba340

Please sign in to comment.