]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Improve naming, do not lint unhandled types
authorAlessio Bogon <youtux@gmail.com>
Sun, 1 Sep 2019 11:30:36 +0000 (13:30 +0200)
committerAlessio Bogon <youtux@gmail.com>
Sun, 1 Sep 2019 11:30:36 +0000 (13:30 +0200)
lib/sqlalchemy/ext/linter.py

index 549127f8b8fefef393c2b4293e6445bf09c4ab6d..4e53b0b164203774e40573137209d84138193b6c 100644 (file)
@@ -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)