🐷 PygQuery
Multi-treaded wrapper to read and write Pandas dataframes with Google BigQuery without the hassle of the heavy BigQuery API.
PygQuery is multi-treaded by design, meaning that any SQL request is a thread of its own. The advantage of it is that you can send multiple requests in parallel, and have awaiting inbound data ready for later.
Install
On CLI, just type:
pip install pygquery
Read Data
Let's import the module first
from pygquery.bigquery import BigQueryReader
The module takes 3 arguments as an input:
request: A string of your query. E.g."""SELECT * FROM myproject.dataset.table"""project: The string of the project you are currently gathering data fromapi_key_path: a path of the G Service Account key, you can create one in the IAM tab of your GCP interface
Let's instantiate our data reader:
reader_dict = {
'request' : """SELECT * FROM myproject.dataset.table""",
'project' : 'myproject',
'api_key_path' : 'folder/key.json'
}
# If there any error in your query at the instantiation stage, BigQuery will let you know
my_request = BigQueryReader(**reader_dict)
Now you have an object ready to be launched. If the line of code above executes, you know that:
- There is no error in the SQL
- There is no credentials failure
Let's fire up this object:
my_request.start() # Launch the thread for downloading data
"# ... Do other things while data is downloading, like launching another request ... #"
my_request.join() # Tell to Python to wait for your download to complete
my_data = myRequest.data # Get your data
Et voilà! You have your data in Pandas DataFrame format ready to be crunched.
my_data.info()
my_data.head()
Metadata
Release files for PygQuery 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PygQuery-0.0.6.tar.gz | 3.3 kB | Without provenance | Details for PygQuery-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| PygQuery-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for PygQuery-0.0.6-py3-none-any.whl |
Total release size: 10.7 kB
Release files / PygQuery-0.0.6.tar.gz
| Download URL | PygQuery-0.0.6.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5dd845d042696cd510e67d637a19ed701009307ac2014084fd5407cb854f48bb
|
|
BLAKE2b-256 checksum How to use checksums |
f579337f5d9a286c45478166425737b8f434664b58bbf22ff159b68c6ce8ba0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Release files / PygQuery-0.0.6-py3-none-any.whl
| Download URL | PygQuery-0.0.6-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
043ae04fb6e2ca3bd05f086e5e40caa6b50638cac739055ef22f29f551f8171e
|
|
BLAKE2b-256 checksum How to use checksums |
90c9c0695b80211db0d2d9d91ed73239b72969262417b374bcd370f218075145
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Security for PygQuery 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.