Skip to content

Commit 5fc3b8d

Browse files
authored
feat(native): Cube.py - support pre_aggregations_schema (#7130)
1 parent cc81cd2 commit 5fc3b8d

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

packages/cubejs-backend-native/python/cube/src/conf/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class Configuration:
5353
repository_factory: Callable
5454
schema_version: Callable[[RequestContext], str]
5555
semantic_layer_sync: Callable
56+
pre_aggregations_schema: Callable[[RequestContext], str]
5657

5758
def __init__(self):
5859
self.schema_path = None
@@ -80,6 +81,7 @@ def __init__(self):
8081
self.repository_factory = None
8182
self.schema_version = None
8283
self.semantic_layer_sync = None
84+
self.pre_aggregations_schema = None
8385

8486
def set_schema_path(self, schema_path: str):
8587
self.schema_path = schema_path
@@ -150,5 +152,8 @@ def set_schema_version(self, schema_version: Callable[[RequestContext], str]):
150152
def set_semantic_layer_sync(self, semantic_layer_sync: Callable):
151153
self.semantic_layer_sync = semantic_layer_sync
152154

155+
def set_pre_aggregations_schema(self, pre_aggregations_schema: Callable[[RequestContext], str]):
156+
self.pre_aggregations_schema = pre_aggregations_schema
157+
153158

154159
settings = Configuration()

packages/cubejs-backend-native/src/python/cube_config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ impl CubeConfigPy {
4747
self.function_attr(config_module, "repository_factory")?;
4848
self.function_attr(config_module, "semantic_layer_sync")?;
4949
self.function_attr(config_module, "schema_version")?;
50+
self.function_attr(config_module, "pre_aggregations_schema")?;
5051

5152
Ok(())
5253
}

packages/cubejs-server-core/src/core/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ export class CubejsServerCore {
507507
),
508508
externalDialectClass: this.options.externalDialectFactory && this.options.externalDialectFactory(context),
509509
schemaVersion: currentSchemaVersion,
510-
preAggregationsSchema: this.preAggregationsSchema(context),
510+
preAggregationsSchema: await this.preAggregationsSchema(context),
511511
context,
512512
allowJsDuplicatePropsInSchema: this.options.allowJsDuplicatePropsInSchema,
513513
allowNodeRequire: this.options.allowNodeRequire,

packages/cubejs-server-core/src/core/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export type ContextToOrchestratorIdFn = (context: RequestContext) => string | Pr
127127

128128
export type OrchestratorOptionsFn = (context: RequestContext) => OrchestratorOptions;
129129

130-
export type PreAggregationsSchemaFn = (context: RequestContext) => string;
130+
export type PreAggregationsSchemaFn = (context: RequestContext) => string | Promise<string>;
131131

132132
// internal
133133
export type DriverOptions = {

0 commit comments

Comments
 (0)