Skip to content

ENH: Add user-agent string when constructing BigQuery and BigQuery Storage API clients. #284

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

Merged
merged 6 commits into from
Jul 29, 2019

Conversation

tswast
Copy link
Collaborator

@tswast tswast commented Jul 25, 2019

Since this was a relatively new addition to the BigQuery client library,
only populate the user-agent for BigQuery when recent-enough versions of
google-cloud-bigquery and google-api-core are installed.

Closes #281.

tswast added 4 commits July 24, 2019 17:25
…orage API clients.

Since this was a relatively new addition to the BigQuery client library,
only populate the user-agent for BigQuery when recent-enough versions of
google-cloud-bigquery and google-api-core are installed.
@tswast
Copy link
Collaborator Author

tswast commented Jul 26, 2019

"nightly" failure is concerning.

__________________ TestReadGBQIntegration.test_zero_rows[env] __________________

self = <tests.system.test_gbq.TestReadGBQIntegration object at 0x7f7a2d683d68>
project_id = 'pandas-gbq-tests'

    def test_zero_rows(self, project_id):
        # Bug fix for https://github.com/pandas-dev/pandas/issues/10273
        df = gbq.read_gbq(
            "SELECT title, id, is_bot, "
            "SEC_TO_TIMESTAMP(timestamp) ts "
            "FROM [publicdata:samples.wikipedia] "
            "WHERE timestamp=-9999999",
            project_id=project_id,
            credentials=self.credentials,
            dialect="legacy",
        )
        empty_columns = {
            "title": pandas.Series([], dtype=object),
            "id": pandas.Series([], dtype=np.dtype(int)),
            "is_bot": pandas.Series([], dtype=np.dtype(bool)),
            "ts": pandas.Series([], dtype="datetime64[ns]"),
        }
        expected_result = DataFrame(
            empty_columns, columns=["title", "id", "is_bot", "ts"]
        )
        expected_result["ts"] = expected_result["ts"].dt.tz_localize("UTC")
>       tm.assert_frame_equal(df, expected_result, check_index_type=False)
E       AssertionError: Attributes are different
E       
E       Attribute "dtype" are different
E       [left]:  float64
E       [right]: object

Looks like we need to add a "STRING": "object" row to the map in _bqschema_to_nullsafe_dtypes

@tswast tswast merged commit 333d3cb into googleapis:master Jul 29, 2019
@tswast tswast deleted the issue281-user-agent branch July 29, 2019 16:39
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.

ENH: Add user-agent string when constructing BigQuery and BigQuery Storage API clients.
1 participant