Problem
When attempting to query a Vector Search index as a table, you receive the following error message.
[RequestId=918d8ca7-8c5b-4956-8f9a-012001365310 ErrorClass=INVALID_PARAMETER_VALUE.SECURABLE_KIND_DOES_NOT_SUPPORT_LAKEHOUSE_FEDERATION] Securable with kind TABLE_ONLINE_VECTOR_INDEX_REPLICA does not support Lakehouse Federation.
Cause
Using SQL to query a vector index is not supported in Databricks.
Solution
Use the Python SDK or the REST API for querying a vector search endpoint.
Alternatively, employ the vector_search
function directly within SQL to query a vector search index. The vector_search
function follows the syntax vector_search(index, query, num_results)
.
Example
SELECT * FROM VECTOR_SEARCH(index => "main.db.my_index", query => "iphone", num_results => 2)
For more information, please review the How to create and query a vector search index and vector_search function documentation.
For details on the vector search Python SDK, please review the databricks.vector_search package documentation.