1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright The Lance Authors
//! Bridge between catalog connectors and the SQL query engine.
//!
//! Provides utilities for building a DataFusion `SessionContext` from a
//! [`Connector`], enabling users to auto-register tables from an external
//! catalog and query them via [`SqlQuery`] or [`SqlEngine`].
use crate;
use SessionContext;
use Connector;
/// Build a DataFusion `SessionContext` with all tables from a catalog schema
/// auto-registered.
///
/// This discovers tables in the given catalog/schema via the connector's
/// [`CatalogProvider`] and registers them using the appropriate [`TableReader`]
/// based on each table's data format.
///
/// # Example
///
/// ```no_run
/// # use lance_graph::sql_catalog::build_context_from_connector;
/// # use lance_graph_catalog::Connector;
/// # async fn example(connector: &Connector) {
/// let ctx = build_context_from_connector(connector, "unity", "default")
/// .await
/// .unwrap();
/// // ctx now has all tables from unity.default registered
/// # }
/// ```
pub async