{"id":18622,"library":"nqm-iot-database-utils","title":"nqm-iot-database-utils","description":"Database utility functions for nqminds IoT platform, providing a SQLite-based implementation for creating datasets, adding and querying data with support for ndarray fields. Version 0.7.2 is the latest stable release. This package is specific to the nqm ecosystem and not intended for general database usage. It offers a promise-based API with functions like openDatabase, createDataset, addData, getData, and ndarray utilities. The package is outdated with no recent updates and limited documentation.","status":"maintenance","version":"0.7.2","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/nqminds/nqm-iot-database-utils","tags":["javascript","database","nqm"],"install":[{"cmd":"npm install nqm-iot-database-utils","lang":"bash","label":"npm"},{"cmd":"yarn add nqm-iot-database-utils","lang":"bash","label":"yarn"},{"cmd":"pnpm add nqm-iot-database-utils","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is CommonJS only, no ESM support. Use require.","wrong":"import sqliteUtils from 'nqm-iot-database-utils';","symbol":"default","correct":"const sqliteUtils = require('nqm-iot-database-utils');"},{"note":"Use destructured require for individual functions.","wrong":"import { openDatabase } from 'nqm-iot-database-utils';","symbol":"openDatabase","correct":"const { openDatabase } = require('nqm-iot-database-utils');"},{"note":"Same as others, CommonJS only.","wrong":"import { getNdarrayMeta } from 'nqm-iot-database-utils';","symbol":"getNdarrayMeta","correct":"const { getNdarrayMeta } = require('nqm-iot-database-utils');"}],"quickstart":{"code":"const sqliteUtils = require('nqm-iot-database-utils');\nconst TDX_SCHEMA = {\n  \"schema\": {\n    \"dataSchema\": {\n      \"prop1\": { \"__tdxType\": [\"number\"] },\n      \"prop2\": { \"__tdxType\": [\"number\"] }\n    },\n    \"uniqueIndex\": []\n  }\n};\n\nlet dbIter;\nconst testData = [];\n\nsqliteUtils.openDatabase('', 'memory', 'w+')\n  .then(db => {\n    dbIter = db;\n    return sqliteUtils.createDataset(db, TDX_SCHEMA);\n  })\n  .then(() => {\n    for (let idx = 0; idx < 100; idx++) {\n      testData.push({ prop1: idx, prop2: 100 - idx - 1 });\n    }\n    return sqliteUtils.addData(dbIter, testData);\n  })\n  .then(() => {\n    return sqliteUtils.getData(dbIter,\n      { $and: [ { $or: [ { prop1: { $gte: 2, $lte: 5 } }, { prop1: { $gte: 92 } } ] }, { prop2: { $lte: 10 } } ] },\n      null,\n      { sort: { prop1: 1, prop2: -1 } });\n  })\n  .then(result => console.log(result));","lang":"javascript","description":"Demonstrates opening an in-memory SQLite database, creating a dataset with two numeric fields, inserting 100 documents, and querying with a filter and sort."},"warnings":[{"fix":"Use require() instead of import.","message":"Package is CommonJS-only and uses require. Attempting to import with ES6 import will fail.","severity":"breaking","affected_versions":"all"},{"fix":"Consider migrating to a maintained alternative unless tied to nqm ecosystem.","message":"Package has no recent updates; last version 0.7.2 is likely stale. No active maintenance.","severity":"deprecated","affected_versions":"all"},{"fix":"Refer to the package's own documentation or source code for schema definitions.","message":"The API uses a custom TDX schema format that may not be documented elsewhere.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the provided methods (createDataset, addData, getData) instead of native sqlite3 operations.","message":"openDatabase returns a promise, but the database object is not a standard sqlite3 object; it's a custom wrapper.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure compatibility with your Node version; test before use.","message":"The package uses Node.js engine >=10.0.0. It may not work with newer Node versions due to lack of maintenance.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install nqm-iot-database-utils' in your project.","cause":"Module not installed or not in node_modules.","error":"Cannot find module 'nqm-iot-database-utils'"},{"fix":"Use 'const sqliteUtils = require(\"nqm-iot-database-utils\");'","cause":"Incorrect import; using import instead of require.","error":"sqliteUtils.openDatabase(...) is not a function"},{"fix":"Add .catch() to promise chain to handle errors.","cause":"Promise rejection not handled; database or dataset creation failed silently.","error":"TypeError: Cannot read property 'data' of undefined"},{"fix":"Use 'memory' with 'r+' or omit the flag for in-memory databases.","cause":"In-memory databases are read-only by default with some sqlite3 bindings.","error":"Error: 'w+' flag not supported for in-memory database"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}