ibis-bigquery


Nameibis-bigquery JSON
Version 2.2.1 PyPI version JSON
download
home_pagehttps://github.com/ibis-project/ibis-bigquery
SummaryIbis BigQuery backend
upload_time2023-01-03 23:06:38
maintainerTim Swast
docs_urlNone
authorIbis Contributors
requires_python>=3.7
licenseApache 2.0
keywords
VCS
bugtrack_url
requirements ibis-framework cached_property google-cloud-bigquery pydata-google-auth black pytest pytest-cov pytest-mock mock flake8 flake8-comprehensions mypy isort pydocstyle setuptools-scm types-pytz types-pkg_resources types-setuptools
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Ibis BigQuery backend
=====================

This package provides a `BigQuery <https://cloud.google.com/bigquery>`_ backend
for `Ibis <https://ibis-project.org/>`_.

Installation
------------

Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^
Python >= 3.7, < 3.11

Unsupported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Python < 3.7

Install with conda:

.. code-block:: console

    conda install -c conda-forge ibis-bigquery

Install with pip:

.. code-block:: console

    pip install ibis-bigquery

Usage
-----

Connecting to BigQuery
^^^^^^^^^^^^^^^^^^^^^^

Recommended usage (Ibis 2.x, only):

.. code-block:: python

    import ibis

    conn = ibis.bigquery.connect(
        project_id=YOUR_PROJECT_ID,
        dataset_id='bigquery-public-data.stackoverflow'
    )

Using this library directly:

.. code-block:: python

    import ibis
    import ibis_bigquery

    conn = ibis_bigquery.connect(
        project_id=YOUR_PROJECT_ID,
        dataset_id='bigquery-public-data.stackoverflow'
    )

Running a query
^^^^^^^^^^^^^^^

