Skip to main content

Unofficial IPython magic command for bigquery

Project description

another-bigquery-magic

Unofficial bigquery magic Command for IPython notebook

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 = "<google-cloud-project-id>"
!gcloud config set project {project_id}
# If you are authenticated to the google cloud already, skip this cell.
# Otherwise, authenticate with your choice of method.

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

# Example 2. 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"

# Example 3. Authentication with a local json file
jsonfile = "<json-file-path>"
%config BigqueryMagic.localjson = jsonfile
# Load the bq magic command
%load_ext bq

# %bq magic command runs the query and returns the pandas data frame
%bq SELECT 1 AS test
Start query at 2024-01-12 15:31:07.286991
End query at 2024-01-12 15:31:10.047083 (Execution time: 0:00:02.760092, Processed: 0.0 GB)
test
0 1

See example.ipynb for more examples.

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.3.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

another_bigquery_magic-0.1.3-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file another-bigquery-magic-0.1.3.tar.gz.

File metadata

File hashes

Hashes for another-bigquery-magic-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b00e11469cba3ef5664539d14b1451bf4aae4ab173caf7a7226d35c396f3fe0c
MD5 e898035a454ad81ecf41d3dacc04ac62
BLAKE2b-256 3e4ca56f8d11c013b0ca23beca278f76e92722f4ed6821030fb48472795e9c37

See more details on using hashes here.

File details

Details for the file another_bigquery_magic-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for another_bigquery_magic-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cb34e930365b5417e56e0a41468af6a845dc3f2dd7834c1db1ce0723ac79762f
MD5 70380afbaa8ab34020b64f30c52dde89
BLAKE2b-256 0b745e5e4372fd3dd4e599e18f5d42965939affd070752f4d324a631455dae39

See more details on using hashes here.

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