From c22979f3024736261ea85719beaa8dd77d7718a9 Mon Sep 17 00:00:00 2001 From: ncclementi Date: Sun, 15 Sep 2024 13:58:27 -0400 Subject: [PATCH] chore: address review comments --- ibis/backends/mysql/__init__.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ibis/backends/mysql/__init__.py b/ibis/backends/mysql/__init__.py index f062574e1a91..664a1eff1da8 100644 --- a/ibis/backends/mysql/__init__.py +++ b/ibis/backends/mysql/__init__.py @@ -13,7 +13,7 @@ import pymysql import sqlglot as sg import sqlglot.expressions as sge -from pymysql.constants.ER import NO_SUCH_TABLE +from pymysql.constants import ER from pymysql.err import ProgrammingError import ibis @@ -224,12 +224,10 @@ def get_schema( ).sql(self.dialect) with self.begin() as cur: - query = sge.Describe(this=table).sql(self.dialect) - try: - cur.execute(query) + cur.execute(sge.Describe(this=table).sql(self.dialect)) except ProgrammingError as e: - if e.args[0] == NO_SUCH_TABLE: + if e.args[0] == ER.NO_SUCH_TABLE: raise com.TableNotFound(name) from e else: result = cur.fetchall() @@ -481,7 +479,7 @@ def _in_memory_table_exists(self, name: str) -> bool: cur.fetchall() except pymysql.err.ProgrammingError as e: err_code, _ = e.args - if err_code == NO_SUCH_TABLE: + if err_code == ER.NO_SUCH_TABLE: return False raise else: