Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ ql.io Public
forked from ql-io/ql.io

A node.js based declarative, data-retrieval and aggregation gateway for quickly consuming HTTP APIs

License

Notifications You must be signed in to change notification settings

s3u/ql.io

 
 

Repository files navigation

ql.io

CI Core Tests Status

A declarative data retrieval and aggregation gateway for HTTP APIs. Write SQL-like queries to fetch and combine data from multiple REST endpoints.

AI-Modernized: This project was completely modernized by AI from the original ql.io repository. The legacy 2011-2013 Node.js 0.8+ codebase was transformed into a modern, high-performance system with ES2020+ JavaScript, comprehensive testing, and advanced optimizations.

What it does

ql.io lets you:

  • Query REST APIs using SQL-like syntax
  • Join data from multiple APIs in a single query
  • Create reusable table definitions for APIs
  • Aggregate and transform API responses
  • Build data mashups with declarative queries

Requirements

  • Node.js 18.0.0+
  • npm 8.0.0+

Quick Start

git clone https://github.com/s3u/ql.io.git
cd ql.io
make install
npm start

Access:

Example Queries

-- Show available data sources
show tables

-- Get blog posts
select id, title from jsonplaceholder.posts limit 5

-- Join posts with user data
posts = select id, title, userId from jsonplaceholder.posts limit 3;
users = select id, name, email from jsonplaceholder.users;
return select p.title, u.name, u.email 
       from posts as p, users as u 
       where p.userId = u.id

-- Use variables
userId = 1;
user = select * from jsonplaceholder.users where id = {userId};
return user

Testing

# Run all tests (some integration tests may fail due to external API dependencies)
npm test

# Test specific modules
npm run test:engine
npm run test:compiler
npm run test:console
npm run test:app

# Test demos and integration
npm run test:demo

Project Structure

Built with npm workspaces:

  • engine - Query execution engine
  • compiler - QL script compiler
  • console - Web interface
  • app - HTTP server framework
  • demos - Example tables, routes, and tests

Using as a Library

npm install ql.io-engine
const Engine = require('ql.io-engine');

const engine = new Engine();
const script = `
  create table posts
    on select get from 'https://jsonplaceholder.typicode.com/posts'
  
  select id, title from posts limit 5
`;

engine.execute(script, function(emitter) {
  emitter.on('end', function(err, result) {
    if (err) {
      console.error(err);
    } else {
      console.log(result.body);
    }
  });
});

Language Features

  • Tables: Map REST endpoints to queryable tables
  • SELECT: Query data with WHERE, LIMIT, ORDER BY
  • JOIN: Combine data from multiple sources
  • Variables: Parameterize queries with variable substitution
  • Routes: Create HTTP endpoints that execute QL scripts
  • Error handling: Graceful failure and timeout management

Troubleshooting

Port conflicts:

lsof -ti:3000 | xargs kill -9
lsof -ti:3001 | xargs kill -9

Permission errors:

chmod +x bin/start.sh

Dependency issues:

make clean
make install

Test failures: Some integration tests may fail due to external API rate limits or network issues. The core functionality and demo integration tests should pass:

npm run test:demo  # Should pass - tests core functionality

License

Apache 2.0

About

A node.js based declarative, data-retrieval and aggregation gateway for quickly consuming HTTP APIs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 90.9%
  • CodeQL 2.8%
  • Shell 2.5%
  • CSS 0.9%
  • HTML 0.8%
  • mupad 0.7%
  • Other 1.4%