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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for another-bigquery-magic-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b00e11469cba3ef5664539d14b1451bf4aae4ab173caf7a7226d35c396f3fe0c |
|
MD5 | e898035a454ad81ecf41d3dacc04ac62 |
|
BLAKE2b-256 | 3e4ca56f8d11c013b0ca23beca278f76e92722f4ed6821030fb48472795e9c37 |
Close
Hashes for another_bigquery_magic-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb34e930365b5417e56e0a41468af6a845dc3f2dd7834c1db1ce0723ac79762f |
|
MD5 | 70380afbaa8ab34020b64f30c52dde89 |
|
BLAKE2b-256 | 0b745e5e4372fd3dd4e599e18f5d42965939affd070752f4d324a631455dae39 |