From 1f9e5ddafd463fe5b6a44e7808b5df115cd30b63 Mon Sep 17 00:00:00 2001 From: Tim Macdonald Date: Tue, 27 Feb 2024 15:06:41 -0800 Subject: [PATCH] Don't use schema name Reliably determining what the schema name is turns out to be a little complicated; don't use it for now. c.f. https://github.com/metabase/metabase/issues/39233 --- src/macaw/core.clj | 2 +- test/macaw/core_test.clj | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/macaw/core.clj b/src/macaw/core.clj index 89037b1..a5196b6 100644 --- a/src/macaw/core.clj +++ b/src/macaw/core.clj @@ -22,7 +22,7 @@ ast-walker (ASTWalker. {:column (fn [^Column column] (swap! column-names conj (.getColumnName column))) :table (fn [^Table table] - (swap! table-names conj (.getFullyQualifiedName table)))})] + (swap! table-names conj (.getName table)))})] (.walk ast-walker parsed-query) {:columns @column-names :tables @table-names})) diff --git a/test/macaw/core_test.clj b/test/macaw/core_test.clj index 284d0f1..8a54d77 100644 --- a/test/macaw/core_test.clj +++ b/test/macaw/core_test.clj @@ -12,7 +12,8 @@ (is (= #{"core_user"} (tables "select id, email from core_user;")))) (testing "With a schema (Postgres)" ;; TODO: only run this against supported DBs - (is (= #{"the_schema_name.core_user"} + ;; It strips the schema + (is (= #{"core_user"} (tables "select * from the_schema_name.core_user;")))) (testing "Sub-selects" (is (= #{"core_user"}