{"action":"created","comment":{"url":"https://api.github.com/repos/hakobera/luigi-bigquery/pulls/comments/32282801","id":32282801,"diff_hunk":"@@ -119,7 +119,7 @@ def requires(self):\n         return DatasetTask(self.dataset())\n \n     def output(self):\n-        return TableTarget(self.dataset(), self.table())\n+        return TableTarget(self.dataset(), self.table(), None, False, None, self.append())","path":"luigi_bigquery/task.py","position":5,"original_position":5,"commit_id":"e172e82821470b20d4fea287bad977da658cd923","original_commit_id":"e172e82821470b20d4fea287bad977da658cd923","user":{"login":"hakobera","id":346598,"avatar_url":"https://avatars.githubusercontent.com/u/346598?v=3","gravatar_id":"","url":"https://api.github.com/users/hakobera","html_url":"https://github.com/hakobera","followers_url":"https://api.github.com/users/hakobera/followers","following_url":"https://api.github.com/users/hakobera/following{/other_user}","gists_url":"https://api.github.com/users/hakobera/gists{/gist_id}","starred_url":"https://api.github.com/users/hakobera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hakobera/subscriptions","organizations_url":"https://api.github.com/users/hakobera/orgs","repos_url":"https://api.github.com/users/hakobera/repos","events_url":"https://api.github.com/users/hakobera/events{/privacy}","received_events_url":"https://api.github.com/users/hakobera/received_events","type":"User","site_admin":false},"body":"@abronte I think it's not necessary to add `append()` method and rewrite `self.write_disposition`.\r\nChange this line to\r\n\r\n```python\r\nreturn TableTarget(self.dataset(), self.table(), append=(self.write_disposition == bigquery.JOB_WRITE_APPEND))\r\n```\r\n\r\nis enough. If you do so, just use `QueryTable` like this.\r\n\r\n```\r\nclass MyQueryTableStep1(luigi_bigquery.QueryTable):\r\n    write_disposition == bigquery.JOB_WRITE_APPEND\r\n\r\n    def dataset(self):\r\n        return 'luigi'\r\n\r\n    def table(self):\r\n        return 'tmp'\r\n\r\n    def query(self):\r\n        return \"SELECT count(*) cnt FROM [publicdata:samples.github_nested]\"\r\n```","created_at":"2015-06-12T00:36:40Z","updated_at":"2015-06-12T00:36:40Z","html_url":"https://github.com/hakobera/luigi-bigquery/pull/9#discussion_r32282801","pull_request_url":"https://api.github.com/repos/hakobera/luigi-bigquery/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/hakobera/luigi-bigquery/pulls/comments/32282801"},"html":{"href":"https://github.com/hakobera/luigi-bigquery/pull/9#discussion_r32282801"},"pull_request":{"href":"https://api.github.com/repos/hakobera/luigi-bigquery/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/hakobera/luigi-bigquery/pulls/9","id":37497365,"html_url":"https://github.com/hakobera/luigi-bigquery/pull/9","diff_url":"https://github.com/hakobera/luigi-bigquery/pull/9.diff","patch_url":"https://github.com/hakobera/luigi-bigquery/pull/9.patch","issue_url":"https://api.github.com/repos/hakobera/luigi-bigquery/issues/9","number":9,"state":"open","locked":false,"title":"Append a table in bigquery","user":{"login":"abronte","id":44644,"avatar_url":"https://avatars.githubusercontent.com/u/44644?v=3","gravatar_id":"","url":"https://api.github.com/users/abronte","html_url":"https://github.com/abronte","followers_url":"https://api.github.com/users/abronte/followers","following_url":"https://api.github.com/users/abronte/following{/other_user}","gists_url":"https://api.github.com/users/abronte/gists{/gist_id}","starred_url":"https://api.github.com/users/abronte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abronte/subscriptions","organizations_url":"https://api.github.com/users/abronte/orgs","repos_url":"https://api.github.com/users/abronte/repos","events_url":"https://api.github.com/users/abronte/events{/privacy}","received_events_url":"https://api.github.com/users/abronte/received_events","type":"User","site_admin":false},"body":"This allows appending rows to a table by overriding the append method in a task.\r\n\r\nFor example:\r\n```\r\nclass MyQueryTableStep1(luigi_bigquery.QueryTable):\r\n    def append(self):\r\n        return True\r\n\r\n    def dataset(self):\r\n        return 'luigi'\r\n\r\n    def table(self):\r\n        return 'tmp'\r\n\r\n    def query(self):\r\n        return \"SELECT count(*) cnt FROM [publicdata:samples.github_nested]\"\r\n```\r\n\r\nI'm sort of new to luigi and not really a python dev, so if theres a better way to accomplish this let me know!","created_at":"2015-06-11T19:03:53Z","updated_at":"2015-06-12T00:36:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1468d383da93a3b1ea132953aa481b3e15fa93a3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hakobera/luigi-bigquery/pulls/9/commits","review_comments_url":"https://api.github.com/repos/hakobera/luigi-bigquery/pulls/9/comments","review_comment_url":"https://api.github.com/repos/hakobera/luigi-bigquery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hakobera/luigi-bigquery/issues/9/comments","statuses_url":"https://api.github.com/repos/hakobera/luigi-bigquery/statuses/e172e82821470b20d4fea287bad977da658cd923","head":{"label":"abronte:append","ref":"append","sha":"e172e82821470b20d4fea287bad977da658cd923","user":{"login":"abronte","id":44644,"avatar_url":"https://avatars.githubusercontent.com/u/44644?v=3","gravatar_id":"","url":"https://api.github.com/users/abronte","html_url":"https://github.com/abronte","followers_url":"https://api.github.com/users/abronte/followers","following_url":"https://api.github.com/users/abronte/following{/other_user}","gists_url":"https://api.github.com/users/abronte/gists{/gist_id}","starred_url":"https://api.github.com/users/abronte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abronte/subscriptions","organizations_url":"https://api.github.com/users/abronte/orgs","repos_url":"https://api.github.com/users/abronte/repos","events_url":"https://api.github.com/users/abronte/events{/privacy}","received_events_url":"https://api.github.com/users/abronte/received_events","type":"User","site_admin":false},"repo":{"id":37275351,"name":"luigi-bigquery","full_name":"abronte/luigi-bigquery","owner":{"login":"abronte","id":44644,"avatar_url":"https://avatars.githubusercontent.com/u/44644?v=3","gravatar_id":"","url":"https://api.github.com/users/abronte","html_url":"https://github.com/abronte","followers_url":"https://api.github.com/users/abronte/followers","following_url":"https://api.github.com/users/abronte/following{/other_user}","gists_url":"https://api.github.com/users/abronte/gists{/gist_id}","starred_url":"https://api.github.com/users/abronte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abronte/subscriptions","organizations_url":"https://api.github.com/users/abronte/orgs","repos_url":"https://api.github.com/users/abronte/repos","events_url":"https://api.github.com/users/abronte/events{/privacy}","received_events_url":"https://api.github.com/users/abronte/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abronte/luigi-bigquery","description":"Luigi integration for Google BigQuery","fork":true,"url":"https://api.github.com/repos/abronte/luigi-bigquery","forks_url":"https://api.github.com/repos/abronte/luigi-bigquery/forks","keys_url":"https://api.github.com/repos/abronte/luigi-bigquery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abronte/luigi-bigquery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abronte/luigi-bigquery/teams","hooks_url":"https://api.github.com/repos/abronte/luigi-bigquery/hooks","issue_events_url":"https://api.github.com/repos/abronte/luigi-bigquery/issues/events{/number}","events_url":"https://api.github.com/repos/abronte/luigi-bigquery/events","assignees_url":"https://api.github.com/repos/abronte/luigi-bigquery/assignees{/user}","branches_url":"https://api.github.com/repos/abronte/luigi-bigquery/branches{/branch}","tags_url":"https://api.github.com/repos/abronte/luigi-bigquery/tags","blobs_url":"https://api.github.com/repos/abronte/luigi-bigquery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abronte/luigi-bigquery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abronte/luigi-bigquery/git/refs{/sha}","trees_url":"https://api.github.com/repos/abronte/luigi-bigquery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abronte/luigi-bigquery/statuses/{sha}","languages_url":"https://api.github.com/repos/abronte/luigi-bigquery/languages","stargazers_url":"https://api.github.com/repos/abronte/luigi-bigquery/stargazers","contributors_url":"https://api.github.com/repos/abronte/luigi-bigquery/contributors","subscribers_url":"https://api.github.com/repos/abronte/luigi-bigquery/subscribers","subscription_url":"https://api.github.com/repos/abronte/luigi-bigquery/subscription","commits_url":"https://api.github.com/repos/abronte/luigi-bigquery/commits{/sha}","git_commits_url":"https://api.github.com/repos/abronte/luigi-bigquery/git/commits{/sha}","comments_url":"https://api.github.com/repos/abronte/luigi-bigquery/comments{/number}","issue_comment_url":"https://api.github.com/repos/abronte/luigi-bigquery/issues/comments{/number}","contents_url":"https://api.github.com/repos/abronte/luigi-bigquery/contents/{+path}","compare_url":"https://api.github.com/repos/abronte/luigi-bigquery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abronte/luigi-bigquery/merges","archive_url":"https://api.github.com/repos/abronte/luigi-bigquery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abronte/luigi-bigquery/downloads","issues_url":"https://api.github.com/repos/abronte/luigi-bigquery/issues{/number}","pulls_url":"https://api.github.com/repos/abronte/luigi-bigquery/pulls{/number}","milestones_url":"https://api.github.com/repos/abronte/luigi-bigquery/milestones{/number}","notifications_url":"https://api.github.com/repos/abronte/luigi-bigquery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abronte/luigi-bigquery/labels{/name}","releases_url":"https://api.github.com/repos/abronte/luigi-bigquery/releases{/id}","created_at":"2015-06-11T17:24:45Z","updated_at":"2015-06-11T17:24:46Z","pushed_at":"2015-06-11T21:48:15Z","git_url":"git://github.com/abronte/luigi-bigquery.git","ssh_url":"git@github.com:abronte/luigi-bigquery.git","clone_url":"https://github.com/abronte/luigi-bigquery.git","svn_url":"https://github.com/abronte/luigi-bigquery","homepage":null,"size":195,"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":"hakobera:master","ref":"master","sha":"08fb87a4fe88fb0ada687bb03a967a66d13243b4","user":{"login":"hakobera","id":346598,"avatar_url":"https://avatars.githubusercontent.com/u/346598?v=3","gravatar_id":"","url":"https://api.github.com/users/hakobera","html_url":"https://github.com/hakobera","followers_url":"https://api.github.com/users/hakobera/followers","following_url":"https://api.github.com/users/hakobera/following{/other_user}","gists_url":"https://api.github.com/users/hakobera/gists{/gist_id}","starred_url":"https://api.github.com/users/hakobera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hakobera/subscriptions","organizations_url":"https://api.github.com/users/hakobera/orgs","repos_url":"https://api.github.com/users/hakobera/repos","events_url":"https://api.github.com/users/hakobera/events{/privacy}","received_events_url":"https://api.github.com/users/hakobera/received_events","type":"User","site_admin":false},"repo":{"id":34600466,"name":"luigi-bigquery","full_name":"hakobera/luigi-bigquery","owner":{"login":"hakobera","id":346598,"avatar_url":"https://avatars.githubusercontent.com/u/346598?v=3","gravatar_id":"","url":"https://api.github.com/users/hakobera","html_url":"https://github.com/hakobera","followers_url":"https://api.github.com/users/hakobera/followers","following_url":"https://api.github.com/users/hakobera/following{/other_user}","gists_url":"https://api.github.com/users/hakobera/gists{/gist_id}","starred_url":"https://api.github.com/users/hakobera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hakobera/subscriptions","organizations_url":"https://api.github.com/users/hakobera/orgs","repos_url":"https://api.github.com/users/hakobera/repos","events_url":"https://api.github.com/users/hakobera/events{/privacy}","received_events_url":"https://api.github.com/users/hakobera/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hakobera/luigi-bigquery","description":"Luigi integration for Google BigQuery","fork":false,"url":"https://api.github.com/repos/hakobera/luigi-bigquery","forks_url":"https://api.github.com/repos/hakobera/luigi-bigquery/forks","keys_url":"https://api.github.com/repos/hakobera/luigi-bigquery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hakobera/luigi-bigquery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hakobera/luigi-bigquery/teams","hooks_url":"https://api.github.com/repos/hakobera/luigi-bigquery/hooks","issue_events_url":"https://api.github.com/repos/hakobera/luigi-bigquery/issues/events{/number}","events_url":"https://api.github.com/repos/hakobera/luigi-bigquery/events","assignees_url":"https://api.github.com/repos/hakobera/luigi-bigquery/assignees{/user}","branches_url":"https://api.github.com/repos/hakobera/luigi-bigquery/branches{/branch}","tags_url":"https://api.github.com/repos/hakobera/luigi-bigquery/tags","blobs_url":"https://api.github.com/repos/hakobera/luigi-bigquery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hakobera/luigi-bigquery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hakobera/luigi-bigquery/git/refs{/sha}","trees_url":"https://api.github.com/repos/hakobera/luigi-bigquery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hakobera/luigi-bigquery/statuses/{sha}","languages_url":"https://api.github.com/repos/hakobera/luigi-bigquery/languages","stargazers_url":"https://api.github.com/repos/hakobera/luigi-bigquery/stargazers","contributors_url":"https://api.github.com/repos/hakobera/luigi-bigquery/contributors","subscribers_url":"https://api.github.com/repos/hakobera/luigi-bigquery/subscribers","subscription_url":"https://api.github.com/repos/hakobera/luigi-bigquery/subscription","commits_url":"https://api.github.com/repos/hakobera/luigi-bigquery/commits{/sha}","git_commits_url":"https://api.github.com/repos/hakobera/luigi-bigquery/git/commits{/sha}","comments_url":"https://api.github.com/repos/hakobera/luigi-bigquery/comments{/number}","issue_comment_url":"https://api.github.com/repos/hakobera/luigi-bigquery/issues/comments{/number}","contents_url":"https://api.github.com/repos/hakobera/luigi-bigquery/contents/{+path}","compare_url":"https://api.github.com/repos/hakobera/luigi-bigquery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hakobera/luigi-bigquery/merges","archive_url":"https://api.github.com/repos/hakobera/luigi-bigquery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hakobera/luigi-bigquery/downloads","issues_url":"https://api.github.com/repos/hakobera/luigi-bigquery/issues{/number}","pulls_url":"https://api.github.com/repos/hakobera/luigi-bigquery/pulls{/number}","milestones_url":"https://api.github.com/repos/hakobera/luigi-bigquery/milestones{/number}","notifications_url":"https://api.github.com/repos/hakobera/luigi-bigquery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hakobera/luigi-bigquery/labels{/name}","releases_url":"https://api.github.com/repos/hakobera/luigi-bigquery/releases{/id}","created_at":"2015-04-26T06:19:29Z","updated_at":"2015-06-06T04:50:11Z","pushed_at":"2015-06-12T00:28:11Z","git_url":"git://github.com/hakobera/luigi-bigquery.git","ssh_url":"git@github.com:hakobera/luigi-bigquery.git","clone_url":"https://github.com/hakobera/luigi-bigquery.git","svn_url":"https://github.com/hakobera/luigi-bigquery","homepage":null,"size":195,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hakobera/luigi-bigquery/pulls/9"},"html":{"href":"https://github.com/hakobera/luigi-bigquery/pull/9"},"issue":{"href":"https://api.github.com/repos/hakobera/luigi-bigquery/issues/9"},"comments":{"href":"https://api.github.com/repos/hakobera/luigi-bigquery/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/hakobera/luigi-bigquery/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/hakobera/luigi-bigquery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hakobera/luigi-bigquery/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/hakobera/luigi-bigquery/statuses/e172e82821470b20d4fea287bad977da658cd923"}}}}