Skip to content

Commit

Permalink
add TIMESTAMP column to pandas upload example (#2617)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tswast committed Dec 18, 2019
1 parent 9582dbc commit d0f83df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .kokoro/python2.7/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ action {
# Specify which tests to run
env_vars: {
key: "RUN_TESTS_SESSION"
value: "py2-2.7"
value: "py2"
}
10 changes: 10 additions & 0 deletions bigquery/pandas-gbq-migration/samples_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit d0f83df

Please sign in to comment.