1
votes

In loopback I connected a model with the cassandra datasource but when I tried to use the post endpoint of that model using the API Explorer, I got an error : "XYZ" table is not configured in the datasource. So I created a table in keyspace myself using CQL having the same schema but still got the same error. I found two solution for this error:

  1. auto-migration of model
  2. create a table in keyspace using CQL.

I have tried both of the solution but both didn't worked.

Specification

Loopback : 2.x.x

Datasource : Cassandra

1

1 Answers

0
votes

Configure datasource in server/datasource.json

"mycass": {
  "host": "localhost",
  "port": 9042,
  "database": "test",
  "password": "",
  "name": "mycass",
  "user": "",
  "connectTimeout": 30000,
  "readTimeout": 30000,
  "connector": "cassandra"
}

in server/model-config.json attach the model to datasource

  "modelName": {
    "dataSource": "myCass",
    "public": true
  }