Skip to main content

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'}]
    

Metadata

Release files for pythonbq 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pythonbq 1.1.0
File Size Uploaded
pythonbq-1.1.0.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pythonbq 1.1.0
File Interpreter ABI Platform
pythonbq-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / pythonbq-1.1.0.tar.gz

Download URL pythonbq-1.1.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f1dee1c2a136fef7a12d5d22da048369aeb602ef6695838528f27f9a70bcf882
BLAKE2b-256 checksum
How to use checksums
2b6478dca47c44e298257d24a3c098c7cb0486cd7924d8236313b4801445a1c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / pythonbq-1.1.0-py3-none-any.whl

Download URL pythonbq-1.1.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85fd9b9ce229cae632690e3a0e2f3a9c5712f258ed6440256b48f8da5ea61d93
BLAKE2b-256 checksum
How to use checksums
a7310d6b60133464d66fc6bf102d34b62b60633a731f77e92ad169dd225dbd21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page