Skip to main content

Python wrapper for easy use of big query

Project description

PythonBQ

Python wrapper for easy use of big query

Features

  • Easily pull big query data from python

Setup

Make sure you have Python 3.7.x (or higher) installed on your system. You can download it here.

Installation

pip install pythonbq

Example

from pythonbq import pythonbq
myProject=pythonbq(
  bq_key_path='path/to/bq/key.json',
  project_id='myGoogleProjectID',
  legacy_sql=False
)
output=myProject.query(sql="""select * from myProjectTable""")

Documentation for pythonbq Functions

https://connor-makowski.github.io/pythonbq/pythonbq.html

Output Data

  • Output from the query function is returned as a list of dictionaries
    • This can be modified by specifying the argument out_type in your .query()
      • dict: list of dictionaries
      • list: list of lists (header as the first row)
      • raw: list of lists (with no header row)
      • EG:
        output=myProject.query(sql="""select * from myProjectTable""", out_type='list')
        
  • EG:
    query = """
        SELECT name FROM `bigquery-public-data.usa_names.usa_1910_2013`
        WHERE state = "TX"
        LIMIT 5
    """
    
    myProject = pythonbq(
        key_path='./private/bq_key.json',
    )
    output = myProject.query(sql=query)
    # output = [{'name': 'Mary'}, {'name': 'Roberta'}, {'name': 'Marguerite'}, {'name': 'Katie'}, {'name': 'Eunice'}]
    

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

pythonbq-1.0.0.tar.gz (4.7 kB view details)

Uploaded Source

File details

Details for the file pythonbq-1.0.0.tar.gz.

File metadata

  • Download URL: pythonbq-1.0.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.6

File hashes

Hashes for pythonbq-1.0.0.tar.gz
Algorithm Hash digest
SHA256 93f0f11a664cfb38c097ac009b3ccc9030f9ec8b5fb328a80d6b416dff7099d1
MD5 30cb6e4e4770e0e6a879c43d0e0fc66c
BLAKE2b-256 c717ac17b0e2c61251c5b0afbec7d23cf8cc7b501022df0ed75400dc15a4cf0c

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