From commits-return-1097-archive-asf-public=cust-asf.ponee.io@superset.incubator.apache.org Mon Jun 18 17:42:13 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id EC953180663 for ; Mon, 18 Jun 2018 17:42:12 +0200 (CEST) Received: (qmail 11369 invoked by uid 500); 18 Jun 2018 15:42:12 -0000 Mailing-List: contact commits-help@superset.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@superset.incubator.apache.org Delivered-To: mailing list commits@superset.incubator.apache.org Received: (qmail 11360 invoked by uid 99); 18 Jun 2018 15:42:12 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jun 2018 15:42:12 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 4BCC4829D4; Mon, 18 Jun 2018 15:42:11 +0000 (UTC) Date: Mon, 18 Jun 2018 15:42:11 +0000 To: "commits@superset.apache.org" Subject: [incubator-superset] branch master updated: [sql lab] quote schema and table name (#5195) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <152933653111.2878.3648476521229702382@gitbox.apache.org> From: maximebeauchemin@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: incubator-superset X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: ccf211036d411f4e6f1f10505a92b6ce590f0e00 X-Git-Newrev: c89933d870fe2df7512114581c25cbdbe66cf9e0 X-Git-Rev: c89933d870fe2df7512114581c25cbdbe66cf9e0 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. maximebeauchemin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-superset.git The following commit(s) were added to refs/heads/master by this push: new c89933d [sql lab] quote schema and table name (#5195) c89933d is described below commit c89933d870fe2df7512114581c25cbdbe66cf9e0 Author: Maxime Beauchemin AuthorDate: Mon Jun 18 08:42:08 2018 -0700 [sql lab] quote schema and table name (#5195) fixes https://github.com/apache/incubator-superset/issues/4595 --- superset/db_engine_specs.py | 9 +++++++-- superset/models/core.py | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py index eb3b368..94f957b 100644 --- a/superset/db_engine_specs.py +++ b/superset/db_engine_specs.py @@ -275,7 +275,7 @@ class BaseEngineSpec(object): return False @classmethod - def select_star(cls, my_db, table_name, schema=None, limit=100, + def select_star(cls, my_db, table_name, engine, schema=None, limit=100, show_cols=False, indent=True, latest_partition=True, cols=None): fields = '*' @@ -286,9 +286,14 @@ class BaseEngineSpec(object): if show_cols: fields = [sqla.column(c.get('name')) for c in cols] full_table_name = table_name + quote = engine.dialect.identifier_preparer.quote if schema: - full_table_name = schema + '.' + table_name + full_table_name = quote(schema) + '.' + quote(table_name) + else: + full_table_name = quote(table_name) + qry = select(fields).select_from(text(full_table_name)) + if limit: qry = qry.limit(limit) if latest_partition: diff --git a/superset/models/core.py b/superset/models/core.py index ebce5fc..4674520 100644 --- a/superset/models/core.py +++ b/superset/models/core.py @@ -720,8 +720,10 @@ class Database(Model, AuditMixinNullable, ImportMixin): self, table_name, schema=None, limit=100, show_cols=False, indent=True, latest_partition=True, cols=None): """Generates a ``select *`` statement in the proper dialect""" + eng = self.get_sqla_engine(schema=schema) return self.db_engine_spec.select_star( - self, table_name, schema=schema, limit=limit, show_cols=show_cols, + self, table_name, schema=schema, engine=eng, + limit=limit, show_cols=show_cols, indent=indent, latest_partition=latest_partition, cols=cols) def apply_limit_to_sql(self, sql, limit=1000): -- To stop receiving notification emails like this one, please contact maximebeauchemin@apache.org.