Skip to main content

Unofficial IPython magic command for bigquery

Project description

Unofficial BigQuery Magic Command

Installation

# from pypi
$ pip install another-bigquery-magic

# alternatively, from github
$ git clone https://github.com/kota7/another-bigquery-magic.git --depth 1
$ pip install -U ./another-bigquery-magic

Usage

# Set the project ID
project_id = "<project-id>"
!gcloud config set project {project_id}

# Load the bq magic command
%load_ext bq

# If already authenticated, we can run a query as below:
%bq SELECT 1 AS test

Example of authentication methods

# Authentication on colab
from google.colab import auth
auth.authenticate_user()

# Authentication by user log-in
# Note: to access external table with google drive, we also need "https://www.googleapis.com/auth/drive" in the scope
!gcloud auth application-default login --scopes="https://www.googleapis.com/auth/bigquery"

# Authentication with a local json file
jsonfile = "<json-file-path>"
%config BigqueryMagic.localjson = jsonfile

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

another-bigquery-magic-0.1.1.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

another_bigquery_magic-0.1.1-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page