From b53bbd0bca096180013be833cb5501c2df11f136 Mon Sep 17 00:00:00 2001 From: Jack Ye Date: Thu, 26 Nov 2026 17:31:51 -0800 Subject: [PATCH] fix(sql)!: request JSON for storage integration descriptions Apply the reviewed storage integration change. --- .../python/tests/test_storage_integration.py | 5 +++++ rust/lancedb/src/remote/db.rs | 4 ++-- rust/lancedb/src/remote/sql.rs | 1 + rust/lancedb/src/remote/sql_test.rs | 22 +++++++++++++------ 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/python/python/tests/test_storage_integration.py b/python/python/tests/test_storage_integration.py index 9f01f2bc2..c96f36059 100644 --- a/python/python/tests/test_storage_integration.py +++ b/python/python/tests/test_storage_integration.py @@ -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( diff --git a/rust/lancedb/src/remote/db.rs b/rust/lancedb/src/remote/db.rs index aa8b6f23a..5036d36e6 100644 --- a/rust/lancedb/src/remote/db.rs +++ b/rust/lancedb/src/remote/db.rs @@ -1049,13 +1049,13 @@ impl Database for RemoteDatabase { 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::>().await?) + super::sql::description(result.reader().await?.try_collect::>().await?) } async fn list_storage_integrations( diff --git a/rust/lancedb/src/remote/sql.rs b/rust/lancedb/src/remote/sql.rs index 68f53b10e..fda450e2c 100644 --- a/rust/lancedb/src/remote/sql.rs +++ b/rust/lancedb/src/remote/sql.rs @@ -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; diff --git a/rust/lancedb/src/remote/sql_test.rs b/rust/lancedb/src/remote/sql_test.rs index d8de40236..f14eb3cc9 100644 --- a/rust/lancedb/src/remote/sql_test.rs +++ b/rust/lancedb/src/remote/sql_test.rs @@ -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"