
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
So you are happy with your very small, very fast key value store. But now for some reason you think you need SQL. Ok, fine. Here is a module.
Given the following key/values
key1 { a: 0, b: 1 }
key2 { a: 2, b: 3 }
And some boilerplate
var level = require('level');
var sql = require('level-sql');
var db = level('./db', { valueEncoding: 'json' });
sql(db);
Given a table T, the query SELECT * FROM T will result in all
the elements of all the rows of the table being shown.
var stream1 = db.query('SELECT * from table1');
{ "key": "key1", "value": { "a": 0, "b": 1 } }
{ "key": "key2", "value": { "a": 2, "b": 3 } }
With the same table, the query SELECT K FROM T will result in
the elements from the key K of all the rows of the table being
shown.
var stream1 = db.query('SELECT a from table1');
{ "key": "key1", "value": { "a": 0 } }
{ "key": "key2", "value": { "a": 2 } }
With the same table, the query SELECT * FROM T WHERE K1 = 2 will
result in all the elements of all the rows where the value of column
K1 is 2 being shown — in Relational algebra terms, a selection
will be performed, because of the WHERE clause. This is also known
as a Horizontal Partition, restricting rows output by a query
according to specified conditions. There can be as many conditions
as you want separated by and or or.
var stream1 = db.query('SELECT a from table1 WHERE a = 2 and a <> 1');
{ "key": "key2", "value": { "a": 2 } }
This is a work in progress, and I don't plan to give it a ton of attention, if you like this idea ping me and I will add you as a contributor.
FAQs
sql for levelup
The npm package level-sql receives a total of 6 weekly downloads. As such, level-sql popularity was classified as not popular.
We found that level-sql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.