Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check connectivity for the Spice.ai endpoint #1020

Merged
merged 3 commits into from Apr 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/runtime/src/dataconnector/spiceai.rs
Expand Up @@ -21,6 +21,7 @@ use flight_client::FlightClient;
use flight_datafusion::FlightTable;
use futures::StreamExt;
use futures_core::stream::BoxStream;
use ns_lookup::verify_endpoint_connection;
use secrets::Secret;
use snafu::prelude::*;
use spicepod::component::dataset::Dataset;
Expand Down Expand Up @@ -77,6 +78,11 @@ impl DataConnectorFactory for SpiceAI {
.and_then(|params| params.get("endpoint").cloned())
.unwrap_or(default_flight_url);
tracing::trace!("Connecting to SpiceAI with flight url: {url}");

verify_endpoint_connection(&url)
.await
.map_err(|e| super::Error::UnableToCreateDataConnector { source: e.into() })?;

let api_key = secret.get("key").unwrap_or_default();
let flight_client = FlightClient::new(url.as_str(), "", api_key)
.await
Expand Down