From d0f83df3604a6ec607698e636bbd2609301244b7 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Wed, 18 Dec 2019 11:12:13 -0800 Subject: [PATCH] add TIMESTAMP column to pandas upload example (#2617) * add TIMESTAMP column to pandas upload example So long as NULLs are not present, the pandas dtype to BigQuery data type auto conversion should work as intended. * tests: specify session py2 instead of py2-2.7 --- .kokoro/python2.7/common.cfg | 2 +- bigquery/pandas-gbq-migration/samples_test.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.kokoro/python2.7/common.cfg b/.kokoro/python2.7/common.cfg index 5263e6100c94..50efb8410ceb 100644 --- a/.kokoro/python2.7/common.cfg +++ b/.kokoro/python2.7/common.cfg @@ -39,5 +39,5 @@ action { # Specify which tests to run env_vars: { key: "RUN_TESTS_SESSION" - value: "py2-2.7" + value: "py2" } diff --git a/bigquery/pandas-gbq-migration/samples_test.py b/bigquery/pandas-gbq-migration/samples_test.py index b237234f6b15..5a99c02cf1e9 100644 --- a/bigquery/pandas-gbq-migration/samples_test.py +++ b/bigquery/pandas-gbq-migration/samples_test.py @@ -216,6 +216,11 @@ def test_client_library_upload_from_dataframe(temp_dataset): 'my_string': ['a', 'b', 'c'], 'my_int64': [1, 2, 3], 'my_float64': [4.0, 5.0, 6.0], + 'my_timestamp': [ + pandas.Timestamp("1998-09-04T16:03:14"), + pandas.Timestamp("2010-09-13T12:03:45"), + pandas.Timestamp("2015-10-02T16:00:00") + ], } ) client = bigquery.Client() @@ -254,6 +259,11 @@ def test_pandas_gbq_upload_from_dataframe(temp_dataset): 'my_string': ['a', 'b', 'c'], 'my_int64': [1, 2, 3], 'my_float64': [4.0, 5.0, 6.0], + 'my_timestamp': [ + pandas.Timestamp("1998-09-04T16:03:14"), + pandas.Timestamp("2010-09-13T12:03:45"), + pandas.Timestamp("2015-10-02T16:00:00") + ], } ) table_id = 'my_dataset.new_table'