-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcube.js
50 lines (41 loc) · 1.46 KB
/
cube.js
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
module.exports = {
checkSqlAuth: (req, user_name, password) => {
return {
password,
securityContext: {
user: user_name,
password
}
};
},
queryRewrite: (query, { securityContext }) => {
return query;
},
// contextToAppId is used as a caching key for various in-memory structures like data model compilation results, connection pool
contextToAppId: ({ securityContext }) => {
return `${securityContext.user}//${securityContext.password}`;
},
// contextToOrchestratorId is used as a caching key for database connections, execution queues and pre-aggregation table caches
contextToOrchestratorId: ({ securityContext }) =>{
return `${securityContext.user}//${securityContext.password}`
},
// preAggregationsSchema: ({ securityContext }) =>{
// return `pre_aggregations_${securityContext.user}_${securityContext.password}`
//},
// scheduledRefreshContexts: async () => {
// const users = ["admin"];
// return users.map((id) => {
// return { securityContext: { user: "admin",password:"123" } }
// })
// },
driverFactory: ({ securityContext,dataSource }) => {
console.log("security at driver",securityContext)
return {
type: 'trino',
host: 'host',
user:securityContext.user,
pass:securityContext.password,
database: dataSource
};
}
}