open-index/open-npm huggingface dataset:
npm package: @shiftfour/plywood
Description: A query planner and executor
Author: Shift Four
Latest version: 0.21.5

# Plywood

Plywood is a JavaScript library that simplifies building interactive
visualizations and applications for large data sets. Plywood acts as a
middle-layer between data visualizations and data stores.

Plywood is architected around the principles of nested
[Split-Apply-Combine](http://www.jstatsoft.org/article/view/v040i01/v40i01.pdf),
a powerful divide-and-conquer algorithm that can be used to construct all types
of data visualizations. Plywood comes with its own [expression
language](docs/expressions.md) where a single Plywood expression can
translate to multiple database queries, and where results are returned in a
nested data structure so they can be easily consumed by visualization libraries
such as [D3.js](http://d3js.org/). 

You can use Plywood in the browser and/or in node.js to easily create your own
visualizations and applications.

Plywood also acts as a very advanced query planner for Druid, and Plywood will
determine the most optimal way to execute Druid queries.

## Installation

To use Plywood from npm simply run: `npm install plywood`.

Plywood can also be used by the browser.

## Documentation

To learn more, see [http://plywood.imply.io](http://plywood.imply.io/)

## Also see

* [Pivot](http://pivot.imply.io) - a data exploration GUI built using Plywood.
* [PlyQL](https://github.com/implydata/plyql) - a SQL-like interface to plywood
* Vadim Ogievetsky talks about the [inspiration behind Plywood](https://www.youtube.com/watch?v=JNMbLxqzGFA)

## Development

To run all the Plywood unit tests you will need to set up the data sources in the [DataZoo](https://github.com/implydata/datazoo).  

## Questions & Support

For updates about new and upcoming features follow [@implydata](https://twitter.com/implydata) on Twitter.

Please file bugs and feature requests by opening and issue on GitHub and direct all questions to our [user groups](https://groups.google.com/forum/#!forum/imply-user-group).
npm package: @shiftfour/plywood-druid-requester
Description: Druid requester for Plywood (within node)
Author: Shift Four
Latest version: 2.6.1-bi.0

# plywood-druid-requester

This is the [Druid](http://druid.io/) requester making abstraction layer for [plywood](https://github.com/implydata/plywood).

Given a Druid query and an optional context it return a Q promise that resolves to the Druid data.

## Installation

To install run:

```
npm install plywood-druid-requester
```

## Usage

In the raw you could use this library like so:

```
druidRequesterGenerator = require('plywood-druid-requester').druidRequester

druidRequester = druidRequesterGenerator({
  host: 'my.druid.host' // This better be a link to a bard
})

druidRequester({
  query: {
    "queryType": "maxTime",
    "dataSource": 'wikipedia_editstream'
  }
})
  .then(function(res) {
    console.log("The maxTime is:", res[0].result)
  })
  .done()
```

Although usually you would just pass `druidRequester` into the Druid driver that is part of Plywood.

## Druid API extension

### Removing GETs

In Druid most requests are made using POST.

For inconvenient reasons there are some requests that are made using GET.
Specifically the request to list data sources in the cluster (`GET http://$host/druid/v2/`) and the request
to list the dimensions and metrics of a data source (`GET http://$host/druid/v2/$datasource`). Both of these are
'fixed' here by introducing two new query types:

```json
{
  "queryType": "introspect",
  "dataSource": "some_data_source"
}
```

and

```json
{
  "queryType": "sourceList"
}
```

By introducing these pseudo query types it allows this requester to abstract away the idea of POST and GET and just
pretend (as far as the user is concerned that Druid simply (asynchronously) exchanges one blob of JSON for another.

### Is the data really there?

In Druid certain queries (like the timeseries) will return `[]` both if there is no data for the given filter and if
the data source outright does not exist. This can be very inconvenient if you want to show meaningful errors to users
down the line.

To counteract that this requester will explicitly make an introspection query to find out if the datasource is listed
or not whenever the query returned `[]`.

There is currently no way to disable this check (that makes an extra query). If you have a use case for why this check
should not exist please submit an issue.

## Tests

This is a bit of an incomplete part of this project. Currently the tests run against an actual Druid cluster.
In fact they run against the Metamarkets demo cluster (that is maintained by Druid team members `<3` ).
The data source being queried is the `wikipedia_editstream` data source that is the subject of
[one of the Druid tutorials](http://druid.io/docs/0.6.171/Tutorial:-Loading-Your-Data-Part-1.html).
For now, if you are interested in contributing, you will have to set up such a Druid node yourself.

It is intended to make this part of the process easier somehow (ether by mocking the Druid cluster or otherwise).
npm package: @shiftfour/plywood-mysql-requester
Description: MySQL requester for Plywood (within node)
Author: Shift Four
Latest version: 2.3.1

# plywood-mysql-requester

This is the [MySQL](https://www.mysql.com/) requester making abstraction layer for [plywood](https://github.com/implydata/plywood).

Given a MySQL query and an optional context it return a Q promise that resolves to the data table.

## Installation

To install run:

```
npm install plywood-mysql-requester
```

## Usage

In the raw you could use this library like so:

```
mySqlRequesterGenerator = require('plywood-mysql-requester').mySqlRequester

mySqlRequester = mySqlRequesterGenerator({
  host: 'my.mysql.host',
  database: 'all_my_data',
  user: 'HeMan',
  password: 'By_the_Power_of_Greyskull'
})

mySqlRequester({
  query: 'SELECT `cut` AS "Cut", sum(`price`) AS "TotalPrice" FROM `diamonds` GROUP BY `cut`;'
})
  .then(function(res) {
    console.log("The first row is:", res[0])
  })
  .done()
```

Although usually you would just pass `mySqlRequester` into the MySQL driver that is part of Plywood.

## Tests

Currently the tests run against a real MySQL database that should be configured (database, user, password) the same as
what is indicated in `test/info.coffee`.