Skip to content

Commit 3fd5932

Browse files
committed
Catch exception for issue 42S22
1 parent 268d35c commit 3fd5932

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

resources/metabase-plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
info:
22
name: Metabase Teradata Driver
33
# also replace the version in deps.edn if you change the metabase version here
4-
version: 1.1.16-metabase-v0.50.31-teradata-jdbc-20.00
4+
version: 1.1.17-metabase-v0.50.31-teradata-jdbc-20.00
55
description: Allows Metabase to connect to Teradata databases. Community Supported driver.
66
dependencies:
77
- class: com.teradata.jdbc.TeraDriver

src/metabase/driver/teradata.clj

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,21 @@
116116
:remarks remarks}))
117117
(range 1 (inc (.getColumnCount metadata)))))))
118118
(catch java.sql.SQLException e
119-
(if (= "42S02" (.getSQLState e)) ; Check for SQLState 42S02 (object does not exist)
120-
(do
121-
(log/warn (trs "Table or view ''{0}'' in schema ''{1}'' does not exist." table-name schema))
122-
[]) ; Return an empty field set
123-
(throw e))))) ; Re-throw other exceptions
119+
(let [sqlstate (.getSQLState e)]
120+
(cond
121+
;; 42S02: base object gone
122+
(= "42S02" sqlstate)
123+
(do
124+
(log/warn (trs "Table or view ''{0}'' in schema ''{1}'' does not exist." table-name schema))
125+
[])
126+
;; 42S22: column(s) referenced by the view no longer exist
127+
(= "42S22" sqlstate)
128+
(do
129+
(log/warn (trs "Skipping fields sync for ''{0}'' in schema ''{1}'' due to missing column(s). Cause: {2}"
130+
table-name schema (.getMessage e)))
131+
[])
132+
:else
133+
(throw e)))))) ; Re-throw other exceptions
124134

125135
(defn ^:private fields-metadata
126136
[driver ^Connection conn {schema :schema, table-name :name} ^String db-name-or-nil]

0 commit comments

Comments
 (0)