{"action":"created","comment":{"url":"https://api.github.com/repos/ministryofjustice/cla_backend/pulls/comments/22538674","id":22538674,"diff_hunk":"@@ -517,3 +527,71 @@ def get_queryset(self, *args, **kwargs):\n         qs = super(CSVUploadViewSet, self).get_queryset(*args, **kwargs).filter(\n             month__gte=after)\n         return qs\n+\n+\n+class DBExportView(APIView):\n+    sql_files = {\n+        'cases': 'ExportCases.sql',\n+        'personal_details': 'ExportPersonalDetails.sql',\n+        'standard': 'ExportStandardTables.sql',\n+        'media_code_group': 'ExportMediaCodeGroup.sql',\n+    }\n+\n+    authentication_classes = (OBIEESignatureAuthentication,)\n+    permission_classes = (permissions.IsAuthenticated,)\n+\n+    filename = 'cla_database.zip'\n+\n+    def get(self, request, format=None):\n+        \"\"\"\n+        dt_from, dt_to: ISO 8601 datetime string (2014-08-29T23:59:59)\n+        passphrase: diversity GPG private key passphrase\n+        \"\"\"\n+        dt_from = request.QUERY_PARAMS.get('from', '')\n+        dt_to = request.QUERY_PARAMS.get('to', '')\n+        passphrase = request.QUERY_PARAMS.get('passphrase', '')\n+\n+        export_path = tempfile.mkdtemp()","path":"cla_backend/apps/call_centre/views.py","position":61,"original_position":61,"commit_id":"483774d797d4b8bc1e21d05b0b6f5d949ec17bda","original_commit_id":"483774d797d4b8bc1e21d05b0b6f5d949ec17bda","user":{"login":"r4vi","id":565628,"avatar_url":"https://avatars.githubusercontent.com/u/565628?v=3","gravatar_id":"","url":"https://api.github.com/users/r4vi","html_url":"https://github.com/r4vi","followers_url":"https://api.github.com/users/r4vi/followers","following_url":"https://api.github.com/users/r4vi/following{/other_user}","gists_url":"https://api.github.com/users/r4vi/gists{/gist_id}","starred_url":"https://api.github.com/users/r4vi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r4vi/subscriptions","organizations_url":"https://api.github.com/users/r4vi/orgs","repos_url":"https://api.github.com/users/r4vi/repos","events_url":"https://api.github.com/users/r4vi/events{/privacy}","received_events_url":"https://api.github.com/users/r4vi/received_events","type":"User","site_admin":false},"body":"what if it was run twice? maybe worth dumping a ```cla_database.zip.lock``` file;\r\nif call is made again then don't run unless that file is not there, delete the file at the end of the method or when an error happens. Maybe a failsafe to allow running if the ```cla_database.zip.lock``` is older than 1hour?","created_at":"2015-01-06T18:01:28Z","updated_at":"2015-01-06T18:01:28Z","html_url":"https://github.com/ministryofjustice/cla_backend/pull/272#discussion_r22538674","pull_request_url":"https://api.github.com/repos/ministryofjustice/cla_backend/pulls/272","_links":{"self":{"href":"https://api.github.com/repos/ministryofjustice/cla_backend/pulls/comments/22538674"},"html":{"href":"https://github.com/ministryofjustice/cla_backend/pull/272#discussion_r22538674"},"pull_request":{"href":"https://api.github.com/repos/ministryofjustice/cla_backend/pulls/272"}}},"pull_request":{"url":"https://api.github.com/repos/ministryofjustice/cla_backend/pulls/272","id":26904059,"html_url":"https://github.com/ministryofjustice/cla_backend/pull/272","diff_url":"https://github.com/ministryofjustice/cla_backend/pull/272.diff","patch_url":"https://github.com/ministryofjustice/cla_backend/pull/272.patch","issue_url":"https://api.github.com/repos/ministryofjustice/cla_backend/issues/272","number":272,"state":"open","locked":false,"title":"Feature/obiee csv export","user":{"login":"kerin","id":38736,"avatar_url":"https://avatars.githubusercontent.com/u/38736?v=3","gravatar_id":"","url":"https://api.github.com/users/kerin","html_url":"https://github.com/kerin","followers_url":"https://api.github.com/users/kerin/followers","following_url":"https://api.github.com/users/kerin/following{/other_user}","gists_url":"https://api.github.com/users/kerin/gists{/gist_id}","starred_url":"https://api.github.com/users/kerin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kerin/subscriptions","organizations_url":"https://api.github.com/users/kerin/orgs","repos_url":"https://api.github.com/users/kerin/repos","events_url":"https://api.github.com/users/kerin/events{/privacy}","received_events_url":"https://api.github.com/users/kerin/received_events","type":"User","site_admin":false},"body":"@r4vi @marcofucci opinions please?","created_at":"2015-01-06T17:35:25Z","updated_at":"2015-01-06T18:01:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f73c297a0d09ede0e3111a769c3d31eb7f8ff8d1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ministryofjustice/cla_backend/pulls/272/commits","review_comments_url":"https://api.github.com/repos/ministryofjustice/cla_backend/pulls/272/comments","review_comment_url":"https://api.github.com/repos/ministryofjustice/cla_backend/pulls/comments/{number}","comments_url":"https://api.github.com/repos/ministryofjustice/cla_backend/issues/272/comments","statuses_url":"https://api.github.com/repos/ministryofjustice/cla_backend/statuses/483774d797d4b8bc1e21d05b0b6f5d949ec17bda","head":{"label":"ministryofjustice:feature/obiee-csv-export","ref":"feature/obiee-csv-export","sha":"483774d797d4b8bc1e21d05b0b6f5d949ec17bda","user":{"login":"ministryofjustice","id":2203574,"avatar_url":"https://avatars.githubusercontent.com/u/2203574?v=3","gravatar_id":"","url":"https://api.github.com/users/ministryofjustice","html_url":"https://github.com/ministryofjustice","followers_url":"https://api.github.com/users/ministryofjustice/followers","following_url":"https://api.github.com/users/ministryofjustice/following{/other_user}","gists_url":"https://api.github.com/users/ministryofjustice/gists{/gist_id}","starred_url":"https://api.github.com/users/ministryofjustice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ministryofjustice/subscriptions","organizations_url":"https://api.github.com/users/ministryofjustice/orgs","repos_url":"https://api.github.com/users/ministryofjustice/repos","events_url":"https://api.github.com/users/ministryofjustice/events{/privacy}","received_events_url":"https://api.github.com/users/ministryofjustice/received_events","type":"Organization","site_admin":false},"repo":{"id":16694400,"name":"cla_backend","full_name":"ministryofjustice/cla_backend","owner":{"login":"ministryofjustice","id":2203574,"avatar_url":"https://avatars.githubusercontent.com/u/2203574?v=3","gravatar_id":"","url":"https://api.github.com/users/ministryofjustice","html_url":"https://github.com/ministryofjustice","followers_url":"https://api.github.com/users/ministryofjustice/followers","following_url":"https://api.github.com/users/ministryofjustice/following{/other_user}","gists_url":"https://api.github.com/users/ministryofjustice/gists{/gist_id}","starred_url":"https://api.github.com/users/ministryofjustice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ministryofjustice/subscriptions","organizations_url":"https://api.github.com/users/ministryofjustice/orgs","repos_url":"https://api.github.com/users/ministryofjustice/repos","events_url":"https://api.github.com/users/ministryofjustice/events{/privacy}","received_events_url":"https://api.github.com/users/ministryofjustice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ministryofjustice/cla_backend","description":"CLA Back End","fork":false,"url":"https://api.github.com/repos/ministryofjustice/cla_backend","forks_url":"https://api.github.com/repos/ministryofjustice/cla_backend/forks","keys_url":"https://api.github.com/repos/ministryofjustice/cla_backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ministryofjustice/cla_backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ministryofjustice/cla_backend/teams","hooks_url":"https://api.github.com/repos/ministryofjustice/cla_backend/hooks","issue_events_url":"https://api.github.com/repos/ministryofjustice/cla_backend/issues/events{/number}","events_url":"https://api.github.com/repos/ministryofjustice/cla_backend/events","assignees_url":"https://api.github.com/repos/ministryofjustice/cla_backend/assignees{/user}","branches_url":"https://api.github.com/repos/ministryofjustice/cla_backend/branches{/branch}","tags_url":"https://api.github.com/repos/ministryofjustice/cla_backend/tags","blobs_url":"https://api.github.com/repos/ministryofjustice/cla_backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ministryofjustice/cla_backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ministryofjustice/cla_backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/ministryofjustice/cla_backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ministryofjustice/cla_backend/statuses/{sha}","languages_url":"https://api.github.com/repos/ministryofjustice/cla_backend/languages","stargazers_url":"https://api.github.com/repos/ministryofjustice/cla_backend/stargazers","contributors_url":"https://api.github.com/repos/ministryofjustice/cla_backend/contributors","subscribers_url":"https://api.github.com/repos/ministryofjustice/cla_backend/subscribers","subscription_url":"https://api.github.com/repos/ministryofjustice/cla_backend/subscription","commits_url":"https://api.github.com/repos/ministryofjustice/cla_backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/ministryofjustice/cla_backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/ministryofjustice/cla_backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/ministryofjustice/cla_backend/issues/comments/{number}","contents_url":"https://api.github.com/repos/ministryofjustice/cla_backend/contents/{+path}","compare_url":"https://api.github.com/repos/ministryofjustice/cla_backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ministryofjustice/cla_backend/merges","archive_url":"https://api.github.com/repos/ministryofjustice/cla_backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ministryofjustice/cla_backend/downloads","issues_url":"https://api.github.com/repos/ministryofjustice/cla_backend/issues{/number}","pulls_url":"https://api.github.com/repos/ministryofjustice/cla_backend/pulls{/number}","milestones_url":"https://api.github.com/repos/ministryofjustice/cla_backend/milestones{/number}","notifications_url":"https://api.github.com/repos/ministryofjustice/cla_backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ministryofjustice/cla_backend/labels{/name}","releases_url":"https://api.github.com/repos/ministryofjustice/cla_backend/releases{/id}","created_at":"2014-02-10T12:20:03Z","updated_at":"2015-01-06T16:07:37Z","pushed_at":"2015-01-06T17:52:20Z","git_url":"git://github.com/ministryofjustice/cla_backend.git","ssh_url":"git@github.com:ministryofjustice/cla_backend.git","clone_url":"https://github.com/ministryofjustice/cla_backend.git","svn_url":"https://github.com/ministryofjustice/cla_backend","homepage":null,"size":9313,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"develop"}},"base":{"label":"ministryofjustice:develop","ref":"develop","sha":"08471d42db00d836f9ce5010e9cb3800087fab64","user":{"login":"ministryofjustice","id":2203574,"avatar_url":"https://avatars.githubusercontent.com/u/2203574?v=3","gravatar_id":"","url":"https://api.github.com/users/ministryofjustice","html_url":"https://github.com/ministryofjustice","followers_url":"https://api.github.com/users/ministryofjustice/followers","following_url":"https://api.github.com/users/ministryofjustice/following{/other_user}","gists_url":"https://api.github.com/users/ministryofjustice/gists{/gist_id}","starred_url":"https://api.github.com/users/ministryofjustice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ministryofjustice/subscriptions","organizations_url":"https://api.github.com/users/ministryofjustice/orgs","repos_url":"https://api.github.com/users/ministryofjustice/repos","events_url":"https://api.github.com/users/ministryofjustice/events{/privacy}","received_events_url":"https://api.github.com/users/ministryofjustice/received_events","type":"Organization","site_admin":false},"repo":{"id":16694400,"name":"cla_backend","full_name":"ministryofjustice/cla_backend","owner":{"login":"ministryofjustice","id":2203574,"avatar_url":"https://avatars.githubusercontent.com/u/2203574?v=3","gravatar_id":"","url":"https://api.github.com/users/ministryofjustice","html_url":"https://github.com/ministryofjustice","followers_url":"https://api.github.com/users/ministryofjustice/followers","following_url":"https://api.github.com/users/ministryofjustice/following{/other_user}","gists_url":"https://api.github.com/users/ministryofjustice/gists{/gist_id}","starred_url":"https://api.github.com/users/ministryofjustice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ministryofjustice/subscriptions","organizations_url":"https://api.github.com/users/ministryofjustice/orgs","repos_url":"https://api.github.com/users/ministryofjustice/repos","events_url":"https://api.github.com/users/ministryofjustice/events{/privacy}","received_events_url":"https://api.github.com/users/ministryofjustice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ministryofjustice/cla_backend","description":"CLA Back End","fork":false,"url":"https://api.github.com/repos/ministryofjustice/cla_backend","forks_url":"https://api.github.com/repos/ministryofjustice/cla_backend/forks","keys_url":"https://api.github.com/repos/ministryofjustice/cla_backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ministryofjustice/cla_backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ministryofjustice/cla_backend/teams","hooks_url":"https://api.github.com/repos/ministryofjustice/cla_backend/hooks","issue_events_url":"https://api.github.com/repos/ministryofjustice/cla_backend/issues/events{/number}","events_url":"https://api.github.com/repos/ministryofjustice/cla_backend/events","assignees_url":"https://api.github.com/repos/ministryofjustice/cla_backend/assignees{/user}","branches_url":"https://api.github.com/repos/ministryofjustice/cla_backend/branches{/branch}","tags_url":"https://api.github.com/repos/ministryofjustice/cla_backend/tags","blobs_url":"https://api.github.com/repos/ministryofjustice/cla_backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ministryofjustice/cla_backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ministryofjustice/cla_backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/ministryofjustice/cla_backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ministryofjustice/cla_backend/statuses/{sha}","languages_url":"https://api.github.com/repos/ministryofjustice/cla_backend/languages","stargazers_url":"https://api.github.com/repos/ministryofjustice/cla_backend/stargazers","contributors_url":"https://api.github.com/repos/ministryofjustice/cla_backend/contributors","subscribers_url":"https://api.github.com/repos/ministryofjustice/cla_backend/subscribers","subscription_url":"https://api.github.com/repos/ministryofjustice/cla_backend/subscription","commits_url":"https://api.github.com/repos/ministryofjustice/cla_backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/ministryofjustice/cla_backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/ministryofjustice/cla_backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/ministryofjustice/cla_backend/issues/comments/{number}","contents_url":"https://api.github.com/repos/ministryofjustice/cla_backend/contents/{+path}","compare_url":"https://api.github.com/repos/ministryofjustice/cla_backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ministryofjustice/cla_backend/merges","archive_url":"https://api.github.com/repos/ministryofjustice/cla_backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ministryofjustice/cla_backend/downloads","issues_url":"https://api.github.com/repos/ministryofjustice/cla_backend/issues{/number}","pulls_url":"https://api.github.com/repos/ministryofjustice/cla_backend/pulls{/number}","milestones_url":"https://api.github.com/repos/ministryofjustice/cla_backend/milestones{/number}","notifications_url":"https://api.github.com/repos/ministryofjustice/cla_backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ministryofjustice/cla_backend/labels{/name}","releases_url":"https://api.github.com/repos/ministryofjustice/cla_backend/releases{/id}","created_at":"2014-02-10T12:20:03Z","updated_at":"2015-01-06T16:07:37Z","pushed_at":"2015-01-06T17:52:20Z","git_url":"git://github.com/ministryofjustice/cla_backend.git","ssh_url":"git@github.com:ministryofjustice/cla_backend.git","clone_url":"https://github.com/ministryofjustice/cla_backend.git","svn_url":"https://github.com/ministryofjustice/cla_backend","homepage":null,"size":9313,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ministryofjustice/cla_backend/pulls/272"},"html":{"href":"https://github.com/ministryofjustice/cla_backend/pull/272"},"issue":{"href":"https://api.github.com/repos/ministryofjustice/cla_backend/issues/272"},"comments":{"href":"https://api.github.com/repos/ministryofjustice/cla_backend/issues/272/comments"},"review_comments":{"href":"https://api.github.com/repos/ministryofjustice/cla_backend/pulls/272/comments"},"review_comment":{"href":"https://api.github.com/repos/ministryofjustice/cla_backend/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/ministryofjustice/cla_backend/pulls/272/commits"},"statuses":{"href":"https://api.github.com/repos/ministryofjustice/cla_backend/statuses/483774d797d4b8bc1e21d05b0b6f5d949ec17bda"}}}}