Skip to content

Commit

Permalink
Update base.py
Browse files Browse the repository at this point in the history
add reconnect mysql if the connection is closed
  • Loading branch information
mingminsun authored Jun 17, 2024
1 parent 56b782b commit 4ce62a6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/vanna/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,7 @@ def connect_to_mysql(
def run_sql_mysql(sql: str) -> Union[pd.DataFrame, None]:
if conn:
try:
conn.ping(reconnect=True)
cs = conn.cursor()
cs.execute(sql)
results = cs.fetchall()
Expand Down

0 comments on commit 4ce62a6

Please sign in to comment.