Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

juttle-mysql-adapter

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

juttle-mysql-adapter

Juttle adapter for MySQL

  • 0.6.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
increased by1000%
Maintainers
2
Weekly downloads
 
Created
Source

Juttle MySQL Adapter

Build Status

MySQL adapter for the Juttle data flow language, with read & write support.

Examples

Read rows from your logs SQL table where the log level is info, with the default limit of 10000:

read mysql -table 'logs' level = 'info'

Perform an equivalent query using the raw option:

read mysql -raw 'select * from "logs" where "level" = "info" limit 10000'

Add a debug option to return the final SQL query instead (before any pagination):

read mysql -table 'logs' -debug true level = 'info'

will output: {query: 'select * from "logs" where "level" = 'info' limit 10000'}.

If you have time series data in your table, indicate the column with the timestamp using the timeField option to paginate and sort data correctly:

read mysql -timeField 'create_time' -table 'logs';
read mysql -timeField 'create_time' -table 'logs -from :2 days ago: -to :1 hour ago:;

The content of the column indicated by timeField will appear as the time field in resulting points.

Installation

Like Juttle itself, the adapter is installed as a npm package. Both Juttle and the adapter need to be installed side-by-side:

$ npm install juttle
$ npm install juttle-mysql-adapter

Configuration

The adapter needs to be registered and configured so that it can be used from within Juttle. To do so, add credentials like the following to your ~/.juttle/config.json file:

{
    "adapters": {
        "mysql": {
            "user": "root",
            "password": "password",
            "host": "localhost",
            "db": "test"
        }
    }
}

More documentation on the connection object can be found in the knex.js documentation

Usage

Read options

NameTypeRequiredDescription
tablestringyestable to query
rawstringnosend a raw SQL query to MySQL
debugbooleannooutput a query corresponding to current set of options and filters
timeFieldstringnoassume datetime column, to and from options will use this to limit rows by time
fetchSizeintegernorow limit, defaults to 10000 records
frommomentnoselect points after this time (inclusive)
tomomentnoselect points before this time (exclusive)
dbstringnoselect the database name to use in your instance
idstringnoselect the config instance to use

Write options

NameTypeRequiredDescription
tablestringyestable to write points into
dbstringnoselect the database name to use in your instance
idstringnoselect the config instance to use

Contributing

Contributions are welcome! Please file an issue or open a pull request.

To check code style and run unit tests:

npm test

Both are run automatically by Travis.

Keywords

FAQs

Package last updated on 25 Mar 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc