{"action":"created","comment":{"url":"https://api.github.com/repos/pydata/pandas/pulls/comments/39100634","id":39100634,"diff_hunk":"@@ -3965,72 +3982,173 @@ function.\n    # Can be found in the Google web console\n    projectid = \"xxxxxxxx\"\n \n-   data_frame = pd.read_gbq('SELECT * FROM test_dataset.test_table', project_id = projectid)\n+   data_frame = gbq.read_gbq('SELECT * FROM test_dataset.test_table', projectid)\n \n You will then be authenticated to the specified BigQuery account\n via Google's Oauth2 mechanism. In general, this is as simple as following the\n prompts in a browser window which will be opened for you. Should the browser not\n be available, or fail to launch, a code will be provided to complete the process\n manually.  Additional information on the authentication mechanism can be found\n-`here <https://developers.google.com/accounts/docs/OAuth2#clientside/>`__\n+`here <https://developers.google.com/accounts/docs/OAuth2#clientside/>`__.\n \n You can define which column from BigQuery to use as an index in the\n destination DataFrame as well as a preferred column order as follows:\n \n .. code-block:: python\n \n-   data_frame = pd.read_gbq('SELECT * FROM test_dataset.test_table',\n+   data_frame = gbq.read_gbq('SELECT * FROM test_dataset.test_table',\n                              index_col='index_column_name',\n-                             col_order=['col1', 'col2', 'col3'], project_id = projectid)\n-\n-Finally, you can append data to a BigQuery table from a pandas DataFrame\n-using the :func:`~pandas.io.to_gbq` function. This function uses the\n-Google streaming API which requires that your destination table exists in\n-BigQuery. Given the BigQuery table already exists, your DataFrame should\n-match the destination table in column order, structure, and data types.\n-DataFrame indexes are not supported. By default, rows are streamed to\n-BigQuery in chunks of 10,000 rows, but you can pass other chuck values\n-via the ``chunksize`` argument. You can also see the progess of your\n-post via the ``verbose`` flag which defaults to ``True``. The http\n-response code of Google BigQuery can be successful (200) even if the\n-append failed. For this reason, if there is a failure to append to the\n-table, the complete error response from BigQuery is returned which\n-can be quite long given it provides a status for each row. You may want\n-to start with smaller chunks to test that the size and types of your\n-dataframe match your destination table to make debugging simpler.\n+                             col_order=['col1', 'col2', 'col3'], projectid)\n+\n+.. note::\n+\n+    You can find your project id in the `BigQuery management console <https://code.google.com/apis/console/b/0/?noredirect>`__.\n+\n+\n+.. note::\n+\n+    You can toggle the verbose output via the ``verbose`` flag which defaults to ``True``.\n+\n+Writing DataFrames\n+''''''''''''''''''\n+\n+Assume we want to write a DataFrame ``df`` into a BigQuery table using :func:`~pandas.DataFrame.to_gbq`.\n \n .. code-block:: python\n \n-   df = pandas.DataFrame({'string_col_name' : ['hello'],\n-         'integer_col_name' : [1],\n-         'boolean_col_name' : [True]})\n-   df.to_gbq('my_dataset.my_table', project_id = projectid)\n+    df = pd.DataFrame({'my_string': list('abc'),\n+                      'my_int64': list(range(1, 4)),\n+                      'my_float64': np.arange(4.0, 7.0),\n+                      'my_bool1': [True, False, True],\n+                      'my_bool2': [False, True, False],\n+                      'my_dates': pd.date_range('now', periods=3).values})","path":"doc/source/io.rst","position":105,"original_position":105,"commit_id":"d5d184ee1d695ca5bfa2e4c672d73f8911a4e52e","original_commit_id":"d5d184ee1d695ca5bfa2e4c672d73f8911a4e52e","user":{"login":"jreback","id":953992,"avatar_url":"https://avatars.githubusercontent.com/u/953992?v=3","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"body":"don't use ``.values`` on the daterange (they would get inferred anyhow), just pass the index directly.","created_at":"2015-09-09T21:44:11Z","updated_at":"2015-09-09T21:44:11Z","html_url":"https://github.com/pydata/pandas/pull/10857#discussion_r39100634","pull_request_url":"https://api.github.com/repos/pydata/pandas/pulls/10857","_links":{"self":{"href":"https://api.github.com/repos/pydata/pandas/pulls/comments/39100634"},"html":{"href":"https://github.com/pydata/pandas/pull/10857#discussion_r39100634"},"pull_request":{"href":"https://api.github.com/repos/pydata/pandas/pulls/10857"}}},"pull_request":{"url":"https://api.github.com/repos/pydata/pandas/pulls/10857","id":42866453,"html_url":"https://github.com/pydata/pandas/pull/10857","diff_url":"https://github.com/pydata/pandas/pull/10857.diff","patch_url":"https://github.com/pydata/pandas/pull/10857.patch","issue_url":"https://api.github.com/repos/pydata/pandas/issues/10857","number":10857,"state":"open","locked":false,"title":"ENH: #8325 Add ability to create tables using the gbq module. ","user":{"login":"parthea1","id":13840251,"avatar_url":"https://avatars.githubusercontent.com/u/13840251?v=3","gravatar_id":"","url":"https://api.github.com/users/parthea1","html_url":"https://github.com/parthea1","followers_url":"https://api.github.com/users/parthea1/followers","following_url":"https://api.github.com/users/parthea1/following{/other_user}","gists_url":"https://api.github.com/users/parthea1/gists{/gist_id}","starred_url":"https://api.github.com/users/parthea1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parthea1/subscriptions","organizations_url":"https://api.github.com/users/parthea1/orgs","repos_url":"https://api.github.com/users/parthea1/repos","events_url":"https://api.github.com/users/parthea1/events{/privacy}","received_events_url":"https://api.github.com/users/parthea1/received_events","type":"User","site_admin":false},"body":"closes #8325 \r\n\r\n- Added ability to automatically create a table using the gbq.to_gbq function if destination table does not exist\r\n- Added ``gbq.gbq_table_exists()`` function to the gbq module \r\n- Added ``gbq.create_gbq_table()`` function to the gbq module ","created_at":"2015-08-19T21:29:11Z","updated_at":"2015-09-09T21:44:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e4fd2d85ee38e5e920fa55d330cb38783534afb0","assignee":null,"milestone":{"url":"https://api.github.com/repos/pydata/pandas/milestones/34","html_url":"https://github.com/pydata/pandas/milestones/0.17.0","labels_url":"https://api.github.com/repos/pydata/pandas/milestones/34/labels","id":1033710,"number":34,"title":"0.17.0","description":"","creator":{"login":"jreback","id":953992,"avatar_url":"https://avatars.githubusercontent.com/u/953992?v=3","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":475,"state":"open","created_at":"2015-03-23T10:47:38Z","updated_at":"2015-09-09T21:41:01Z","due_on":"2015-09-15T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/pydata/pandas/pulls/10857/commits","review_comments_url":"https://api.github.com/repos/pydata/pandas/pulls/10857/comments","review_comment_url":"https://api.github.com/repos/pydata/pandas/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/10857/comments","statuses_url":"https://api.github.com/repos/pydata/pandas/statuses/d5d184ee1d695ca5bfa2e4c672d73f8911a4e52e","head":{"label":"parthea:allow-creation-of-gbq-tables","ref":"allow-creation-of-gbq-tables","sha":"d5d184ee1d695ca5bfa2e4c672d73f8911a4e52e","user":{"login":"parthea","id":5184014,"avatar_url":"https://avatars.githubusercontent.com/u/5184014?v=3","gravatar_id":"","url":"https://api.github.com/users/parthea","html_url":"https://github.com/parthea","followers_url":"https://api.github.com/users/parthea/followers","following_url":"https://api.github.com/users/parthea/following{/other_user}","gists_url":"https://api.github.com/users/parthea/gists{/gist_id}","starred_url":"https://api.github.com/users/parthea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parthea/subscriptions","organizations_url":"https://api.github.com/users/parthea/orgs","repos_url":"https://api.github.com/users/parthea/repos","events_url":"https://api.github.com/users/parthea/events{/privacy}","received_events_url":"https://api.github.com/users/parthea/received_events","type":"User","site_admin":false},"repo":{"id":40974773,"name":"pandas","full_name":"parthea/pandas","owner":{"login":"parthea","id":5184014,"avatar_url":"https://avatars.githubusercontent.com/u/5184014?v=3","gravatar_id":"","url":"https://api.github.com/users/parthea","html_url":"https://github.com/parthea","followers_url":"https://api.github.com/users/parthea/followers","following_url":"https://api.github.com/users/parthea/following{/other_user}","gists_url":"https://api.github.com/users/parthea/gists{/gist_id}","starred_url":"https://api.github.com/users/parthea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parthea/subscriptions","organizations_url":"https://api.github.com/users/parthea/orgs","repos_url":"https://api.github.com/users/parthea/repos","events_url":"https://api.github.com/users/parthea/events{/privacy}","received_events_url":"https://api.github.com/users/parthea/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/parthea/pandas","description":"Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more","fork":true,"url":"https://api.github.com/repos/parthea/pandas","forks_url":"https://api.github.com/repos/parthea/pandas/forks","keys_url":"https://api.github.com/repos/parthea/pandas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/parthea/pandas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/parthea/pandas/teams","hooks_url":"https://api.github.com/repos/parthea/pandas/hooks","issue_events_url":"https://api.github.com/repos/parthea/pandas/issues/events{/number}","events_url":"https://api.github.com/repos/parthea/pandas/events","assignees_url":"https://api.github.com/repos/parthea/pandas/assignees{/user}","branches_url":"https://api.github.com/repos/parthea/pandas/branches{/branch}","tags_url":"https://api.github.com/repos/parthea/pandas/tags","blobs_url":"https://api.github.com/repos/parthea/pandas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/parthea/pandas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/parthea/pandas/git/refs{/sha}","trees_url":"https://api.github.com/repos/parthea/pandas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/parthea/pandas/statuses/{sha}","languages_url":"https://api.github.com/repos/parthea/pandas/languages","stargazers_url":"https://api.github.com/repos/parthea/pandas/stargazers","contributors_url":"https://api.github.com/repos/parthea/pandas/contributors","subscribers_url":"https://api.github.com/repos/parthea/pandas/subscribers","subscription_url":"https://api.github.com/repos/parthea/pandas/subscription","commits_url":"https://api.github.com/repos/parthea/pandas/commits{/sha}","git_commits_url":"https://api.github.com/repos/parthea/pandas/git/commits{/sha}","comments_url":"https://api.github.com/repos/parthea/pandas/comments{/number}","issue_comment_url":"https://api.github.com/repos/parthea/pandas/issues/comments{/number}","contents_url":"https://api.github.com/repos/parthea/pandas/contents/{+path}","compare_url":"https://api.github.com/repos/parthea/pandas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/parthea/pandas/merges","archive_url":"https://api.github.com/repos/parthea/pandas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/parthea/pandas/downloads","issues_url":"https://api.github.com/repos/parthea/pandas/issues{/number}","pulls_url":"https://api.github.com/repos/parthea/pandas/pulls{/number}","milestones_url":"https://api.github.com/repos/parthea/pandas/milestones{/number}","notifications_url":"https://api.github.com/repos/parthea/pandas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/parthea/pandas/labels{/name}","releases_url":"https://api.github.com/repos/parthea/pandas/releases{/id}","created_at":"2015-08-18T13:51:32Z","updated_at":"2015-08-23T18:55:38Z","pushed_at":"2015-09-09T21:38:44Z","git_url":"git://github.com/parthea/pandas.git","ssh_url":"git@github.com:parthea/pandas.git","clone_url":"https://github.com/parthea/pandas.git","svn_url":"https://github.com/parthea/pandas","homepage":"http://pandas.pydata.org","size":63840,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pydata:master","ref":"master","sha":"879f5e90bea3b8c4849fd9f83a834e858dccd407","user":{"login":"pydata","id":1284191,"avatar_url":"https://avatars.githubusercontent.com/u/1284191?v=3","gravatar_id":"","url":"https://api.github.com/users/pydata","html_url":"https://github.com/pydata","followers_url":"https://api.github.com/users/pydata/followers","following_url":"https://api.github.com/users/pydata/following{/other_user}","gists_url":"https://api.github.com/users/pydata/gists{/gist_id}","starred_url":"https://api.github.com/users/pydata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pydata/subscriptions","organizations_url":"https://api.github.com/users/pydata/orgs","repos_url":"https://api.github.com/users/pydata/repos","events_url":"https://api.github.com/users/pydata/events{/privacy}","received_events_url":"https://api.github.com/users/pydata/received_events","type":"Organization","site_admin":false},"repo":{"id":858127,"name":"pandas","full_name":"pydata/pandas","owner":{"login":"pydata","id":1284191,"avatar_url":"https://avatars.githubusercontent.com/u/1284191?v=3","gravatar_id":"","url":"https://api.github.com/users/pydata","html_url":"https://github.com/pydata","followers_url":"https://api.github.com/users/pydata/followers","following_url":"https://api.github.com/users/pydata/following{/other_user}","gists_url":"https://api.github.com/users/pydata/gists{/gist_id}","starred_url":"https://api.github.com/users/pydata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pydata/subscriptions","organizations_url":"https://api.github.com/users/pydata/orgs","repos_url":"https://api.github.com/users/pydata/repos","events_url":"https://api.github.com/users/pydata/events{/privacy}","received_events_url":"https://api.github.com/users/pydata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pydata/pandas","description":"Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more","fork":false,"url":"https://api.github.com/repos/pydata/pandas","forks_url":"https://api.github.com/repos/pydata/pandas/forks","keys_url":"https://api.github.com/repos/pydata/pandas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pydata/pandas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pydata/pandas/teams","hooks_url":"https://api.github.com/repos/pydata/pandas/hooks","issue_events_url":"https://api.github.com/repos/pydata/pandas/issues/events{/number}","events_url":"https://api.github.com/repos/pydata/pandas/events","assignees_url":"https://api.github.com/repos/pydata/pandas/assignees{/user}","branches_url":"https://api.github.com/repos/pydata/pandas/branches{/branch}","tags_url":"https://api.github.com/repos/pydata/pandas/tags","blobs_url":"https://api.github.com/repos/pydata/pandas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pydata/pandas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pydata/pandas/git/refs{/sha}","trees_url":"https://api.github.com/repos/pydata/pandas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pydata/pandas/statuses/{sha}","languages_url":"https://api.github.com/repos/pydata/pandas/languages","stargazers_url":"https://api.github.com/repos/pydata/pandas/stargazers","contributors_url":"https://api.github.com/repos/pydata/pandas/contributors","subscribers_url":"https://api.github.com/repos/pydata/pandas/subscribers","subscription_url":"https://api.github.com/repos/pydata/pandas/subscription","commits_url":"https://api.github.com/repos/pydata/pandas/commits{/sha}","git_commits_url":"https://api.github.com/repos/pydata/pandas/git/commits{/sha}","comments_url":"https://api.github.com/repos/pydata/pandas/comments{/number}","issue_comment_url":"https://api.github.com/repos/pydata/pandas/issues/comments{/number}","contents_url":"https://api.github.com/repos/pydata/pandas/contents/{+path}","compare_url":"https://api.github.com/repos/pydata/pandas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pydata/pandas/merges","archive_url":"https://api.github.com/repos/pydata/pandas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pydata/pandas/downloads","issues_url":"https://api.github.com/repos/pydata/pandas/issues{/number}","pulls_url":"https://api.github.com/repos/pydata/pandas/pulls{/number}","milestones_url":"https://api.github.com/repos/pydata/pandas/milestones{/number}","notifications_url":"https://api.github.com/repos/pydata/pandas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pydata/pandas/labels{/name}","releases_url":"https://api.github.com/repos/pydata/pandas/releases{/id}","created_at":"2010-08-24T01:37:33Z","updated_at":"2015-09-09T20:01:32Z","pushed_at":"2015-09-09T21:39:43Z","git_url":"git://github.com/pydata/pandas.git","ssh_url":"git@github.com:pydata/pandas.git","clone_url":"https://github.com/pydata/pandas.git","svn_url":"https://github.com/pydata/pandas","homepage":"http://pandas.pydata.org","size":159545,"stargazers_count":4915,"watchers_count":4915,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1896,"mirror_url":null,"open_issues_count":1448,"forks":1896,"open_issues":1448,"watchers":4915,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pydata/pandas/pulls/10857"},"html":{"href":"https://github.com/pydata/pandas/pull/10857"},"issue":{"href":"https://api.github.com/repos/pydata/pandas/issues/10857"},"comments":{"href":"https://api.github.com/repos/pydata/pandas/issues/10857/comments"},"review_comments":{"href":"https://api.github.com/repos/pydata/pandas/pulls/10857/comments"},"review_comment":{"href":"https://api.github.com/repos/pydata/pandas/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pydata/pandas/pulls/10857/commits"},"statuses":{"href":"https://api.github.com/repos/pydata/pandas/statuses/d5d184ee1d695ca5bfa2e4c672d73f8911a4e52e"}}}}