GithubHelp home page GithubHelp logo

vfisa / bigfunctions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from unytics/bigfunctions

0.0 0.0 0.0 6.64 MB

Supercharge BigQuery with BigFunctions

Home Page: https://unytics.io/bigfunctions/

License: MIT License

JavaScript 2.92% Python 69.28% CSS 1.86% HTML 24.46% Dockerfile 1.49%

bigfunctions's Introduction

logo_and_name

Open BigQuery Functions, SQL Superpowers

โฏ BigFunctions website โฎ



๐Ÿ”๏ธ What is BigFunctions?

BigFunctions is both:

  1. Open-Source BigQuery functions (๐Ÿ’ช hello SQL-superpowers) callable without install from any GCP project
  2. A framework to define, test, deploy, document and monitor your own BigQuery functions. Features:
    1. ๐Ÿ’š A standard to define BigQuery routines as yaml files be it sql/js/remote UDF or procedures
    2. ๐Ÿ’š bigfun CLI (Command Line Interface) to test, deploy, document and monitor these BigQuery routines in your project

๐Ÿ’ก Why BigFunctions?

BigQuery, with native and remote routines, is really powerful. BigFunctions take the most of that by offering ready-to-use functions with useful features for data-teams.

We believe no-one should be reinventing the wheel and open-source is the best way to fight against that. Hey Data-People! Let's share our work, help each other and inspire from each other. ๐Ÿ‘‰ Play and contribute to BigFunctions!


๐Ÿ‘€ Call public BigFunctions without install from you GCP project

All BigFunctions represented by a 'yaml' file in bigfunctions folder are automatically deployed in public datasets so that you can call them directly without install from your BigQuery project.

To explore available bigfunctions and to get started, visit BigFunctions website.


๐Ÿš€ Deploy BigFunctions in your GCP project

You can also deploy any bigfunction in your project! To deploy my_bigfunction defined in bigfunctions/my_bigfunction.yaml file, simply call:

bigfun deploy my_bigfunction

Details about bigfun command line are given below.


๐Ÿ’ฅ bigfun CLI

bigfun CLI (command-line-interface) facilitates BigFunctions development, test, deployment, documentation and monitoring.

Install bigfun ๐Ÿ› ๏ธ

Clone the repo and from the repo directory run:

virtualenv venv
. venv/bin/activate
pip install --editable .

Use bigfun ๐Ÿ”ฅ

$ bigfun --help
Usage: bigfun [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  deploy  Deploy BIGFUNCTION
  doc     Generate, serve and publish documentation
  test    Test BIGFUNCTION

Deploy you first function ๐Ÿ‘จโ€๐Ÿ’ป

  1. Make sure the gcloud command is installed on your computer
  2. Activate the application-default account with gcloud auth application-default login. A browser window should open, and you should be prompted to log into your Google account. Once you've done that, bigfun will use your oauth'd credentials to connect to BigQuery through BigQuery python client!
  3. Get permissions to edit a dataset DATASET in a project PROJECT and to run BigQuery queries in that project.

You should then be able to deploy the function is_email_valid by simply running

bigfun deploy PROJECT.DATASET.is_email_valid

Test it with ๐Ÿ‘€ select PROJECT.DATASET.is_email_valid('[email protected]') !


Deploy you first remote function โšก๏ธ

To deploy a remote function (e.g. python function), there are additional requirements in addition to the ones above.

  1. A Cloud Run service will be deployed to host the code (as seen here). So you must have permissions to deploy a Cloud Run service in your project PROJECT.
  2. gcloud CLI will be used directly to deploy the service (using gcloud run deploy). Then, make sure you are logged in with gcloud by calling: gcloud auth login. A browser window should also open, and you should be prompted to log into your Google account. WARNING: you read correctly: you have to authenticate twice. Once for bigquery python client (to deploy any function including remote as seen above.) and once now to use gcloud (to deploy a Cloud Run service).
  3. A BigQuery Remote Connection will be created to link BigQuery with the Cloud Run service. You then should have permissions to create a remote connection. BigQuery Connection Admin or BigQuery Admin roles have these permissions.
  4. A service account will be automatically created by Google along with the BigQuery Remote Connection. BigQuery will use this service account of the remote connection to invoke the Cloud Run service. You then must have the permission to authorize this service account to invoke the Cloud Run service. This permission is provided in the role roles/run.admin

You now should be able to deploy sentiment_score function by running

bigfun deploy PROJECT.DATASET.sentiment_score

To make this specific function work, you first must enable Google Cloud NLP API in your project PROJECT. You can then test it with ๐Ÿ‘€ select PROJECT.DATASET.sentiment_score('This is awesome!') !


Contribute

You are more than welcome to contribute by:

  • adding a โญ on this repo ๐Ÿ˜
  • reporting an issue here.
  • suggesting new functions here
  • adding/improving BigFunctions
  • improving the framework and bigfun CLI

See contributing instructions for more details.

Contributors

bigfunctions's People

Contributors

unytics avatar shivam221098 avatar sidalisadi avatar benjitab avatar lepinet avatar iasonastr avatar anatolec avatar furcypin avatar gpivette avatar jihene-cherif avatar thomasellyatt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.