From 8f5ef4aab33b618ef2f6e2edd7fa84a2b4b445a6 Mon Sep 17 00:00:00 2001 From: Lan Zagar Date: Fri, 7 Jul 2017 14:12:00 +0200 Subject: [PATCH 1/2] SqlTable: Fix check for select query to be case-insensitive --- Orange/data/sql/table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Orange/data/sql/table.py b/Orange/data/sql/table.py index d8dd5096a03..54486ab9a06 100644 --- a/Orange/data/sql/table.py +++ b/Orange/data/sql/table.py @@ -86,7 +86,7 @@ def __init__( if table_or_sql is not None: if isinstance(table_or_sql, TableDesc): table = table_or_sql.sql - elif "SELECT" in table_or_sql: + elif "select" in table_or_sql.lower(): table = "(%s) as my_table" % table_or_sql.strip("; ") else: table = self.backend.quote_identifier(table_or_sql) From f88f2fd0ccf7dd7aac71becc0ee32d95a2bf5beb Mon Sep 17 00:00:00 2001 From: Lan Zagar Date: Fri, 7 Jul 2017 14:12:56 +0200 Subject: [PATCH 2/2] owsql: Catch the new BackendError too (avoids crash) --- Orange/widgets/data/owsql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Orange/widgets/data/owsql.py b/Orange/widgets/data/owsql.py index 89b54849450..52f352eb3ec 100644 --- a/Orange/widgets/data/owsql.py +++ b/Orange/widgets/data/owsql.py @@ -271,7 +271,7 @@ def get_table(self): with self.backend.execute_sql_query("ANALYZE " + self.materialize_table_name): pass self.table = self.materialize_table_name - except psycopg2.ProgrammingError as ex: + except (psycopg2.ProgrammingError, BackendError) as ex: self.Error.connection(str(ex)) return