-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathdelta_lake.rs
More file actions
63 lines (55 loc) · 1.99 KB
/
Copy pathdelta_lake.rs
File metadata and controls
63 lines (55 loc) · 1.99 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use async_trait::async_trait;
use stackable_operator::{client::Client, v2::types::kubernetes::NamespaceName};
use super::{ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig, config::CatalogConfig};
use crate::{
controller::dereference::TrinoCatalogName, crd::catalog::delta_lake::DeltaLakeConnector,
};
pub const CONNECTOR_NAME: &str = "delta_lake";
#[async_trait]
impl ToCatalogConfig for DeltaLakeConnector {
async fn to_catalog_config(
&self,
catalog_name: &TrinoCatalogName,
catalog_namespace: &NamespaceName,
client: &Client,
trino_version: u16,
) -> Result<CatalogConfig, FromTrinoCatalogError> {
let mut config = CatalogConfig::new(catalog_name, CONNECTOR_NAME);
// No authorization checks are enforced at the catalog level.
// We don't want the delta connector to prevent users from dropping tables.
// We also don't want that the delta connector makes decisions on which user is allowed to do what.
// This decision should be done globally (for all catalogs) by OPA.
// See https://trino.io/docs/current/connector/delta-lake.html
config.add_property("delta.security", "allow-all");
self.metastore
.extend_catalog_config(
&mut config,
catalog_name,
catalog_namespace,
client,
trino_version,
)
.await?;
if let Some(ref s3) = self.s3 {
s3.extend_catalog_config(
&mut config,
catalog_name,
catalog_namespace,
client,
trino_version,
)
.await?;
}
if let Some(ref hdfs) = self.hdfs {
hdfs.extend_catalog_config(
&mut config,
catalog_name,
catalog_namespace,
client,
trino_version,
)
.await?;
}
Ok(config)
}
}