This pull request adds an autocommit parameter to the connect_to_mysql method, enabling users to toggle autocommit mode on MySQL connections. By setting autocommit=True, users can ensure the latest data changes in the database are reflected in their queries, solving an issue where cached results would appear even after data modifications.
Background
Some users have reported that query results returned by the Vanna application do not update immediately after data changes in the database. This is due to the default transaction behavior of MySQL when autocommit is set to False, which can lead to reading shadowed copies of data. The addition of the autocommit parameter provides a way to address this issue, allowing more accurate and timely data retrieval.
Changes Made
Added an autocommit parameter to the connect_to_mysql function (default: False for backward compatibility).
Updated the pymysql.connect function call to include autocommit=autocommit in the connection parameters.
Enabling autocommit ensures that the database fetches the most up-to-date records, improving the reliability and consistency of query results within the Vanna application.
This pull request adds an
autocommit
parameter to theconnect_to_mysql
method, enabling users to toggle autocommit mode on MySQL connections. By settingautocommit=True
, users can ensure the latest data changes in the database are reflected in their queries, solving an issue where cached results would appear even after data modifications.Background
Some users have reported that query results returned by the Vanna application do not update immediately after data changes in the database. This is due to the default transaction behavior of MySQL when
autocommit
is set toFalse
, which can lead to reading shadowed copies of data. The addition of theautocommit
parameter provides a way to address this issue, allowing more accurate and timely data retrieval.Changes Made
autocommit
parameter to theconnect_to_mysql
function (default:False
for backward compatibility).pymysql.connect
function call to includeautocommit=autocommit
in the connection parameters.Usage
Users can enable
autocommit
mode by calling:Enabling
autocommit
ensures that the database fetches the most up-to-date records, improving the reliability and consistency of query results within the Vanna application.