From d138e3bca09d3fa996873278050a8a0268712c0b Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" Date: Thu, 5 Apr 2018 02:27:13 -0500 Subject: [PATCH 1/2] Suppress MySQL mode related warnings --- datajoint/connection.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/datajoint/connection.py b/datajoint/connection.py index 424aa9745..943099355 100644 --- a/datajoint/connection.py +++ b/datajoint/connection.py @@ -89,10 +89,12 @@ def connect(self): """ Connects to the database server. """ - self._conn = client.connect(init_command=self.init_fun, - sql_mode="NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO," - "STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION", - **self.conn_info) + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + self._conn = client.connect(init_command=self.init_fun, + sql_mode="NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO," + "STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION", + **self.conn_info) def register(self, schema): self.schemas[schema.database] = schema From ce519aa2842d3601754b089dd9729e2a13b41e68 Mon Sep 17 00:00:00 2001 From: "Edgar Y. Walker" Date: Thu, 5 Apr 2018 14:41:31 -0500 Subject: [PATCH 2/2] Only suppress deprecation warning at MySQL connection --- datajoint/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datajoint/connection.py b/datajoint/connection.py index 943099355..4e393457f 100644 --- a/datajoint/connection.py +++ b/datajoint/connection.py @@ -90,7 +90,7 @@ def connect(self): Connects to the database server. """ with warnings.catch_warnings(): - warnings.simplefilter("ignore") + warnings.filterwarnings('ignore', '.*deprecated.*') self._conn = client.connect(init_command=self.init_fun, sql_mode="NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO," "STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION",