Skip to main content

Python wrapper for easy use of big query

Project description

PythonBQ

PyPI version License: MIT

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pythonbq-1.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pythonbq-1.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pythonbq-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f1dee1c2a136fef7a12d5d22da048369aeb602ef6695838528f27f9a70bcf882
MD5 adaadcfef04ac2d82c7168ea879a710e
BLAKE2b-256 2b6478dca47c44e298257d24a3c098c7cb0486cd7924d8236313b4801445a1c7

See more details on using hashes here.

File details

Details for the file pythonbq-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pythonbq-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pythonbq-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85fd9b9ce229cae632690e3a0e2f3a9c5712f258ed6440256b48f8da5ea61d93
MD5 00626a7c10ff1cd8fd2eb2f9368c4a24
BLAKE2b-256 a7310d6b60133464d66fc6bf102d34b62b60633a731f77e92ad169dd225dbd21

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page