Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
c4b7c3fc
Unverified
Commit
c4b7c3fc
authored
1 year ago
by
Cal Herries
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Skip listing tables for bigquery driver/can-connect? check (#37787)
parent
a8203762
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk.clj
+16
-15
16 additions, 15 deletions
...uery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk.clj
with
16 additions
and
15 deletions
modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk.clj
+
16
−
15
View file @
c4b7c3fc
...
...
@@ -80,15 +80,8 @@
(
defn-
list-tables
"Fetch all tables (new pages are loaded automatically by the API)."
(
^
Iterable
[
details
]
(
list-tables
details
{
:validate-dataset?
false
}))
(
^
Iterable
[
details
{
:keys
[
validate-dataset?
]}]
(
let
[
client
(
database-details->client
details
)
dataset-iter
(
list-datasets
details
)]
(
when
(
and
(
not=
(
:dataset-filters-type
details
)
"all"
)
validate-dataset?
(
zero?
(
count
dataset-iter
)))
(
throw
(
ex-info
(
tru
"Looks like we cannot find any matching datasets."
)
{
::driver/can-connect-message?
true
})))
(
apply
concat
(
for
[
^
DatasetId
dataset-id
dataset-iter
]
(
->
(
.listTables
client
dataset-id
(
u/varargs
BigQuery$TableListOption
))
.iterateAll
...
...
@@ -96,14 +89,22 @@
iterator-seq
))))))
(
defmethod
driver/can-connect?
:bigquery-cloud-sdk
[
_
details-map
]
;; check whether we can connect by seeing whether listing tables succeeds
(
try
(
some?
(
list-tables
details-map
{
:validate-dataset?
true
}))
(
catch
Exception
e
(
when
(
::driver/can-connect-message?
(
ex-data
e
))
(
throw
e
))
(
log/errorf
e
(
trs
"Exception caught in :bigquery-cloud-sdk can-connect?"
))
false
)))
[
_
details
]
;; check whether we can connect by seeing whether listing datasets succeeds
(
let
[[
success?
datasets
]
(
try
[
true
(
list-datasets
details
)]
(
catch
Exception
e
(
log/errorf
e
(
trs
"Exception caught in :bigquery-cloud-sdk can-connect?"
))
[
false
nil
]))]
(
cond
(
not
success?
)
false
;; if the datasets are filtered and we don't find any matches, throw an exception with a message that we can show
;; to the user
(
and
(
not=
(
:dataset-filters-type
details
)
"all"
)
(
nil?
(
first
datasets
)))
(
throw
(
Exception.
(
tru
"Looks like we cannot find any matching datasets."
)))
:else
true
)))
(
def
^
:private
empty-table-options
(
u/varargs
BigQuery$TableOption
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment