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

vega-transform-db

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-transform-db

Vega transform for databases

  • 1.0.12
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

vega-transform-db

Data transform to load data from a database in Vega.

This package extends Vega's set of data transforms to support loading data from a database in Vega version 5.0 and higher.

Usage Instructions

Install the transform with

yarn add vega-transform-db

To use the transform, you must initially set the type. We currently aim to support 2 types of interaction with a database either via a middleware server or directly through a query function. So if you intend to use a server set the type to Server or Serverless if you're passing a query function, then register the transform as dbtransform.

import VegaTransformDB from "vega-transform-db"

VegaTransformDB.type('Serverless'); 
transforms["dbtransform"] = VegaTransformDB;

Further examples for using the package with a middleware server and with a serverless query function.

API Reference

# VegaTransformDB.type(type: string = "Serverless")

  • This function is used to indicate whether the transform will be interacting with a middleware server VegaTransformDB.type('Server') or not VegaTransformDB.type('Serverless')

# VegaTransformDB.QueryFunction(function)

  • If the type has been set to Serverless, this function is used to indicate which query function is to be used when a sql query is encountered.

# VegaTransformDB.setHttpOptions(object)

  • If the type has been set to Server, this function is used to set the Http POST request options, i.e,
const httpOptions = {
    'url': 'http://localhost:3000/query',
    'mode': 'cors',
    'method': 'POST',
    'headers': {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  };
VegaTransformDB.type('Server');
vega.transforms["dbtransform"] = VegaTransformDB;
VegaTransformDB.setHttpOptions(httpOptions);

This example indicates that when a query is to be executed it will send a POST request at http://localhost:3000/query with sql query.

Keywords

FAQs

Package last updated on 12 Apr 2023

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