Newbies Pass Muster

    This package has been deprecated

    Author message:

    New package name: knex-bigquery

    @avian-aero/knex-bigquery

    1.0.1 • Public • Published

    BigQuery Dialect for Knex.js

    BigQuery dialect for building and executing queries using Knex.js.

    This library is in early stages of development. Use at your own risk.

    Installation

    # Yarn:
    yarn add @avian-aero/knex-bigquery
    # NPM:
    npm install @avian-aero/knex-bigquery

    Usage

    const { BigQueryClient } = require('@avian-aero/knex-bigquery');
    const knex = require('knex')({
      client: BigQueryClient,
      connection: {
        projectId: 'bigquery-playground',
        keyFilename: '/Users/dumbledore/playground-credentials.json'
      },
      pool: { min: 0, max: 5 }
    });
    
    async function getCommonNames() {
      const commonNames = await knex('bigquery-public-data.usa_names.usa_1910_2013')
        .select('name', 'gender')
        .sum('number as total')
        .groupBy('name', 'gender')
        .orderBy('total', 'desc')
        .limit(3);
    
      console.log(commonNames);
      await knex.destroy();
    }
    getCommonNames();
    // [
    //   { name: 'James', gender: 'M', total: 4924235 },
    //   { name: 'John', gender: 'M', total: 4818746 },
    //   { name: 'Robert', gender: 'M', total: 4703680 },
    // ]

    Connection

    Connection settings are passed to the BigQuery client library constructor.
    Make sure you pass a valid properties combination.

    Install

    npm i @avian-aero/knex-bigquery

    DownloadsWeekly Downloads

    3

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    4.39 kB

    Total Files

    6

    Last publish

    Collaborators

    • oran.avian