Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Add ability to create datasets using the gbq module #11121

Closed

Conversation

parthea
Copy link
Contributor

@parthea parthea commented Sep 16, 2015

Removed the bq command line module from test_gbq.py, as it doesn't support python 3. In order to do this, I had to create functions for create_dataset(), delete_dataset() and dataset_exists().

This change is required for #11110

At the same time, I also implemented the following list functions: list_dataset() and list_table().

@parthea parthea force-pushed the allow-creation-of-gbq-datasets branch from 59b10cf to 72ea8be Compare September 16, 2015 04:29
@parthea
Copy link
Contributor Author

parthea commented Sep 16, 2015

The build failed on travis. I noticed an unusual error in the build log.
https://travis-ci.org/pydata/pandas/jobs/80567794

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "pandas/__init__.py", line 16, in <module>
    "extensions first.".format(module))
ImportError: C extension: hashtable not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.
nosetests --exe -A slow and not network and not disabled pandas --doctest-tests --with-xunit --xunit-file=/tmp/nosetests.xml
E
======================================================================
ERROR: Failure: ImportError (C extension: hashtable not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/miniconda/envs/pandas/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/travis/miniconda/envs/pandas/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/travis/miniconda/envs/pandas/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/travis/build/pydata/pandas/pandas/__init__.py", line 16, in <module>
    "extensions first.".format(module))
ImportError: C extension: hashtable not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.

@TomAugspurger
Copy link
Contributor

@parthea I restarted the build. Maybe it was a one-off failure.

@parthea parthea force-pushed the allow-creation-of-gbq-datasets branch 2 times, most recently from 4cf7ad3 to a846076 Compare September 16, 2015 12:53
@parthea
Copy link
Contributor Author

parthea commented Sep 16, 2015

Ready for review. All tests passed in my local environment,

