diff --git a/rust/lancedb/src/remote/client.rs b/rust/lancedb/src/remote/client.rs index c560332b..93fe6b6a 100644 --- a/rust/lancedb/src/remote/client.rs +++ b/rust/lancedb/src/remote/client.rs @@ -228,6 +228,14 @@ impl RestfulLanceDbClient { }); } let db_name = parsed_url.host_str().unwrap(); + let db_prefix = { + let prefix = parsed_url.path().trim_start_matches('/'); + if prefix.is_empty() { + None + } else { + Some(prefix) + } + }; // Get the timeouts let connect_timeout = Self::get_timeout( @@ -258,6 +266,7 @@ impl RestfulLanceDbClient { db_name, host_override.is_some(), options, + db_prefix, )?) .user_agent(client_config.user_agent) .build() @@ -292,6 +301,7 @@ impl RestfulLanceDbClient { db_name: &str, has_host_override: bool, options: &RemoteOptions, + db_prefix: Option<&str>, ) -> Result { let mut headers = HeaderMap::new(); headers.insert( @@ -317,6 +327,17 @@ impl RestfulLanceDbClient { })?, ); } + if db_prefix.is_some() { + headers.insert( + "x-lancedb-database-prefix", + HeaderValue::from_str(db_prefix.unwrap()).map_err(|_| Error::InvalidInput { + message: format!( + "non-ascii database prefix '{}' provided", + db_prefix.unwrap() + ), + })?, + ); + } if let Some(v) = options.0.get("account_name") { headers.insert(