mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-27 04:53:59 +00:00
fix(sql)!: request JSON for storage integration descriptions
Apply the reviewed storage integration change.
This commit is contained in:
@@ -66,6 +66,11 @@ def remote_server(text_type=pa.string()):
|
||||
)
|
||||
elif b"DROP STORAGE INTEGRATION" in command:
|
||||
result = pa.table({"dropped": [True]})
|
||||
elif b"DESCRIBE STORAGE INTEGRATION" in command:
|
||||
assert b"FORMAT JSON" in command
|
||||
result = pa.table(
|
||||
{"description": [json.dumps(info)]}
|
||||
).replace_schema_metadata({b"lancedb.describe.format": b"json"})
|
||||
else:
|
||||
if b"STORAGE_PROVIDER = 'HUGGINGFACE'" in command:
|
||||
info.update(
|
||||
|
||||
@@ -1049,13 +1049,13 @@ impl<S: HttpSend> Database for RemoteDatabase<S> {
|
||||
let name = integration_sql::object_name(name, namespace_path)?;
|
||||
let result = self
|
||||
.execute_query_async(ExecuteQueryRequest {
|
||||
query: format!("DESCRIBE STORAGE INTEGRATION {name}"),
|
||||
query: format!("DESCRIBE STORAGE INTEGRATION {name} FORMAT JSON"),
|
||||
default_namespace_path: namespace_path.to_vec(),
|
||||
parameters: None,
|
||||
options: Default::default(),
|
||||
})
|
||||
.await?;
|
||||
integration_sql::decode_info(&result.reader().await?.try_collect::<Vec<_>>().await?)
|
||||
super::sql::description(result.reader().await?.try_collect::<Vec<_>>().await?)
|
||||
}
|
||||
|
||||
async fn list_storage_integrations(
|
||||
|
||||
@@ -38,6 +38,7 @@ use crate::sql::{Query, QueryDescription, QueryHandle, QueryStatus};
|
||||
mod function;
|
||||
pub(super) mod materialized_view;
|
||||
mod objects;
|
||||
pub(super) use objects::description;
|
||||
pub(super) mod receipt;
|
||||
mod secret;
|
||||
pub(super) use secret::SecretWriteOperation;
|
||||
|
||||
@@ -3282,6 +3282,10 @@ async fn storage_integration_methods_use_sql_with_namespace_and_typed_metadata()
|
||||
result: RecordBatch::try_from_iter(columns.clone()).unwrap(),
|
||||
adaptive: true,
|
||||
defer,
|
||||
result_overrides: Arc::new(std::sync::Mutex::new(HashMap::from([(
|
||||
"DESCRIBE STORAGE INTEGRATION \"raw\" FORMAT JSON".into(),
|
||||
description_batch(info.clone()),
|
||||
)]))),
|
||||
..Default::default()
|
||||
};
|
||||
let statements = service.statements.clone();
|
||||
@@ -3309,13 +3313,14 @@ async fn storage_integration_methods_use_sql_with_namespace_and_typed_metadata()
|
||||
created.trust_policy["Statement"][0]["Condition"]["StringEquals"]["sts:ExternalId"],
|
||||
created.aws_external_id
|
||||
);
|
||||
let described = database
|
||||
.describe_storage_integration("raw", &namespace)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(described.aws_external_id, created.aws_external_id);
|
||||
assert_eq!(
|
||||
database
|
||||
.describe_storage_integration("raw", &namespace)
|
||||
.await
|
||||
.unwrap()
|
||||
.aws_external_id,
|
||||
created.aws_external_id
|
||||
serde_json::to_value(&described).unwrap(),
|
||||
serde_json::to_value(&created).unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
database
|
||||
@@ -3346,7 +3351,10 @@ async fn storage_integration_methods_use_sql_with_namespace_and_typed_metadata()
|
||||
.unwrap();
|
||||
let statements = statements.lock().unwrap();
|
||||
assert!(statements[0].contains("STORAGE_AWS_REGION = 'us-east-1'"));
|
||||
assert_eq!(statements[1], "DESCRIBE STORAGE INTEGRATION \"raw\"");
|
||||
assert_eq!(
|
||||
statements[1],
|
||||
"DESCRIBE STORAGE INTEGRATION \"raw\" FORMAT JSON"
|
||||
);
|
||||
assert_eq!(
|
||||
statements[2],
|
||||
"SHOW STORAGE INTEGRATIONS IN \"platform$aws\" LIMIT 1000"
|
||||
|
||||
Reference in New Issue
Block a user