nosetests test_gbq.py -v
test_should_be_able_to_get_a_bigquery_service (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_should_be_able_to_get_results_from_query (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_should_be_able_to_get_schema_from_query (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_should_be_able_to_get_valid_credentials (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_should_be_able_to_make_a_connector (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_bad_project_id (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_bad_table_name (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_column_order (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_column_order_plus_index (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_download_dataset_larger_than_200k_rows (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_index_column (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_malformed_query (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_arbitrary_timestamp (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_empty_strings (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_false_boolean (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_boolean (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_floats (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_integers (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_strings (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_timestamp (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_timestamp_unix_epoch (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_true_boolean (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_valid_floats (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_valid_integers (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_valid_strings (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_unicode_string_conversion_and_normalization (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_zero_rows (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_read_gbq_with_no_project_id_given_should_fail (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_booleans_as_python_booleans (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_floats_as_python_floats (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_integers_as_python_floats (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_strings_as_python_strings (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_timestamps_as_numpy_datetime (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_that_parse_data_works_properly (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_to_gbq_should_fail_if_invalid_table_name_passed (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_to_gbq_with_no_project_id_given_should_fail (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_create_bq_dataset (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_create_bq_table (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_dataset_does_not_exist (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_dataset_exists (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_delete_bq_dataset (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_delete_bq_table (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_generate_bq_schema (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_google_upload_errors_should_raise_exception (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_list_bq_dataset (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_list_bq_table (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_list_bq_table_zero_results (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_table_does_not_exist (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_upload_data (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_upload_data_if_table_exists_append (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_upload_data_if_table_exists_fail (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_upload_data_if_table_exists_replace (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
pandas.io.tests.test_gbq.test_requirements ... ok

----------------------------------------------------------------------
Ran 53 tests in 368.008s

@jreback
Copy link
Contributor

jreback commented Sep 17, 2015

@parthea travis is fixed. go ahead and rebase

@parthea
Copy link
Contributor Author

parthea commented Sep 17, 2015

@jreback
Could this make it into 0.17.0 ? It would helpful for my other PR #11110

@parthea parthea force-pushed the allow-creation-of-gbq-datasets branch from a846076 to 2487a45 Compare September 17, 2015 00:05
@jreback
Copy link
Contributor

jreback commented Sep 17, 2015

what does create_dataset do? what is the difference between this and a table?

list_table is ok.

@jreback
Copy link
Contributor

jreback commented Sep 17, 2015

why is this needed for #11110 ?

@parthea
Copy link
Contributor Author

parthea commented Sep 17, 2015

A table belongs to a dataset. In order to create a table, you must either have an existing dataset or create a new dataset.

Tables
https://cloud.google.com/bigquery/docs/reference/v2/tables

Datasets
https://cloud.google.com/bigquery/docs/reference/v2/datasets

From https://cloud.google.com/bigquery/what-is-bigquery#tables,
Datasets allow you to organize and control access to your tables. Because tables are contained in datasets, you'll need to create at least one dataset before loading data into BigQuery.

@parthea
Copy link
Contributor Author

parthea commented Sep 17, 2015

why is this needed for #11110 ?

The bq command line module doesn't support python 3. The bq command line module is currently used to create and delete datasets so unit tests will be broken in python 3 builds without the ability to create and delete datasets.

@jreback
Copy link
Contributor

jreback commented Sep 17, 2015

can you simply do this via a web interface? we are adding all of these functions which should be done externally to pandas.

@jreback
Copy link
Contributor

jreback commented Sep 17, 2015

separately I think we need to make the API's more explicit, e.g.

create_table
delete_table
table_exists

should these be

table_create
table_delete
table_exists

?

@parthea
Copy link
Contributor Author

parthea commented Sep 17, 2015

can you simply do this via a web interface?

Yes, it can be done through web interface. From the integration testing point of view, it would be easier to be able to create datasets programatically. Each time the test starts, there is a newly created dataset used for testing. The dataset is deleted programatically after the test.

One potential change could be to use the create and delete functions for unit testing purposes only without exposing the functionality globally.

@parthea
Copy link
Contributor Author

parthea commented Sep 17, 2015

table_create
table_delete
table_exists

Yes, I agree this is much better. I will commit a new version.

@jreback
Copy link
Contributor

jreback commented Sep 17, 2015

why don't we just advertise the GbqConnector as the main way to do things (and then you have methods you can call directly on it), e.g. create(), delete(), exists().

I would actually rename this to Table, then no problem with having an Dataset object as well.

e.g.

t = Table(project_id=....)
t.create()
t.delete()

@parthea
Copy link
Contributor Author

parthea commented Sep 17, 2015

sounds good! I'll commit a new version soon.

@parthea parthea force-pushed the allow-creation-of-gbq-datasets branch from 2487a45 to 8a4ff80 Compare September 17, 2015 21:33
@parthea parthea force-pushed the allow-creation-of-gbq-datasets branch from 8a4ff80 to fca6876 Compare September 17, 2015 21:42
@parthea
Copy link
Contributor Author

parthea commented Sep 17, 2015

Ready for review. All tests passed.

nosetests test_gbq.py -v
test_should_be_able_to_get_a_bigquery_service (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_should_be_able_to_get_results_from_query (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_should_be_able_to_get_schema_from_query (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_should_be_able_to_get_valid_credentials (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_should_be_able_to_make_a_connector (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_bad_project_id (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_bad_table_name (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_column_order (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_column_order_plus_index (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_download_dataset_larger_than_200k_rows (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_index_column (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_malformed_query (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_arbitrary_timestamp (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_empty_strings (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_false_boolean (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_boolean (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_floats (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_integers (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_strings (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_timestamp (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_timestamp_unix_epoch (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_true_boolean (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_valid_floats (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_valid_integers (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_valid_strings (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_unicode_string_conversion_and_normalization (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_zero_rows (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_read_gbq_with_no_project_id_given_should_fail (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_booleans_as_python_booleans (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_floats_as_python_floats (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_integers_as_python_floats (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_strings_as_python_strings (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_timestamps_as_numpy_datetime (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_that_parse_data_works_properly (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_to_gbq_should_fail_if_invalid_table_name_passed (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_to_gbq_with_no_project_id_given_should_fail (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_create_dataset (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_create_table (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_dataset_does_not_exist (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_dataset_exists (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_delete_dataset (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_delete_table (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_generate_schema (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_google_upload_errors_should_raise_exception (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_list_dataset (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_list_table (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_list_table_zero_results (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_table_does_not_exist (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_upload_data (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_upload_data_if_table_exists_append (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_upload_data_if_table_exists_fail (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_upload_data_if_table_exists_replace (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
pandas.io.tests.test_gbq.test_requirements ... ok

----------------------------------------------------------------------
Ran 53 tests in 458.258s

OK

"""

try:
list_dataset_response = self.service.datasets().list(projectId=self.project_id).execute().get('datasets',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use PEP on this, e.g.

...... = self.service.datasets().list(
              .......).execute(......)

@jreback jreback added this to the 0.17.0 milestone Sep 17, 2015
projectId=self.project_id,
datasetId=dataset_id).execute().get('tables', None)

if not list_table_response:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return []

@jreback
Copy link
Contributor

jreback commented Sep 24, 2015

@parthea ok, small API change and a doc check. ping when green. (also confirm that this passes locally for you ).

@aaront aaront force-pushed the allow-creation-of-gbq-datasets branch from c945510 to 7b00d8b Compare September 24, 2015 03:55
@aaront
Copy link
Contributor

aaront commented Sep 24, 2015

@jreback made the requested changes except for the generator, I don't want to rock the boat too much at the moment :)

The indentation in api.rst looks OK on my end.

My only concern at this point is that some public API was removed: create_table, delete_table, and table_exists are no longer part of the module. If this is OK, then all is go.

I've just made a commit for some fixups for some broken tests, as well.

Running all the gbq tests locally yields:

> nosetests test_gbq.py -v
test_should_be_able_to_get_a_bigquery_service (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_should_be_able_to_get_results_from_query (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_should_be_able_to_get_schema_from_query (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_should_be_able_to_get_valid_credentials (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_should_be_able_to_make_a_connector (pandas.io.tests.test_gbq.TestGBQConnectorIntegration) ... ok
test_bad_project_id (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_bad_table_name (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_column_order (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_column_order_plus_index (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_download_dataset_larger_than_200k_rows (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_index_column (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_malformed_query (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_arbitrary_timestamp (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_empty_strings (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_false_boolean (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_boolean (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_floats (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_integers (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_strings (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_null_timestamp (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_timestamp_unix_epoch (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_true_boolean (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_valid_floats (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_valid_integers (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_should_properly_handle_valid_strings (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_unicode_string_conversion_and_normalization (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_zero_rows (pandas.io.tests.test_gbq.TestReadGBQIntegration) ... ok
test_read_gbq_with_no_project_id_given_should_fail (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_booleans_as_python_booleans (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_floats_as_python_floats (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_integers_as_python_floats (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_strings_as_python_strings (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_should_return_bigquery_timestamps_as_numpy_datetime (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_that_parse_data_works_properly (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_to_gbq_should_fail_if_invalid_table_name_passed (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_to_gbq_with_no_project_id_given_should_fail (pandas.io.tests.test_gbq.TestReadGBQUnitTests) ... ok
test_create_dataset (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_create_table (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_dataset_does_not_exist (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_dataset_exists (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_delete_dataset (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_delete_table (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_generate_schema (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_google_upload_errors_should_raise_exception (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_list_dataset (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_list_table (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_list_table_zero_results (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_table_does_not_exist (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_upload_data (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_upload_data_if_table_exists_append (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_upload_data_if_table_exists_fail (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
test_upload_data_if_table_exists_replace (pandas.io.tests.test_gbq.TestToGBQIntegration) ... ok
pandas.io.tests.test_gbq.test_requirements ... ok

----------------------------------------------------------------------
Ran 53 tests in 429.681s

OK

Ping me if there's anything else needed.

cc: @parthea

@@ -111,9 +111,7 @@ Google BigQuery
read_gbq
to_gbq
generate_bq_schema
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should rename this as well. Can you deprecate generate_bq_schema, with a rename to generate_schema. (rename the function and provide the original as a wrapper witth the warning, then call the renamed)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deprecation is not needed as I think this is not yet in a release? (only added for 0.17.0)

But, I think this function is only useful in combination with a create_table function?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, it is from 0.15.2 (it was just not yet included in the stable api docs)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are making changes to generate_bq_schema, I was thinking
generate_bq_schema could be moved to a private function and removed from the docs. I'm not sure it will be used by many users and removing it would simplify the api.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure. let's just deprecate it then (put a note in the gbq section) & remove from API.rst

@jreback
Copy link
Contributor

jreback commented Sep 24, 2015

@aaront @parthea

My only concern at this point is that some public API was removed: create_table, delete_table, and table_exists are no longer part of the module. If this is OK, then all is go.

These only existed in master. They have not been released, so this is ok.

Just make the small change in the naming of generate_schema and I think good to go.

@@ -231,7 +240,8 @@ def run_query(self, query, verbose=True):
page_token = query_reply.get('pageToken', None)

if not page_token and current_row < total_rows:
raise InvalidPageToken("Required pageToken was missing. Recieved {0} of {1} rows".format(current_row, total_rows))
raise InvalidPageToken("Required pageToken was missing. Recieved {0} of {1} rows".format(current_row,
total_rows))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to wrap this line

@aaront
Copy link
Contributor

aaront commented Sep 24, 2015

@jreback all 53 tests pass locally again.

Ping me if you'd like me to squash these commits. Will ping when travis is green.

@aaront
Copy link
Contributor

aaront commented Sep 24, 2015

Got your comment about deprecating & removing after I had made the rename of generate_bq_schema. Will remove this from the docs and properly deprecate.

@jreback
Copy link
Contributor

jreback commented Sep 24, 2015

gr8. pls squash as well.

…1121

CLN: Make new API objects in the gbq module private and remove from documentation pandas-dev#11121

BUG: Handle GBQ datasets being empty and fix test_list_table test pandas-dev#11121

CLN: Deprecated generate_bq_schema in gbq module in favor of generate_schema pandas-dev#11121
@aaront aaront force-pushed the allow-creation-of-gbq-datasets branch from 008a9c9 to 5ba5375 Compare September 24, 2015 22:03
@aaront
Copy link
Contributor

aaront commented Sep 24, 2015

All tests passing locally after squash. Will ping when Travis is done.

jreback pushed a commit that referenced this pull request Sep 24, 2015
CLN: Make new API objects in the gbq module private and remove from documentation #11121

BUG: Handle GBQ datasets being empty and fix test_list_table test #11121

CLN: Deprecated generate_bq_schema in gbq module in favor of generate_schema #11121
@jreback
Copy link
Contributor

jreback commented Sep 24, 2015

merged via a5276cf
thanks!
I tweaked the deprecation a bit.

@jreback jreback closed this Sep 24, 2015
@parthea parthea deleted the allow-creation-of-gbq-datasets branch September 24, 2015 23:37
gfyoung added a commit to forking-repos/pandas that referenced this pull request Mar 10, 2017
Deprecated since 0.17.0

xref pandas-devgh-11121
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants