Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions crates/connect/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ impl Catalog {
self.spark_session.client().execute_command(plan).await
}

/// Returns a list of all catalogs in this session.
///
/// Convenience method equivalent to `list_catalogs(None)`.
pub async fn list_all_catalogs(self) -> Result<RecordBatch, SparkError> {
self.list_catalogs(None).await
}

/// Returns a list of catalogs in this session
pub async fn list_catalogs(self, pattern: Option<&str>) -> Result<RecordBatch, SparkError> {
let pattern = pattern.map(|val| val.to_owned());
Expand Down Expand Up @@ -121,6 +128,13 @@ impl Catalog {
self.spark_session.client().execute_command(plan).await
}

/// Returns a list of all databases in this session.
///
/// Convenience method equivalent to `list_databases(None)`.
pub async fn list_all_databases(self) -> Result<RecordBatch, SparkError> {
self.list_databases(None).await
}

/// Returns a list of databases in this session
pub async fn list_databases(self, pattern: Option<&str>) -> Result<RecordBatch, SparkError> {
let pattern = pattern.map(|val| val.to_owned());
Expand Down Expand Up @@ -166,6 +180,13 @@ impl Catalog {
Catalog::arrow_to_bool(record)
}

/// Returns a list of all tables/views in the current database.
///
/// Convenience method equivalent to `list_tables(None, None)`.
pub async fn list_all_tables(self) -> Result<RecordBatch, SparkError> {
self.list_tables(None, None).await
}

/// Returns a list of tables/views in the specific database
pub async fn list_tables(
self,
Expand Down Expand Up @@ -198,6 +219,13 @@ impl Catalog {
self.spark_session.client().to_arrow(plan).await
}

/// Returns a list of all functions registered in the current database.
///
/// Convenience method equivalent to `list_functions(None, None)`.
pub async fn list_all_functions(self) -> Result<RecordBatch, SparkError> {
self.list_functions(None, None).await
}

/// Returns a list of functions registered in the specified database.
pub async fn list_functions(
self,
Expand Down
7 changes: 7 additions & 0 deletions crates/connect/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ impl RunTimeConfig {
Ok(val)
}

/// Get a configuration value by key, returning an error if not set.
///
/// This is a convenience method equivalent to `get(key, None)`.
pub async fn get_value(&mut self, key: &str) -> Result<String, SparkError> {
self.get(key, None).await
}

/// Indicates whether the configuration property with the given key is modifiable in the current session.
pub async fn is_modifable(&mut self, key: &str) -> Result<bool, SparkError> {
let op_type = spark::config_request::operation::OpType::IsModifiable(
Expand Down