Skip to main content

Query generator for Google BigQuery and other SQL environments

Project description

Build Status Coverage Status

Generate sophisticated query for Google BigQuery in simple way.

ARCHIVED

This project is archived and no longer maintained.

What is BQX?

BQX is a minimal query generator for Google BigQuery. It’s mainly intended for being used by data analysts / scientists who want to analyze big data.

BQX fires its power especially on making LONG and NESTED query. BigQuery doesn’t accept two or more queries at once so user has to make views or make terribly nested query. BQX’s features help you make long query preserving high readability. See example for its features and usage.

Requirements

  • Python 3.4 ~

Installing

pip install bqx

Example

>>> from bqx.query import Query as Q
>>> from bqx.parts import Table as T, Column as C
>>> from bqx.func import SUM
>>>
>>> shakespeare = T('publicdata:samples.shakespeare')
>>> word = C('word')
>>> q = Q().SELECT(word).FROM(shakespeare).LIMIT(10)
>>> print(q.getq())
SELECT word
FROM publicdata:samples.shakespeare
LIMIT 10

See example directory for more detailed examples.

License

This library is BSD-licensed.

Q&A

How can I use it?

Running example on REPL is good for getting started, and we suggest you to use BQX with front-ends like pandas for next step.

Is it only for BigQuery? How about MySQL or else?

It aims to generate query excecuted on BigQuery but it might be applied to other SQL environments because difference between plain SQL and BigQuery is small.

We are using some compute engines which can process SQL (and dialects) like BigQuery, Hadoop and Spark. So in near future, adding other SQL dialect is planned.

Why some functions are UPPERCASE?

The first reason is for avoiding collision with Python’s reserved words. The another reason is for SQL’s UPPERCASE manners.

Is it ready to use?

We hope it’s so. All main clauses are implemented from v0.2.0, but not fully tested by hand yet.

Where are documentations?

We’re sorry but documentation is not available right now. It will be published on ReadTheDocs.org soon. Stay tuned.

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

bqx-0.4.2.tar.gz (18.0 kB view details)

Uploaded Source

File details

Details for the file bqx-0.4.2.tar.gz.

File metadata

  • Download URL: bqx-0.4.2.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for bqx-0.4.2.tar.gz
Algorithm Hash digest
SHA256 cd2fd96e4dbb18907ee024a8d24a79c50a211f1f9ea59bddf6f1c362ea052acb
MD5 9ed3fa4ba8617a7613c461dbfc2696f3
BLAKE2b-256 7878f43b194eec1c34ba323eafff886165cb5287027697370f29effee2afe592

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