diff --git a/pyproject.toml b/pyproject.toml index 8ce4a2a..7027b38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ build-backend = "pdm.backend" [project] name = "qnnpy" -version = "0.1.15" +version = "0.1.16" authors = [ { name="O. Medeiros", email="omedeiro@mit.edu" }, diff --git a/src/qnnpy/functions/functions.py b/src/qnnpy/functions/functions.py index 39e291b..22201cb 100644 --- a/src/qnnpy/functions/functions.py +++ b/src/qnnpy/functions/functions.py @@ -713,14 +713,14 @@ def database_connection(**kwargs) -> Connection: def log_data_to_database(table_name: str, connection=None, **kwargs): if connection is None: - conn = database_connection() - cur = conn.cursor() + connection = database_connection() + cur = connection.cursor() column_names = "`" + "`, `".join(kwargs.keys()) + "`" values = "'" + "', '".join([str(v) for v in kwargs.values()]) + "'" command = "INSERT INTO `%s` (%s) VALUES (%s)" % (table_name, column_names, values) cur.execute(command) - conn.commit() - conn.close() + connection.commit() + connection.close() def update_table(