1

I have stored my data in the GridDb container and want to query it, but I cannot retrieve it even though the data exists in the container. I am unable to figure out the error in my code.

P.S. The code is mentioned below for reference:

var griddb = require('griddb-node-api');

const createCsvWriter = require('csv-writer').createObjectCsvWriter;
const csvWriter = createCsvWriter({
  path: 'out.csv',
  header: [
    {id: "id", title:"id"}, 
    {id: "new_name", title:"new_name"}, 
    {id: "est_diameter_min", title:"est_diameter_min"}, 
    {id: "est_diameter_max", title:"est_diameter_max"}, 
    {id: "relative_velocity", title:"relative_velocity"}, 
    {id: "miss_distance", title:"miss_distance"}, 
    {id: "orbiting_body" , title:"orbiting_body"}, 
    {id: "sentry_object", title:"sentry_object"}, 
    {id: "absolute_magnitude", title:"absolute_magnitude"}
  ]
});

const factory = griddb.StoreFactory.getInstance();
const store = factory.getStore({
    "host": '239.0.0.1',
    "port": 31999,
    "clusterName": "defaultCluster",
    "username": "admin",
    "password": "admin"
});

// For connecting to the GridDB Server we have to make containers and specify the schema.
const conInfo = new griddb.ContainerInfo({
    'name': "neoanalysis",
    'columnInfoList': [
      ["name", griddb.Type.STRING],
      ["id", griddb.Type.INTEGER],
        ["new_name", griddb.Type.STRING],
        ["est_diameter_min", griddb.Type.DOUBLE],
        ["est_diameter_max", griddb.Type.DOUBLE],
        ["relative_velocity", griddb.Type.DOUBLE],
        ["miss_distance", griddb.Type.DOUBLE],
        ["absolute_magnitude", griddb.Type.DOUBLE]
    ],
    'type': griddb.ContainerType.COLLECTION, 'rowKey': true
});

container = store.get_container(conInfo)
query = container.query("SELECT * FROM mycontainer WHERE id = 54016465")
    result_set = query.fetch()

    # Check if any results are returned
    if result_set:
        for row in result_set:
            print(row)

Here is a snapshot of the row that needs to be fetched:

Instead I am getting this error as shown below:

[Error code] From 20000

[Description] Recovery-related error group

From what I understood from the error, GridDB could not recover the container information. So, I tried to restart the cluster, but it did not help. Anything that I am doing wrong? I appreciate any help provided.

0 Answers0