diff --git a/packages/cubejs-backend-native/src/python/template/mj_value.rs b/packages/cubejs-backend-native/src/python/template/mj_value.rs index 130b8cfac0de2..00fdb3e6ba6d8 100644 --- a/packages/cubejs-backend-native/src/python/template/mj_value.rs +++ b/packages/cubejs-backend-native/src/python/template/mj_value.rs @@ -12,7 +12,6 @@ use std::sync::Arc; struct JinjaPythonObject { pub(crate) inner: Py, - fields: Vec>, } impl std::fmt::Debug for JinjaPythonObject { @@ -137,11 +136,20 @@ impl StructObject for JinjaPythonObject { } fn fields(&self) -> Vec> { - self.fields.clone() - } - - fn field_count(&self) -> usize { - self.fields.len() + // TODO(ovr): Should we enable it? dump fn? + // let obj_ref = &self.inner; + // + // Python::with_gil(|py| { + // let mut fields = vec![]; + // + // for key in obj_ref.as_ref(py).keys() { + // fields.push(key.to_string().into()); + // } + // + // fields + // }) + + vec![] } } @@ -410,10 +418,7 @@ pub fn to_minijinja_value(from: CLRepr) -> Value { CLRepr::PyExternalFunction(inner) | CLRepr::PyFunction(inner) => { Value::from_object(JinjaPythonFunction { inner }) } - CLRepr::PyObject(inner) => Value::from_object(JinjaPythonObject { - inner, - fields: vec![], - }), + CLRepr::PyObject(inner) => Value::from_object(JinjaPythonObject { inner }), CLRepr::JsFunction(_) => panic!( "Converting from {:?} to minijinja::Value is not supported", CLReprKind::JsFunction diff --git a/packages/cubejs-backend-native/test/jinja.test.ts b/packages/cubejs-backend-native/test/jinja.test.ts index 74d08e1b75263..939c35cf3b290 100644 --- a/packages/cubejs-backend-native/test/jinja.test.ts +++ b/packages/cubejs-backend-native/test/jinja.test.ts @@ -130,6 +130,8 @@ function createTestSuite(utilsFile: string) { userId: 1, } }); + + // todo(ovr): Fix issue with tests // testTemplateWithPythonCtxBySnapshot(jinjaEngine, 'class-model.yml.jinja', {}, utilsFile); testTemplateWithPythonCtxBySnapshot(jinjaEngine, 'data-model.yml.jinja', {}, utilsFile); testTemplateWithPythonCtxBySnapshot(jinjaEngine, 'arguments-test.yml.jinja', {}, utilsFile);