.. code-block:: python

    edu_table = conn.table(
        'international_education',
        database='bigquery-public-data.world_bank_intl_education')
    edu_table = edu_table['value', 'year', 'country_code', 'indicator_code']

    country_table = conn.table(
        'country_code_iso',
        database='bigquery-public-data.utility_us')
    country_table = country_table['country_name', 'alpha_3_code']

    expression = edu_table.join(
        country_table,
        [edu_table.country_code == country_table.alpha_3_code])

    print(conn.execute(
        expression[edu_table.year == 2016]
            # Adult literacy rate.
            [edu_table.indicator_code == 'SE.ADT.LITR.ZS']
            .sort_by([ibis.desc(edu_table.value)])
            .limit(20)
    ))

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ibis-project/ibis-bigquery",
    "name": "ibis-bigquery",
    "maintainer": "Tim Swast",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "swast@google.com",
    "keywords": "",
    "author": "Ibis Contributors",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/20/b6/77f34c2954c6b7207abea51ff16c1f3b72311f50002f9ab68e80ef8ecfe1/ibis-bigquery-2.2.1.tar.gz",
    "platform": null,
    "description": "Ibis BigQuery backend\n=====================\n\nThis package provides a `BigQuery <https://cloud.google.com/bigquery>`_ backend\nfor `Ibis <https://ibis-project.org/>`_.\n\nInstallation\n------------\n\nSupported Python Versions\n^^^^^^^^^^^^^^^^^^^^^^^^^\nPython >= 3.7, < 3.11\n\nUnsupported Python Versions\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\nPython < 3.7\n\nInstall with conda:\n\n.. code-block:: console\n\n    conda install -c conda-forge ibis-bigquery\n\nInstall with pip:\n\n.. code-block:: console\n\n    pip install ibis-bigquery\n\nUsage\n-----\n\nConnecting to BigQuery\n^^^^^^^^^^^^^^^^^^^^^^\n\nRecommended usage (Ibis 2.x, only):\n\n.. code-block:: python\n\n    import ibis\n\n    conn = ibis.bigquery.connect(\n        project_id=YOUR_PROJECT_ID,\n        dataset_id='bigquery-public-data.stackoverflow'\n    )\n\nUsing this library directly:\n\n.. code-block:: python\n\n    import ibis\n    import ibis_bigquery\n\n    conn = ibis_bigquery.connect(\n        project_id=YOUR_PROJECT_ID,\n        dataset_id='bigquery-public-data.stackoverflow'\n    )\n\nRunning a query\n^^^^^^^^^^^^^^^\n\n.. code-block:: python\n\n    edu_table = conn.table(\n        'international_education',\n        database='bigquery-public-data.world_bank_intl_education')\n    edu_table = edu_table['value', 'year', 'country_code', 'indicator_code']\n\n    country_table = conn.table(\n        'country_code_iso',\n        database='bigquery-public-data.utility_us')\n    country_table = country_table['country_name', 'alpha_3_code']\n\n    expression = edu_table.join(\n        country_table,\n        [edu_table.country_code == country_table.alpha_3_code])\n\n    print(conn.execute(\n        expression[edu_table.year == 2016]\n            # Adult literacy rate.\n            [edu_table.indicator_code == 'SE.ADT.LITR.ZS']\n            .sort_by([ibis.desc(edu_table.value)])\n            .limit(20)\n    ))\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Ibis BigQuery backend",
    "version": "2.2.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "95b450657f9a0c067c3834c867b6569eaa4f238ae43d0042eefe09920444e043",
                "md5": "e784955cb6dd2c69bab913d2e9090e9b",
                "sha256": "1718c11d57cfc084967bf76ccdf08cc7e2d9fbc6b1bfe14e9eb373cbbe4c23ab"
            },
            "downloads": -1,
            "filename": "ibis_bigquery-2.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e784955cb6dd2c69bab913d2e9090e9b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 34403,
            "upload_time": "2023-01-03T23:06:37",
            "upload_time_iso_8601": "2023-01-03T23:06:37.260903Z",
            "url": "https://files.pythonhosted.org/packages/95/b4/50657f9a0c067c3834c867b6569eaa4f238ae43d0042eefe09920444e043/ibis_bigquery-2.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "20b677f34c2954c6b7207abea51ff16c1f3b72311f50002f9ab68e80ef8ecfe1",
                "md5": "1c959fa1e2ac540d3cf41852c50d437d",
                "sha256": "1d94c64b8803b07f7dce41027238c727e9f38ccbcc951496f62aeb0898e2a3e4"
            },
            "downloads": -1,
            "filename": "ibis-bigquery-2.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1c959fa1e2ac540d3cf41852c50d437d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 49937,
            "upload_time": "2023-01-03T23:06:38",
            "upload_time_iso_8601": "2023-01-03T23:06:38.898661Z",
            "url": "https://files.pythonhosted.org/packages/20/b6/77f34c2954c6b7207abea51ff16c1f3b72311f50002f9ab68e80ef8ecfe1/ibis-bigquery-2.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-03 23:06:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "ibis-project",
    "github_project": "ibis-bigquery",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "ibis-framework",
            "specs": []
        },
        {
            "name": "cached_property",
            "specs": []
        },
        {
            "name": "google-cloud-bigquery",
            "specs": []
        },
        {
            "name": "pydata-google-auth",
            "specs": []
        },
        {
            "name": "black",
            "specs": [
                [
                    "==",
                    "22.3.0"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": []
        },
        {
            "name": "pytest-cov",
            "specs": []
        },
        {
            "name": "pytest-mock",
            "specs": []
        },
        {
            "name": "mock",
            "specs": []
        },
        {
            "name": "flake8",
            "specs": []
        },
        {
            "name": "flake8-comprehensions",
            "specs": []
        },
        {
            "name": "mypy",
            "specs": []
        },
        {
            "name": "isort",
            "specs": []
        },
        {
            "name": "pydocstyle",
            "specs": []
        },
        {
            "name": "setuptools-scm",
            "specs": []
        },
        {
            "name": "types-pytz",
            "specs": []
        },
        {
            "name": "types-pkg_resources",
            "specs": []
        },
        {
            "name": "types-setuptools",
            "specs": []
        }
    ],
    "lcname": "ibis-bigquery"
}
        
Elapsed time: 0.02580s