Metadata-Version: 2.1
Name: bigquery-magics
Version: 0.3.0
Summary: Google BigQuery magics for Jupyter and IPython
Home-page: https://github.com/googleapis/python-bigquery-magics
Author: Google LLC
Author-email: googleapis-packages@google.com
License: Apache 2.0
Platform: Posix; MacOS X; Windows
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet
Requires-Python: >=3.7
License-File: LICENSE
Requires-Dist: db-dtypes <2.0.0dev,>=0.3.0
Requires-Dist: google-cloud-bigquery <4.0.0dev,>=3.13.0
Requires-Dist: ipywidgets >=7.7.1
Requires-Dist: ipython >=7.23.1
Requires-Dist: ipykernel >=5.5.6
Requires-Dist: packaging >=20.0.0
Requires-Dist: pandas >=1.1.0
Requires-Dist: pyarrow >=3.0.0
Requires-Dist: pydata-google-auth >=1.5.0
Requires-Dist: tqdm <5.0.0dev,>=4.7.4
Provides-Extra: all
Requires-Dist: google-cloud-bigquery-storage <3.0.0dev,>=2.6.0 ; extra == 'all'
Requires-Dist: grpcio <2.0dev,>=1.47.0 ; extra == 'all'
Requires-Dist: bigframes >=1.17.0 ; extra == 'all'
Requires-Dist: grpcio <2.0dev,>=1.49.1 ; (python_version >= "3.11") and extra == 'all'
Provides-Extra: bigframes
Requires-Dist: bigframes >=1.17.0 ; extra == 'bigframes'
Provides-Extra: bqstorage
Requires-Dist: google-cloud-bigquery-storage <3.0.0dev,>=2.6.0 ; extra == 'bqstorage'
Requires-Dist: grpcio <2.0dev,>=1.47.0 ; extra == 'bqstorage'
Requires-Dist: grpcio <2.0dev,>=1.49.1 ; (python_version >= "3.11") and extra == 'bqstorage'

IPython Magics for BigQuery
===========================

|GA| |pypi| |versions|

Querying massive datasets can be time consuming and expensive without the
right hardware and infrastructure. Google `BigQuery`_ solves this problem by
enabling super-fast, SQL queries against append-mostly tables, using the
processing power of Google's infrastructure.

-  `Library Documentation`_
-  `Product Documentation`_

.. |GA| image:: https://img.shields.io/badge/support-GA-gold.svg
   :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability
.. |pypi| image:: https://img.shields.io/pypi/v/bigquery-magics.svg
   :target: https://pypi.org/project/bigquery-magics/
.. |versions| image:: https://img.shields.io/pypi/pyversions/bigquery-magics.svg
   :target: https://pypi.org/project/bigquery-magics/
.. _BigQuery: https://cloud.google.com/bigquery/what-is-bigquery
.. _Library Documentation: https://googleapis.dev/python/bigquery-magics/latest
.. _Product Documentation: https://cloud.google.com/bigquery/docs/reference/v2/

Quick Start
-----------

In order to use this library, you first need to go through the following steps:

1. `Select or create a Cloud Platform project.`_
2. `Enable billing for your project.`_
3. `Enable the Google Cloud BigQuery API.`_
4. `Setup Authentication.`_

.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
.. _Enable the Google Cloud BigQuery API.:  https://cloud.google.com/bigquery
.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html

Installation
~~~~~~~~~~~~

Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to
create isolated Python environments. The basic problem it addresses is one of
dependencies and versions, and indirectly permissions.

With `virtualenv`_, it's possible to install this library without needing system
install permissions, and without clashing with the installed system
dependencies.

.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/


Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^
Python >= 3.7

Unsupported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Python == 3.5, Python == 3.6.


Mac/Linux
^^^^^^^^^

.. code-block:: console

    pip install virtualenv
    virtualenv <your-env>
    source <your-env>/bin/activate
    <your-env>/bin/pip install bigquery-magics


Windows
^^^^^^^

.. code-block:: console

    pip install virtualenv
    virtualenv <your-env>
    <your-env>\Scripts\activate
    <your-env>\Scripts\pip.exe install bigquery-magics

Example Usage
-------------

To use these magics, you must first register them. Run the ``%load_ext bigquery_magics``
in a Jupyter notebook cell.

.. code-block::

    %load_ext bigquery_magics

Perform a query
~~~~~~~~~~~~~~~

.. code:: python

    %%bigquery
    SELECT name, SUM(number) as count
    FROM 'bigquery-public-data.usa_names.usa_1910_current'
    GROUP BY name
    ORDER BY count DESC
    LIMIT 3
