cube-js / cube-js/cube

Need to define a cube based on a Postgre sql User defined function with string parameter

Open
#7,717 6 comments 1 reaction 0 assignees View on GitHub
question
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Problem**

I have a requirement to create a cube that is based on an existing PostgreSQL user-defined function with a string parameter as input. And the parameters will be supplied from the Rest API call to Cube.js. Is it possible to build such a cube? Or what's the best way to implement it?

Below is a sample code I tried but it gives me an error "Referencev_value is not defined."

```js
cube(`New1`, {
sql: => `SELECT * from test.ufn_function(${v_value})` ,
dimensions: {
is_total: {
sql: `id`,
type: `number`,
primary_key: true,
shown:true
},
"name": {
sql: `"name"`,
type: `number`
}
},
});
```

**Related Cube.js-generated SQL**

This is not getting generated due to an error.

Can someone help me here? Or guide me with proper way to create a cube using user-defined functions with parameters

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.