Skip to content

Commit 2f2be58

Browse files
authored
feat(schema): Support python @context_func for jinja templates (#6729)
1 parent a77ab44 commit 2f2be58

File tree

23 files changed

+843
-298
lines changed

23 files changed

+843
-298
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
### Python load `cube.py`:
2+
3+
```mermaid
4+
sequenceDiagram
5+
participant Node
6+
participant Native
7+
participant PythonRuntime
8+
participant Python
9+
10+
Node->>Native: pythonLoadConfig
11+
activate Node
12+
Native->>+Python: loading module
13+
Python-->>+Node: CubePyConfig
14+
deactivate Node
15+
```
16+
17+
# Calling python
18+
19+
```py
20+
def context_to_app_id(ctx):
21+
print('content_to_app_id', ctx)
22+
23+
return 'CUBEJS_APP_{}'.format(ctx.securityContext.userId)
24+
```
25+
26+
```mermaid
27+
sequenceDiagram
28+
participant Node
29+
participant Native
30+
participant PythonRuntime
31+
participant Python
32+
33+
Node->>Native: config.contextToAppId
34+
activate Node
35+
Native->>+Python: scheduling call for context_to_app_id (Py<PyFunction.)
36+
Python-->>+Node: defer
37+
deactivate Node
38+
```

0 commit comments

Comments
 (0)