npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bluepineapple-nebbia-tech/query-tool

v1.0.1

Published

Introducing "query_tool" - a powerful and user-friendly npm package designed to simplify your data analysis. With its intuitive interface, you can easily select the desired databases, columns, and tables, and apply filters, dimensions, and measures to ana

Downloads

14

Readme

Query Tool

Introducing "query_tool" - a powerful and user-friendly npm package designed to simplify your data analysis. With its intuitive interface, you can easily select the desired databases, columns, and tables, and apply filters, dimensions, and measures to analyze your data. Whether you're a beginner or an experienced analyst, "query_tool" is the perfect tool for your data analysis needs.

Installation

npm i @bluepineapple-nebbia-tech/data-grid

Usage

import QueryTool from "@bluepineapple-nebbia-tech/query-tool";

...
databases = ['COMPANY_DB', 'SALES_DB']
tables = [
    {
        'database': 'COMPANY_DB',
        'tables': ['EMPLOYEES', 'DEPARTMENTS']
    },
    {
        'database': 'SALES_DB',
        'tables': ['CUSTOMERS', 'ORDERS']
    }
]
columns = [
    {
        'fqtn': 'COMPANY_DB.EMPLOYEES',
        'columns': ['ID', 'NAME', 'EMAIL', 'POSITION']
    },
    {
        'fqtn': 'COMPANY_DB.DEPARTMENTS',
        'columns': ['ID', 'NAME', 'LOCATION', 'MANAGER']
    },
    {
        'fqtn': 'SALES_DB.CUSTOMERS',
        'columns': ['ID', 'NAME', 'EMAIL', 'PHONE']
    },
    {
        'fqtn': 'SALES_DB.ORDERS',
        'columns': ['ID', 'PRODUCT', 'QUANTITY', 'DATE']
    }
]


<QueryTool
    title="Query Tool"
    database_list={databases}
    table_list={tables}
    column_list={columns}
    query="Select * from QueryTool where query_tool = 'query_tool ' and database = 123"
    error=""
    show_execute={true},
    onChange={(data) => {}}
  />

API

Properties

| Property | Description | | ------------- | :-------------------------------------------: | | title | The title of the query tool. | | query | The query to be showned in the query section. | | database_list | An array of available databases. | | table_list | An array of available tables. | | column_list | An array of available columns. | | show_execute | Show execute button below the query section. | | error | Error to show on the ui |

Methods

| Method | Parameters | Usage | | -------- | :--------- | :--------------------------------------------------------: | | onChange | data | Data format will be change as per action | | onResize | | A callback function called when the query tool is resized. |

onChange

1. Database Change

data: { action: 'database_change', database: '{selected_database}':}

Usage:

    <QueryTool
       ...
       onChange={(data) => {
        console.log(data);
        //output - { action: 'database_change', database: '{selected_database}' }
       }}
    />

2. Table Change

data: { action: 'database_change', database: '{selected_database}', table: '{selected_table}' }

Usage:

    <QueryTool
       ...
       onChange={(data) => {
        console.log(data);
        //output - { action: 'database_change', database: '{selected_database}', table: '{selected_table}' }
       }}
    />

3. Preview Query

data: { action: 'preview_query', entity_data: [], filter_data: [], dimension_data: [] }

Usage:

    <QueryTool
       ...
       onChange={(data) => {
        console.log(data);
        //output - {  action: 'preview_query', entity_data: [], filter_data: [], dimension_data: [], options: { limit: 100 } }
       }}
    />

Data format:

1. entity_data
[
  {
    "database": "COMPANY_DB",
    "table": "EMPLOYEES",
    "columns": [
      "ID",
      "EMAIL",
      "NAME",
      "SKILLS"
    ],
    "relationship": [],
    "id": "f3f409ad-ea87-4016-b56d-890292c14caa"
  },
  {
    "database": "COMPANY_DB",
    "table": "DEPARTMENTS",
    "columns": [
      "ID",
      "EMAIL",
      "NAME",
      "SKILLS"
    ],
    "relationship": [
      {
        "id": "7fdf54d1-ca78-4186-9076-d981159a1d85",
        "leftColumnFqcn": "ID",
        "joinType": "LEFT JOIN",
        "rightColumnDatabase": "COMPANY_DB",
        "rightColumnTable": "EMPLOYEES",
        "rightColumnColumn": "ID"
      }
    ],
    "id": "2490bd73-0d37-4361-ba50-2d9efb2b671a"
  }
]
2. filter_data
[
  {
    "fqcn": "BLUEPINEAPPLE.PES.DEVELOPERS.SKILLS",
    "operator": "LIKE",
    "value": "ReactJS",
    "id": "fe27d318-3535-4605-a8ae-c723db39703d",
    "connector": "",
    "filtersList": [
      {
        "fqcn": "BLUEPINEAPPLE.PES.DEVELOPERS.NAME",
        "operator": "NO"
      }
    ]
  }
]
3. dimension_data
[
  {
    "dimension": "GROUP BY",
    "database": "BLUEPINEAPPLE",
    "table": "PES.DEVELOPERS",
    "column": "ID",
    "measures": [
      {
        "id": "60273711-ac85-474a-be21-bf1a292ee796",
        "fqcn": "BLUEPINEAPPLE.PES.DEVELOPERS.EMAIL",
        "measure": "COUNT"
      }
    ],
    "id": "852b1a34-87aa-4674-b618-cb66a3577230"
  }
]
4. Options
 { limit: 100 }
 // SQL query limit on number of records

4. Copy to Clipboard

data: { action: 'copy_to_clipboard', query: query }

Usage:

    <QueryTool
       ...
       onChange={(data) => {
        console.log(data);
        //output - { action: 'copy_to_clipboard', query: query }
       }}
    />