Registry / database / juttle-sql-adapter-common

juttle-sql-adapter-common

JSON →
library0.6.0jsnpmunverified

Shared library used by Juttle adapters for PostgreSQL, MySQL, and SQLite. Version 0.6.0 is the latest stable release (maintenance mode, last updated ~2016). Provides common SQL query building and optimized read operations (filter, reduce, head/tail). Key differentiator: works with Juttle graph-based analytics language, enables pushdown of Juttle operations into SQL. Low activity, no recent updates.

npm install juttle-sql-adapter-common
INSTALL
IMPORT
SIG · JUTTLE-SQL-ADAPTER
J
juttle-sql-adapter-common
databasejavascriptv0.6.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const AdapterCommon = require('juttle-sql-adapter-common');
import AdapterCommon from 'juttle-sql-adapter-common';
This package is CommonJS only (no ESM). Must use require().
SQLAdapter
const SQLAdapter = require('juttle-sql-adapter-common').SQLAdapter;
const { SQLAdapter } = require('juttle-sql-adapter-common');
Correct usage: require the package and access .SQLAdapter. Direct destructuring from require is also valid but less common.
buildQuery
const buildQuery = require('juttle-sql-adapter-common').buildQuery;
import { buildQuery } from 'juttle-sql-adapter-common';
Same as above: CommonJS only. Use require.

Create a SQL adapter instance, configure connection, and read data from a table with optimization enabled.

const { SQLAdapter } = require('juttle-sql-adapter-common'); const adapter = new SQLAdapter({ connectionConfig: { host: 'localhost', user: 'user', password: process.env.DB_PASSWORD || '', database: 'mydb' } }); adapter.read({ from: '-1h', to: ':now:', to: 'some_table', optimize: true }).then(result => { console.log(result); }).catch(err => { console.error(err); });
Debug
Known issues
gotchaOptimized read operations may produce unexpected results for non-standard SQL databases; disable with -optimize false.
fix
Add option optimize: false to read or omit optimization for complex queries.
affects: >=0.1.0
deprecatedProject is in maintenance mode; no new features or security fixes are expected.
fix
Consider migrating to a more actively maintained database adapter.
affects: >=0.6.0
gotchaThe 'reduce by fieldname' optimization only works with supported aggregate functions; using unsupported functions leads to fallback to Juttle runtime.
fix
Check documentation for list of supported reduce operations.
affects: >=0.1.0
gotchaUsing read sql | filter ... (client-side filter) is not optimized; only filter expressions inside read sql are pushed to SQL.
fix
Place filter expressions inside the read sql statement, not as a pipeline filter.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'juttle-sql-adapter-common'
Package is not installed or missing dependencies.
fix
Run 'npm install juttle-sql-adapter-common' and ensure juttle is installed as a peer.
TypeError: AdapterCommon is not a constructor
Using ES6 import syntax with a CommonJS module.
fix
Use 'const AdapterCommon = require("juttle-sql-adapter-common");' or 'const { SQLAdapter } = require("...");'.
Error: connect ECONNREFUSED 127.0.0.1:3306
Database server is not running or connection parameters are incorrect.
fix
Ensure database is running and connectionConfig contains correct host, port, user, password, and database.
Upgrade
Version history
0.6.0latest on npm
Audit
Dependencies
juttlerequiredPeer dependency; adapter is designed to run within Juttle runtime
Agent activity
5 hits · last 30 days
node
4
Resources
juttle-sql-adapter-common — npm install juttle-sql-adapter-common · libregistry