{"action":"created","comment":{"url":"https://api.github.com/repos/worldveil/dejavu/pulls/comments/27782608","id":27782608,"diff_hunk":"@@ -0,0 +1,478 @@\n+\"\"\" Class for interacting with Postgres database.\n+\"\"\"\n+from itertools import izip_longest\n+import Queue\n+import sys\n+import binascii\n+\n+try:\n+    import psycopg2\n+except ImportError as err:\n+    print \"Module not installed\", err\n+    sys.exit(1)\n+\n+from psycopg2.extras import DictCursor, RealDictCursor\n+from dejavu.database import Database\n+\n+\n+class PostgresDatabase(Database):\n+    \"\"\" Class to interact with Postregres databases.\n+\n+    The queries should be self evident, but they are documented in the event\n+    that they aren't :)\n+    \"\"\"\n+\n+    type = \"postgresql\"\n+\n+    # The number of hashes to insert at a time\n+    NUM_HASHES = 10000\n+\n+    # Tables\n+    FINGERPRINTS_TABLENAME = \"fingerprints\"\n+    SONGS_TABLENAME = \"songs\"","path":"dejavu/database_postgres.py","position":32,"original_position":32,"commit_id":"23bb8c8a0a30543990c56131542ccaa53f4dd46c","original_commit_id":"23bb8c8a0a30543990c56131542ccaa53f4dd46c","user":{"login":"thomascirca","id":1668558,"avatar_url":"https://avatars.githubusercontent.com/u/1668558?v=3","gravatar_id":"","url":"https://api.github.com/users/thomascirca","html_url":"https://github.com/thomascirca","followers_url":"https://api.github.com/users/thomascirca/followers","following_url":"https://api.github.com/users/thomascirca/following{/other_user}","gists_url":"https://api.github.com/users/thomascirca/gists{/gist_id}","starred_url":"https://api.github.com/users/thomascirca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomascirca/subscriptions","organizations_url":"https://api.github.com/users/thomascirca/orgs","repos_url":"https://api.github.com/users/thomascirca/repos","events_url":"https://api.github.com/users/thomascirca/events{/privacy}","received_events_url":"https://api.github.com/users/thomascirca/received_events","type":"User","site_admin":false},"body":"That might make sense for Postgresql / MySQL / etc, but if you implemented Mongo, Rethink, Cassandra, or something not SQLish I don't know if that would directly carry over. @worldveil any thoughts on this? ","created_at":"2015-04-06T01:46:22Z","updated_at":"2015-04-06T01:46:22Z","html_url":"https://github.com/worldveil/dejavu/pull/78#discussion_r27782608","pull_request_url":"https://api.github.com/repos/worldveil/dejavu/pulls/78","_links":{"self":{"href":"https://api.github.com/repos/worldveil/dejavu/pulls/comments/27782608"},"html":{"href":"https://github.com/worldveil/dejavu/pull/78#discussion_r27782608"},"pull_request":{"href":"https://api.github.com/repos/worldveil/dejavu/pulls/78"}}},"pull_request":{"url":"https://api.github.com/repos/worldveil/dejavu/pulls/78","id":32174220,"html_url":"https://github.com/worldveil/dejavu/pull/78","diff_url":"https://github.com/worldveil/dejavu/pull/78.diff","patch_url":"https://github.com/worldveil/dejavu/pull/78.patch","issue_url":"https://api.github.com/repos/worldveil/dejavu/issues/78","number":78,"state":"open","locked":false,"title":"Branch to support postgres backend.","user":{"login":"thomascirca","id":1668558,"avatar_url":"https://avatars.githubusercontent.com/u/1668558?v=3","gravatar_id":"","url":"https://api.github.com/users/thomascirca","html_url":"https://github.com/thomascirca","followers_url":"https://api.github.com/users/thomascirca/followers","following_url":"https://api.github.com/users/thomascirca/following{/other_user}","gists_url":"https://api.github.com/users/thomascirca/gists{/gist_id}","starred_url":"https://api.github.com/users/thomascirca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomascirca/subscriptions","organizations_url":"https://api.github.com/users/thomascirca/orgs","repos_url":"https://api.github.com/users/thomascirca/repos","events_url":"https://api.github.com/users/thomascirca/events{/privacy}","received_events_url":"https://api.github.com/users/thomascirca/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-29T00:43:59Z","updated_at":"2015-04-06T01:46:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"03cbbdcb633d628f980dbab6371846398feb3104","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/worldveil/dejavu/pulls/78/commits","review_comments_url":"https://api.github.com/repos/worldveil/dejavu/pulls/78/comments","review_comment_url":"https://api.github.com/repos/worldveil/dejavu/pulls/comments{/number}","comments_url":"https://api.github.com/repos/worldveil/dejavu/issues/78/comments","statuses_url":"https://api.github.com/repos/worldveil/dejavu/statuses/23bb8c8a0a30543990c56131542ccaa53f4dd46c","head":{"label":"thomascirca:postgres_isolated_redo","ref":"postgres_isolated_redo","sha":"23bb8c8a0a30543990c56131542ccaa53f4dd46c","user":{"login":"thomascirca","id":1668558,"avatar_url":"https://avatars.githubusercontent.com/u/1668558?v=3","gravatar_id":"","url":"https://api.github.com/users/thomascirca","html_url":"https://github.com/thomascirca","followers_url":"https://api.github.com/users/thomascirca/followers","following_url":"https://api.github.com/users/thomascirca/following{/other_user}","gists_url":"https://api.github.com/users/thomascirca/gists{/gist_id}","starred_url":"https://api.github.com/users/thomascirca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomascirca/subscriptions","organizations_url":"https://api.github.com/users/thomascirca/orgs","repos_url":"https://api.github.com/users/thomascirca/repos","events_url":"https://api.github.com/users/thomascirca/events{/privacy}","received_events_url":"https://api.github.com/users/thomascirca/received_events","type":"User","site_admin":false},"repo":{"id":25054293,"name":"dejavu","full_name":"thomascirca/dejavu","owner":{"login":"thomascirca","id":1668558,"avatar_url":"https://avatars.githubusercontent.com/u/1668558?v=3","gravatar_id":"","url":"https://api.github.com/users/thomascirca","html_url":"https://github.com/thomascirca","followers_url":"https://api.github.com/users/thomascirca/followers","following_url":"https://api.github.com/users/thomascirca/following{/other_user}","gists_url":"https://api.github.com/users/thomascirca/gists{/gist_id}","starred_url":"https://api.github.com/users/thomascirca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomascirca/subscriptions","organizations_url":"https://api.github.com/users/thomascirca/orgs","repos_url":"https://api.github.com/users/thomascirca/repos","events_url":"https://api.github.com/users/thomascirca/events{/privacy}","received_events_url":"https://api.github.com/users/thomascirca/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thomascirca/dejavu","description":"Audio fingerprinting and recognition in Python","fork":true,"url":"https://api.github.com/repos/thomascirca/dejavu","forks_url":"https://api.github.com/repos/thomascirca/dejavu/forks","keys_url":"https://api.github.com/repos/thomascirca/dejavu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thomascirca/dejavu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thomascirca/dejavu/teams","hooks_url":"https://api.github.com/repos/thomascirca/dejavu/hooks","issue_events_url":"https://api.github.com/repos/thomascirca/dejavu/issues/events{/number}","events_url":"https://api.github.com/repos/thomascirca/dejavu/events","assignees_url":"https://api.github.com/repos/thomascirca/dejavu/assignees{/user}","branches_url":"https://api.github.com/repos/thomascirca/dejavu/branches{/branch}","tags_url":"https://api.github.com/repos/thomascirca/dejavu/tags","blobs_url":"https://api.github.com/repos/thomascirca/dejavu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thomascirca/dejavu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thomascirca/dejavu/git/refs{/sha}","trees_url":"https://api.github.com/repos/thomascirca/dejavu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thomascirca/dejavu/statuses/{sha}","languages_url":"https://api.github.com/repos/thomascirca/dejavu/languages","stargazers_url":"https://api.github.com/repos/thomascirca/dejavu/stargazers","contributors_url":"https://api.github.com/repos/thomascirca/dejavu/contributors","subscribers_url":"https://api.github.com/repos/thomascirca/dejavu/subscribers","subscription_url":"https://api.github.com/repos/thomascirca/dejavu/subscription","commits_url":"https://api.github.com/repos/thomascirca/dejavu/commits{/sha}","git_commits_url":"https://api.github.com/repos/thomascirca/dejavu/git/commits{/sha}","comments_url":"https://api.github.com/repos/thomascirca/dejavu/comments{/number}","issue_comment_url":"https://api.github.com/repos/thomascirca/dejavu/issues/comments{/number}","contents_url":"https://api.github.com/repos/thomascirca/dejavu/contents/{+path}","compare_url":"https://api.github.com/repos/thomascirca/dejavu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thomascirca/dejavu/merges","archive_url":"https://api.github.com/repos/thomascirca/dejavu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thomascirca/dejavu/downloads","issues_url":"https://api.github.com/repos/thomascirca/dejavu/issues{/number}","pulls_url":"https://api.github.com/repos/thomascirca/dejavu/pulls{/number}","milestones_url":"https://api.github.com/repos/thomascirca/dejavu/milestones{/number}","notifications_url":"https://api.github.com/repos/thomascirca/dejavu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thomascirca/dejavu/labels{/name}","releases_url":"https://api.github.com/repos/thomascirca/dejavu/releases{/id}","created_at":"2014-10-10T21:39:57Z","updated_at":"2015-03-26T02:36:37Z","pushed_at":"2015-03-30T21:38:18Z","git_url":"git://github.com/thomascirca/dejavu.git","ssh_url":"git@github.com:thomascirca/dejavu.git","clone_url":"https://github.com/thomascirca/dejavu.git","svn_url":"https://github.com/thomascirca/dejavu","homepage":null,"size":28774,"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":"worldveil:master","ref":"master","sha":"0b540343c1a88c6f84e6d1394571ea218bb19682","user":{"login":"worldveil","id":1045250,"avatar_url":"https://avatars.githubusercontent.com/u/1045250?v=3","gravatar_id":"","url":"https://api.github.com/users/worldveil","html_url":"https://github.com/worldveil","followers_url":"https://api.github.com/users/worldveil/followers","following_url":"https://api.github.com/users/worldveil/following{/other_user}","gists_url":"https://api.github.com/users/worldveil/gists{/gist_id}","starred_url":"https://api.github.com/users/worldveil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/worldveil/subscriptions","organizations_url":"https://api.github.com/users/worldveil/orgs","repos_url":"https://api.github.com/users/worldveil/repos","events_url":"https://api.github.com/users/worldveil/events{/privacy}","received_events_url":"https://api.github.com/users/worldveil/received_events","type":"User","site_admin":false},"repo":{"id":14512299,"name":"dejavu","full_name":"worldveil/dejavu","owner":{"login":"worldveil","id":1045250,"avatar_url":"https://avatars.githubusercontent.com/u/1045250?v=3","gravatar_id":"","url":"https://api.github.com/users/worldveil","html_url":"https://github.com/worldveil","followers_url":"https://api.github.com/users/worldveil/followers","following_url":"https://api.github.com/users/worldveil/following{/other_user}","gists_url":"https://api.github.com/users/worldveil/gists{/gist_id}","starred_url":"https://api.github.com/users/worldveil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/worldveil/subscriptions","organizations_url":"https://api.github.com/users/worldveil/orgs","repos_url":"https://api.github.com/users/worldveil/repos","events_url":"https://api.github.com/users/worldveil/events{/privacy}","received_events_url":"https://api.github.com/users/worldveil/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/worldveil/dejavu","description":"Audio fingerprinting and recognition in Python","fork":false,"url":"https://api.github.com/repos/worldveil/dejavu","forks_url":"https://api.github.com/repos/worldveil/dejavu/forks","keys_url":"https://api.github.com/repos/worldveil/dejavu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/worldveil/dejavu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/worldveil/dejavu/teams","hooks_url":"https://api.github.com/repos/worldveil/dejavu/hooks","issue_events_url":"https://api.github.com/repos/worldveil/dejavu/issues/events{/number}","events_url":"https://api.github.com/repos/worldveil/dejavu/events","assignees_url":"https://api.github.com/repos/worldveil/dejavu/assignees{/user}","branches_url":"https://api.github.com/repos/worldveil/dejavu/branches{/branch}","tags_url":"https://api.github.com/repos/worldveil/dejavu/tags","blobs_url":"https://api.github.com/repos/worldveil/dejavu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/worldveil/dejavu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/worldveil/dejavu/git/refs{/sha}","trees_url":"https://api.github.com/repos/worldveil/dejavu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/worldveil/dejavu/statuses/{sha}","languages_url":"https://api.github.com/repos/worldveil/dejavu/languages","stargazers_url":"https://api.github.com/repos/worldveil/dejavu/stargazers","contributors_url":"https://api.github.com/repos/worldveil/dejavu/contributors","subscribers_url":"https://api.github.com/repos/worldveil/dejavu/subscribers","subscription_url":"https://api.github.com/repos/worldveil/dejavu/subscription","commits_url":"https://api.github.com/repos/worldveil/dejavu/commits{/sha}","git_commits_url":"https://api.github.com/repos/worldveil/dejavu/git/commits{/sha}","comments_url":"https://api.github.com/repos/worldveil/dejavu/comments{/number}","issue_comment_url":"https://api.github.com/repos/worldveil/dejavu/issues/comments{/number}","contents_url":"https://api.github.com/repos/worldveil/dejavu/contents/{+path}","compare_url":"https://api.github.com/repos/worldveil/dejavu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/worldveil/dejavu/merges","archive_url":"https://api.github.com/repos/worldveil/dejavu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/worldveil/dejavu/downloads","issues_url":"https://api.github.com/repos/worldveil/dejavu/issues{/number}","pulls_url":"https://api.github.com/repos/worldveil/dejavu/pulls{/number}","milestones_url":"https://api.github.com/repos/worldveil/dejavu/milestones{/number}","notifications_url":"https://api.github.com/repos/worldveil/dejavu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/worldveil/dejavu/labels{/name}","releases_url":"https://api.github.com/repos/worldveil/dejavu/releases{/id}","created_at":"2013-11-19T02:50:35Z","updated_at":"2015-04-04T18:35:18Z","pushed_at":"2015-04-03T14:53:26Z","git_url":"git://github.com/worldveil/dejavu.git","ssh_url":"git@github.com:worldveil/dejavu.git","clone_url":"https://github.com/worldveil/dejavu.git","svn_url":"https://github.com/worldveil/dejavu","homepage":null,"size":90417,"stargazers_count":1579,"watchers_count":1579,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":205,"mirror_url":null,"open_issues_count":8,"forks":205,"open_issues":8,"watchers":1579,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/worldveil/dejavu/pulls/78"},"html":{"href":"https://github.com/worldveil/dejavu/pull/78"},"issue":{"href":"https://api.github.com/repos/worldveil/dejavu/issues/78"},"comments":{"href":"https://api.github.com/repos/worldveil/dejavu/issues/78/comments"},"review_comments":{"href":"https://api.github.com/repos/worldveil/dejavu/pulls/78/comments"},"review_comment":{"href":"https://api.github.com/repos/worldveil/dejavu/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/worldveil/dejavu/pulls/78/commits"},"statuses":{"href":"https://api.github.com/repos/worldveil/dejavu/statuses/23bb8c8a0a30543990c56131542ccaa53f4dd46c"}}}}