tastott / jsoql Goto Github PK
View Code? Open in Web Editor NEWA SQL-like language for querying JSON data
Home Page: http://tastott.github.io/jsoql
A SQL-like language for querying JSON data
Home Page: http://tastott.github.io/jsoql
Looks a bit nasty: http://tastott.github.io/jsoql/
Currently whitespace is consumed by keywords, which feels wrong.
Currently, datasources which are enumerated asynchronously (anything except var
?) cannot be used in a SELECT
sub-query such as:
SELECT
(SELECT COUNT() FROM 'file://blah') AS CountOfBlah
FROM
...
Maybe just light and dark? Will need to set css and ACE theme
Where the source contains a single top-level object (e.g. a .json
file with an object as its root, a .jsons
file with a single entry), allow an array property of this object to be used as the dataset.
E.g.
SELECT * FROM 'file://MyObject.json'.Things
(Query on Things
)
Map each row to an object using headings from the file or some headings specified in the query?
E.g. SELECT Things.count()
E.g. SELECT Things [1] ...
E.g.
SELECT
(SELECT COUNT() FROM Things.Wotsit[0]) AS Count
FROM
'file://blah.json'
In particular, there are some changes to lazy.js which keep getting lost when the npm module is re-installed.
Drop a .jsoql
file onto the editor to open the query therein in a new tab. Drop any other file onto the editor to (attempt to) use it as the FROM
target with a SELECT *
query.
E.g.
SELECT SomeNumberProperty + AnotherNumberProperty AS SumOfStuff FROM 'file://things.json'
or
SELECT Name + ' has ' + HairColour + ' hair' FROM 'file://people.json'
Sum, avg, min, etc
Lazy.makeHttpRequest()
apparently breaks the response up into chunks. The only reason my unit test passed was that the test data was smaller than the chunk size. For a JSON response, these chunks will have to be piped into some kind of rolling JSON parser (oboe?) that can spit out parsed objects. The browser version perhaps doesn't split into chunks (or uses bigger chunks?) so I haven't come across this issue there yet.
Dropping a file in the desktop GUI just means that the file path can be used as a datasource. In the online GUI, the file should be copied to local storage and the file
scheme should read from there. Auto-complete for file://
in the online GUI should list previously copied files.
SELECT
Something,
COUNT() / 100 AS Percentage
FROM
'file://whatever'
GROUP BY
Something
The online GUI is somewhat useless for HTTP data sources because many of them don't allow access from all origins. Current plan is to use http://www.whateverorigin.org/ for HTTP data sources in the online GUI.
You can open them, but you can't close them.
Currently there are various datasource parameters in use:
format
path
(perhaps better named root)headers
skip
These are set in a kind of pseudo query string thing but that means, for an HTTP
datasource, they get mixed up with any true query string parameters. Instead, there should be some syntax for setting these parameters alongside the URI.
E.g.
FROM
{ "uri": "http://mydata.com/some.json", "root": "blah"}
Maybe it would be useful to be able to query the files in a folder without inspecting their content?
E.g.
SELECT @@File FROM 'file://my/folder?format=ignore' ORDER BY @@File.modifiedDate DESC
Maybe show recently saved queries on a home page
E.g. SELECT Thing AS whatever, blah.foo AS foo .. .
E.g. SELECT Thing FROM http://my-api/some-json
. Maybe with option to set some HTTP headers.
Check whether or not a property value is null:
SELECT Blah FROM Thing WHERE Blah IS NOT NULL
Use a replacement value if a property value is null: ISNULL(Blah, 'Default')
(TSQL-like) or SELECT Blah || 'Default'
(Javascript-like) or SELECT Blah ?? 'Default'
(C#-like).
This can use the normal HTTP datasource because there is no CORS issue. There should be some character in the url to indicate that the path is relative to the current domain. I'm leaning towards tilde (~
) as it's used that way in ASP.NET and it's a bit easier to spot than adding another /
.
E.g. http://~/Data/blah.json
E.g. SELECT * FROM 'file://somefolder'
where somefolder
contains one or more .json
files. Each file is treated as one item in the dataset. The filename for each item is available via some special property (e.g. @Filename
).
To filter the files or work with file extensions other than .json
, there could be a parameter which accepts something like a glob pattern. There could also be an option to enable/disable recursive folder searching.
Use Jison parse info to locate keywords, property names, functions, etc. and colour them in the console (or whatever UI there is)
Currently the source file has to consist of JSON objects separated by newlines. A true JSON file containing a JSON array should be supported too.
Allow JSON-like structures in SELECT
clause so that the output can take any form.
E.g.
SELECT
Input1,
{
Something: Input2
} AS Deep
FROM
...
Support some operations on strings such as substrings and regular expressions.
Basically copy the OVER keyword from n1ql which can be used to enumerate the children of each item. E.g.
SELECT
author.Name,
book.Name,
book.ISBN
FROM
'file://authors.json' as author
OVER author.Books AS book
For keywords and file paths
For demo/wiki purposes, it would be very useful to have the online GUI pre-populate the query editor with a JSOQL query from the query string.
E.g.
http://tastott.github.io/jsoql?query=SELECT%20*%20FROM%20%27file%3A%2F%2Fblah%27
Currently the parser chokes on this kind of thing:
SELECT Value + 1 FROM 'file://blah.json'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.