Registry / database / plyql
library0.11.2jsnpmunverified

PlyQL (v0.11.2) is a SQL-like query interface for Plywood, primarily used for querying Druid databases. It provides a command-line tool that translates SQL-style queries into Plywood expressions and executes them against Druid. The package supports various output formats (JSON, CSV, TSV, flat), query timeouts, retries, concurrency limits, Druid-specific options like rollup mode, introspection strategies, and column type forcing. It requires Node >= 4.x.x and has no major updates recently, indicating maintenance mode. Alternatives include direct Druid SQL or Plywood native queries, but PlyQL offers a familiar SQL syntax for users accustomed to relational databases. The package is authored by Imply and has a low release cadence.

npm install plyql
INSTALL
IMPORT
SIG · PLYQL
P
plyql
databasejavascriptv0.11.2
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.

PlyQL
import { PlyQL } from 'plyql';
const plyql = require('plyql');
ESM import; CommonJS require works but may not be recommended for TypeScript.
plyql CLI
npx plyql --query 'SELECT * FROM source'
plyql --query 'SELECT * FROM source'
Use npx or global install; the CLI is the primary interface.
PlyQLQuery
import { PlyQLQuery } from 'plyql';
Named export for query construction; not commonly used directly.

Demonstrates basic setup and execution of a SQL-like query against Druid using PlyQL.

import { PlyQL } from 'plyql'; const plyql = new PlyQL({ druidHost: process.env.DRUID_HOST ?? 'http://localhost:8082', }); async function runQuery() { const query = "SELECT COUNT(*) FROM 'mydatasource' WHERE __time >= TIMESTAMP '2020-01-01' AND __time < TIMESTAMP '2020-02-01'"; try { const results = await plyql.query(query, { outputType: 'json' }); console.log(JSON.stringify(results, null, 2)); } catch (err) { console.error('Query failed:', err); } } runQuery();
Debug
Known issues
gotchaPlyQL only supports Druid; other backends are not implemented.
fix
Use Druid or consider alternative query interfaces.
affects: >=0.0.0
breakingIn v0.10.0, the API changed from synchronous to Promise-based. Old code using callbacks will break.
fix
Adopt async/await or .then() for query execution.
affects: >=0.10.0
gotchaTime filters are mandatory unless using --allow eternity flag; queries without time range will fail by default.
fix
Include __time filter in WHERE clause or use --allow eternity.
affects: >=0.0.0
deprecatedThe --output 'flat' format is deprecated and may be removed in future releases.
fix
Use --output 'json' or another supported format.
affects: >=0.8.0
gotchaThe --skip-cache flag may produce stale results if not used carefully.
fix
Ensure cache disabling is intended for the use case; use cautiously.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Unable to connect to Druid broker at <host>
Incorrect host or Druid broker not running.
fix
Verify DRUID_HOST environment variable or --host flag points to correct Druid broker URL.
Query error: No time filter found in WHERE clause
Missing __time filter without --allow eternity flag.
fix
Add a __time range to the WHERE clause or use --allow eternity.
TypeError: plyql.query is not a function
Using old API (<0.10.0) or wrong import.
fix
Update to latest version and use async query API.
Syntax error: Unexpected token at line 1
Malformed SQL query.
fix
Check query syntax per PlyQL language reference.
Upgrade
Version history
0.11.2latest on npm
Audit
Dependencies
plywoodrequiredPlyQL translates SQL into Plywood expressions; plywood is the core dependency.
Agent activity
2 hits · last 30 days
node
2
Resources
packageplyql
plyql — npm install plyql · libregistry