diff --git a/src/metabase/models/table.clj b/src/metabase/models/table.clj index e524436887483e933e52b515ccea32858a38b72b..df4c4f1e7d4af45f0d11d276f351e074b63defe9 100644 --- a/src/metabase/models/table.clj +++ b/src/metabase/models/table.clj @@ -111,7 +111,7 @@ (assoc table hydration-key (get table-id->objects (:id table) []))))) (defn with-segments - "Efficiently hydrate the `Segments` for a collection of TABLES." + "Efficiently hydrate the Segments for a collection of `tables`." {:batched-hydrate :segments} [tables] (with-objects :segments @@ -120,7 +120,7 @@ tables)) (defn with-metrics - "Efficiently hydrate the `Metrics` for a collection of TABLES." + "Efficiently hydrate the Metrics for a collection of `tables`." {:batched-hydrate :metrics} [tables] (with-objects :metrics @@ -129,7 +129,7 @@ tables)) (defn with-fields - "Efficiently hydrate the `Fields` for a collection of TABLES." + "Efficiently hydrate the Fields for a collection of `tables`." {:batched-hydrate :fields} [tables] (with-objects :fields @@ -145,7 +145,7 @@ ;;; ------------------------------------------------ Convenience Fns ------------------------------------------------- (defn qualified-identifier - "Return a keyword identifier for TABLE in the form `:schema.table-name` (if the Table has a non-empty `:schema` field) + "Return a keyword identifier for `table` in the form `:schema.table-name` (if the Table has a non-empty `:schema` field) or `:table-name` (if the Table has no `:schema`)." ^clojure.lang.Keyword [{schema :schema, table-name :name}] (keyword (str (when (seq schema) diff --git a/test/metabase/test/data/sql.clj b/test/metabase/test/data/sql.clj index fc7ae255a5d60cef2f5d88c50262c3af7334db12..db08692db60e5c1b052fa1868e7832760d8bec8b 100644 --- a/test/metabase/test/data/sql.clj +++ b/test/metabase/test/data/sql.clj @@ -2,11 +2,8 @@ "Common test extension functionality for all SQL drivers." (:require [clojure.string :as str] [metabase.driver :as driver] - [metabase.driver.sql - [query-processor :as sql.qp] - [util :as sql.u]] - [metabase.test.data.interface :as tx] - [metabase.util.honeysql-extensions :as hx]) + [metabase.driver.sql.util :as sql.u] + [metabase.test.data.interface :as tx]) (:import metabase.test.data.interface.FieldDefinition)) (driver/register! :sql/test-extensions, :abstract? true) @@ -49,20 +46,6 @@ ([_ db-name table-name] [table-name]) ([_ db-name table-name field-name] [table-name field-name])) -(defn qualified-identifier - "Call `qualified-name-components` on a set of string or keyword names, then pass it to `hx/identifier`. The resulting - object can be included directly in a HoneySQL form and will automatically be converted to an appropriately quoted - identifer when the HoneySQL form is compiled. - - (qualified-identifier \"my_db\" \"my_table\") ; -> (hx/identifier :table \"MY_DB\" \"MY_TABLE\") ; for H2" - {:arglists '([driver db-name] [driver db-name table-name] [driver db-name table-name field-name])} - [driver & names] - (->> names - (apply qualified-name-components driver) - (map (partial tx/format-name driver)) - (apply hx/identifier) - (sql.qp/->honeysql driver))) - (defn qualify-and-quote "Qualify names and combine into a single, quoted string. By default, this passes the results of `qualified-name-components` to `tx/format-name` and then to `sql.u/quote-name`. @@ -70,7 +53,7 @@ (qualify-and-quote [driver \"my-db\" \"my-table\"]) -> \"my-db\".\"dbo\".\"my-table\" You should only use this function in places where you are working directly with SQL. For HoneySQL forms, use - `qualified-identifier` instead." + `hx/identifier` instead." {:arglists '([driver db-name] [driver db-name table-name] [driver db-name table-name field-name])} [driver & names] (let [identifier-type (condp = (count names)