Skip to content

Commit

Permalink
chore: disable fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ovr committed Sep 25, 2023
1 parent 4f7c452 commit 4710643
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
25 changes: 15 additions & 10 deletions packages/cubejs-backend-native/src/python/template/mj_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use std::sync::Arc;

struct JinjaPythonObject {
pub(crate) inner: Py<PyAny>,
fields: Vec<Arc<str>>,
}

impl std::fmt::Debug for JinjaPythonObject {
Expand Down Expand Up @@ -137,11 +136,20 @@ impl StructObject for JinjaPythonObject {
}

fn fields(&self) -> Vec<Arc<str>> {
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![]
}
}

Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions packages/cubejs-backend-native/test/jinja.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4710643

Please sign in to comment.