From: Alessio Bogon Date: Sun, 1 Sep 2019 11:30:36 +0000 (+0200) Subject: Improve naming, do not lint unhandled types X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f41448612490bedc2826be8656a43699c232f3a5;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Improve naming, do not lint unhandled types --- diff --git a/lib/sqlalchemy/ext/linter.py b/lib/sqlalchemy/ext/linter.py index 549127f8b8..4e53b0b164 100644 --- a/lib/sqlalchemy/ext/linter.py +++ b/lib/sqlalchemy/ext/linter.py @@ -9,9 +9,7 @@ from sqlalchemy.sql.expression import Select def before_execute_hook(conn, clauseelement, multiparams, params): if isinstance(clauseelement, Select): - warn_for_cartesian(clauseelement) - else: - raise NotImplementedError + lint(clauseelement) def find_unmatching_froms(element, start_with=None): @@ -86,14 +84,19 @@ def find_unmatching_froms(element, start_with=None): else: return None, None -def warn_for_cartesian(element): - froms, start_with = find_unmatching_froms(element) + +def warn_for_unmatching_froms(query): + froms, start_with = find_unmatching_froms(query) if froms: util.warn( 'for stmt %s FROM elements %s are not joined up to FROM element "%r"' % ( - id(element), # defeat the warnings filter + id(query), # defeat the warnings filter ", ".join('"%r"' % f for f in froms), start_with, ) ) + + +def lint(query): + warn_for_unmatching_froms(query)