Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLN: Use
to_dataframe
to download query results. (#247)
* CLN: Use `to_dataframe` to download query results. This allows us to remove logic for parsing the schema and align with google-cloud-bigquery. * Bumps the minimum google-cloud-bigquery version, because we need to use the new dtypes argument. * Cast to correct dtype in empty dataframes. * Improve the conda CI build to truly use dependencies from conda, not pip. Adds pydata-google-auth to conda deps.
- Loading branch information
Showing
12 changed files
with
178 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# pandas-gbq benchmarks | ||
|
||
This directory contains a few scripts which are useful for performance | ||
testing the pandas-gbq library. Use cProfile to time the script and see | ||
details about where time is spent. To avoid timing how long BigQuery takes to | ||
execute a query, run the benchmark twice to ensure the results are cached. | ||
|
||
## `read_gbq` | ||
|
||
Read a small table (a few KB). | ||
|
||
python -m cProfile --sort=cumtime read_gbq_small_results.py | ||
|
||
Read a large-ish table (100+ MB). | ||
|
||
python -m cProfile --sort=cumtime read_gbq_large_results.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import pandas_gbq | ||
|
||
# Select 163 MB worth of data, to time how long it takes to download large | ||
# result sets. | ||
df = pandas_gbq.read_gbq( | ||
"SELECT * FROM `bigquery-public-data.usa_names.usa_1910_2013`", | ||
dialect="standard", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import pandas_gbq | ||
|
||
# Select a few KB worth of data, to time downloading small result sets. | ||
df = pandas_gbq.read_gbq( | ||
"SELECT * FROM `bigquery-public-data.utility_us.country_code_iso`", | ||
dialect="standard", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
pandas==0.19.0 | ||
google-auth==1.4.1 | ||
google-auth-oauthlib==0.0.1 | ||
google-cloud-bigquery==0.32.0 | ||
google-cloud-bigquery==1.9.0 | ||
pydata-google-auth==0.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.