Which SQL query syntax should I use for Kalix views? It says correct the query

Which SQL query syntax should I use for Kalix views or does kalix have separate syntax for SQL? please let me know.

The ERROR says UNKNOWN COLUMN active_connection.connection_id and to fis this issue, correct the query

rpc GetActiveCustomer(ConnectionMessage) returns (stream ActiveCustomerFlag) {
option (kalix.method).view.query = {
query: "SELECT CASE WHEN COUNT(*) = 4 THEN ‘true’ ELSE ‘false’ END AS result FROM active_connection "
" JOIN active_party ON active_connection.connection_id = active_party.connection_id "
" JOIN active_borrowing_entity ON active_party.connection_id = active_borrowing_entity.connection_id "
" JOIN active_guarantee ON active_borrowing_entity.connection_id = active_guarantee.connection_id "
" WHERE active_connection.connection_id = :connection_id "
};
option (google.api.http) = {
get: “/company_search/GetAllActiveCustomer”
};
}

1 Like

Hi makesh,

Kalix does have support for joins and multiple tables with kalix-specific syntax, have a look at the docs here. Note those advance view features might need to be enabled (both locally and when deploying to kalix), see here.

Yes I have enabled the advanced view features locally. Still gettiing error. Should I follow any specific Relational Database SQL syntax like Oracle, My SQL etc… which supports Kalix. Please let me know

Hi Makesh,

The Kalix views has its own subset of SQL (just like the “dialects” you mention, but smaller), in general the SQL features supported are all listed in the docs here: Implementing Views in Java or Scala :: Kalix Documentation, if some query functionality or syntax is not mentioned it is likely not supported.