{"action":"created","comment":{"url":"https://api.github.com/repos/harryhk/rsData/pulls/comments/67088581","id":67088581,"diff_hunk":"@@ -61,22 +61,38 @@ def __init__(self, table_name, schema ):\n     \n     def create( self, cursor):\n         cursor.execute('create table %s (%s)' % ( self.table_name, self.schema ))\n+        \n+    def delete( self, cursor):\n+        cursor.execute('drop table if exists %s' % ( self.table_name ))\n \n \n def main():\n-    usage = 'usage: %prog [options] dbname'\n-    parser = OptionParser(usage=usage)\n-    (options, args) = parser.parse_args()\n-    \n-    if len(args) != 1:\n-        parser.print_help()\n-        sys.exit(1)\n+\tusage = 'usage: %prog [options] dbname'\n+\tparser = OptionParser(usage=usage)\n+\tparser.add_option(\"-l\", \"--lial\", action=\"store_true\", dest=\"list\", default = False, help= \"list all tables\")\n+\tparser.add_option(\"-f\", \"--force\", action=\"store_true\", dest=\"force\", default = False, help= \"force remove and create tables\")\n+\tparser.add_option(\"-t\", \"--table\", type=\"string\", help=\"name of the table\", dest=\"table\")\n+\t(options, args) = parser.parse_args()\n+\tif options.list:    \n+\t\tprint \"Tables in schemas are: \" + str(Schemas.keys())\n+\t\tsys.exit(1)\n+\tif len(args) != 1:\n+\t\tparser.print_help()\n+\t\tsys.exit(1)\n \n-    dbname = args[0]\n-    \n-    with sql.connect( dbname ) as conn:\n-        for table_name, schema in Schemas.items():\n-            SqlTable( table_name, schema ).create(conn)\n+\tdbname = args[0]\n+\t\n+\t\n+\twith sql.connect( dbname ) as conn:\n+\t\tfor table_name, schema in Schemas.items():\n+\t\t\tif options.table:\n+\t\t\t\tif options.table == table_name:\n+\t\t\t\t\tSqlTable( table_name, schema ).create(conn)\n+\t\t\telif options.force:","path":"dataBase/DBCreator.py","position":43,"original_position":43,"commit_id":"ebefe5eab2df573d6528be86a1faf4a61022e03a","original_commit_id":"ebefe5eab2df573d6528be86a1faf4a61022e03a","user":{"login":"harryhk","id":3707004,"avatar_url":"https://avatars.githubusercontent.com/u/3707004?v=3","gravatar_id":"","url":"https://api.github.com/users/harryhk","html_url":"https://github.com/harryhk","followers_url":"https://api.github.com/users/harryhk/followers","following_url":"https://api.github.com/users/harryhk/following{/other_user}","gists_url":"https://api.github.com/users/harryhk/gists{/gist_id}","starred_url":"https://api.github.com/users/harryhk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harryhk/subscriptions","organizations_url":"https://api.github.com/users/harryhk/orgs","repos_url":"https://api.github.com/users/harryhk/repos","events_url":"https://api.github.com/users/harryhk/events{/privacy}","received_events_url":"https://api.github.com/users/harryhk/received_events","type":"User","site_admin":false},"body":"You don't need to create SqlTable object multiple times. Just one time at line 87 is good. You can then use variable to reference it. ","created_at":"2016-06-15T01:54:38Z","updated_at":"2016-06-15T01:54:38Z","html_url":"https://github.com/harryhk/rsData/pull/3#discussion_r67088581","pull_request_url":"https://api.github.com/repos/harryhk/rsData/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/harryhk/rsData/pulls/comments/67088581"},"html":{"href":"https://github.com/harryhk/rsData/pull/3#discussion_r67088581"},"pull_request":{"href":"https://api.github.com/repos/harryhk/rsData/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/harryhk/rsData/pulls/3","id":73840948,"html_url":"https://github.com/harryhk/rsData/pull/3","diff_url":"https://github.com/harryhk/rsData/pull/3.diff","patch_url":"https://github.com/harryhk/rsData/pull/3.patch","issue_url":"https://api.github.com/repos/harryhk/rsData/issues/3","number":3,"state":"open","locked":false,"title":"Integration","user":{"login":"cherrywbtc","id":10390913,"avatar_url":"https://avatars.githubusercontent.com/u/10390913?v=3","gravatar_id":"","url":"https://api.github.com/users/cherrywbtc","html_url":"https://github.com/cherrywbtc","followers_url":"https://api.github.com/users/cherrywbtc/followers","following_url":"https://api.github.com/users/cherrywbtc/following{/other_user}","gists_url":"https://api.github.com/users/cherrywbtc/gists{/gist_id}","starred_url":"https://api.github.com/users/cherrywbtc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cherrywbtc/subscriptions","organizations_url":"https://api.github.com/users/cherrywbtc/orgs","repos_url":"https://api.github.com/users/cherrywbtc/repos","events_url":"https://api.github.com/users/cherrywbtc/events{/privacy}","received_events_url":"https://api.github.com/users/cherrywbtc/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-15T01:48:27Z","updated_at":"2016-06-15T01:54:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"487e64d0c806c7828b156d88c1c9926cdd9a5f07","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/harryhk/rsData/pulls/3/commits","review_comments_url":"https://api.github.com/repos/harryhk/rsData/pulls/3/comments","review_comment_url":"https://api.github.com/repos/harryhk/rsData/pulls/comments{/number}","comments_url":"https://api.github.com/repos/harryhk/rsData/issues/3/comments","statuses_url":"https://api.github.com/repos/harryhk/rsData/statuses/ebefe5eab2df573d6528be86a1faf4a61022e03a","head":{"label":"cherrywbtc:integration","ref":"integration","sha":"ebefe5eab2df573d6528be86a1faf4a61022e03a","user":{"login":"cherrywbtc","id":10390913,"avatar_url":"https://avatars.githubusercontent.com/u/10390913?v=3","gravatar_id":"","url":"https://api.github.com/users/cherrywbtc","html_url":"https://github.com/cherrywbtc","followers_url":"https://api.github.com/users/cherrywbtc/followers","following_url":"https://api.github.com/users/cherrywbtc/following{/other_user}","gists_url":"https://api.github.com/users/cherrywbtc/gists{/gist_id}","starred_url":"https://api.github.com/users/cherrywbtc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cherrywbtc/subscriptions","organizations_url":"https://api.github.com/users/cherrywbtc/orgs","repos_url":"https://api.github.com/users/cherrywbtc/repos","events_url":"https://api.github.com/users/cherrywbtc/events{/privacy}","received_events_url":"https://api.github.com/users/cherrywbtc/received_events","type":"User","site_admin":false},"repo":{"id":60479932,"name":"rsData","full_name":"cherrywbtc/rsData","owner":{"login":"cherrywbtc","id":10390913,"avatar_url":"https://avatars.githubusercontent.com/u/10390913?v=3","gravatar_id":"","url":"https://api.github.com/users/cherrywbtc","html_url":"https://github.com/cherrywbtc","followers_url":"https://api.github.com/users/cherrywbtc/followers","following_url":"https://api.github.com/users/cherrywbtc/following{/other_user}","gists_url":"https://api.github.com/users/cherrywbtc/gists{/gist_id}","starred_url":"https://api.github.com/users/cherrywbtc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cherrywbtc/subscriptions","organizations_url":"https://api.github.com/users/cherrywbtc/orgs","repos_url":"https://api.github.com/users/cherrywbtc/repos","events_url":"https://api.github.com/users/cherrywbtc/events{/privacy}","received_events_url":"https://api.github.com/users/cherrywbtc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cherrywbtc/rsData","description":"","fork":true,"url":"https://api.github.com/repos/cherrywbtc/rsData","forks_url":"https://api.github.com/repos/cherrywbtc/rsData/forks","keys_url":"https://api.github.com/repos/cherrywbtc/rsData/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cherrywbtc/rsData/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cherrywbtc/rsData/teams","hooks_url":"https://api.github.com/repos/cherrywbtc/rsData/hooks","issue_events_url":"https://api.github.com/repos/cherrywbtc/rsData/issues/events{/number}","events_url":"https://api.github.com/repos/cherrywbtc/rsData/events","assignees_url":"https://api.github.com/repos/cherrywbtc/rsData/assignees{/user}","branches_url":"https://api.github.com/repos/cherrywbtc/rsData/branches{/branch}","tags_url":"https://api.github.com/repos/cherrywbtc/rsData/tags","blobs_url":"https://api.github.com/repos/cherrywbtc/rsData/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cherrywbtc/rsData/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cherrywbtc/rsData/git/refs{/sha}","trees_url":"https://api.github.com/repos/cherrywbtc/rsData/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cherrywbtc/rsData/statuses/{sha}","languages_url":"https://api.github.com/repos/cherrywbtc/rsData/languages","stargazers_url":"https://api.github.com/repos/cherrywbtc/rsData/stargazers","contributors_url":"https://api.github.com/repos/cherrywbtc/rsData/contributors","subscribers_url":"https://api.github.com/repos/cherrywbtc/rsData/subscribers","subscription_url":"https://api.github.com/repos/cherrywbtc/rsData/subscription","commits_url":"https://api.github.com/repos/cherrywbtc/rsData/commits{/sha}","git_commits_url":"https://api.github.com/repos/cherrywbtc/rsData/git/commits{/sha}","comments_url":"https://api.github.com/repos/cherrywbtc/rsData/comments{/number}","issue_comment_url":"https://api.github.com/repos/cherrywbtc/rsData/issues/comments{/number}","contents_url":"https://api.github.com/repos/cherrywbtc/rsData/contents/{+path}","compare_url":"https://api.github.com/repos/cherrywbtc/rsData/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cherrywbtc/rsData/merges","archive_url":"https://api.github.com/repos/cherrywbtc/rsData/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cherrywbtc/rsData/downloads","issues_url":"https://api.github.com/repos/cherrywbtc/rsData/issues{/number}","pulls_url":"https://api.github.com/repos/cherrywbtc/rsData/pulls{/number}","milestones_url":"https://api.github.com/repos/cherrywbtc/rsData/milestones{/number}","notifications_url":"https://api.github.com/repos/cherrywbtc/rsData/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cherrywbtc/rsData/labels{/name}","releases_url":"https://api.github.com/repos/cherrywbtc/rsData/releases{/id}","deployments_url":"https://api.github.com/repos/cherrywbtc/rsData/deployments","created_at":"2016-06-05T20:36:08Z","updated_at":"2016-06-05T13:50:26Z","pushed_at":"2016-06-15T01:47:37Z","git_url":"git://github.com/cherrywbtc/rsData.git","ssh_url":"git@github.com:cherrywbtc/rsData.git","clone_url":"https://github.com/cherrywbtc/rsData.git","svn_url":"https://github.com/cherrywbtc/rsData","homepage":null,"size":10,"stargazers_count":0,"watchers_count":0,"language":null,"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":"harryhk:integration","ref":"integration","sha":"74522f15aaf96236dcc6d880469f170748424f54","user":{"login":"harryhk","id":3707004,"avatar_url":"https://avatars.githubusercontent.com/u/3707004?v=3","gravatar_id":"","url":"https://api.github.com/users/harryhk","html_url":"https://github.com/harryhk","followers_url":"https://api.github.com/users/harryhk/followers","following_url":"https://api.github.com/users/harryhk/following{/other_user}","gists_url":"https://api.github.com/users/harryhk/gists{/gist_id}","starred_url":"https://api.github.com/users/harryhk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harryhk/subscriptions","organizations_url":"https://api.github.com/users/harryhk/orgs","repos_url":"https://api.github.com/users/harryhk/repos","events_url":"https://api.github.com/users/harryhk/events{/privacy}","received_events_url":"https://api.github.com/users/harryhk/received_events","type":"User","site_admin":false},"repo":{"id":60462392,"name":"rsData","full_name":"harryhk/rsData","owner":{"login":"harryhk","id":3707004,"avatar_url":"https://avatars.githubusercontent.com/u/3707004?v=3","gravatar_id":"","url":"https://api.github.com/users/harryhk","html_url":"https://github.com/harryhk","followers_url":"https://api.github.com/users/harryhk/followers","following_url":"https://api.github.com/users/harryhk/following{/other_user}","gists_url":"https://api.github.com/users/harryhk/gists{/gist_id}","starred_url":"https://api.github.com/users/harryhk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harryhk/subscriptions","organizations_url":"https://api.github.com/users/harryhk/orgs","repos_url":"https://api.github.com/users/harryhk/repos","events_url":"https://api.github.com/users/harryhk/events{/privacy}","received_events_url":"https://api.github.com/users/harryhk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/harryhk/rsData","description":"","fork":false,"url":"https://api.github.com/repos/harryhk/rsData","forks_url":"https://api.github.com/repos/harryhk/rsData/forks","keys_url":"https://api.github.com/repos/harryhk/rsData/keys{/key_id}","collaborators_url":"https://api.github.com/repos/harryhk/rsData/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/harryhk/rsData/teams","hooks_url":"https://api.github.com/repos/harryhk/rsData/hooks","issue_events_url":"https://api.github.com/repos/harryhk/rsData/issues/events{/number}","events_url":"https://api.github.com/repos/harryhk/rsData/events","assignees_url":"https://api.github.com/repos/harryhk/rsData/assignees{/user}","branches_url":"https://api.github.com/repos/harryhk/rsData/branches{/branch}","tags_url":"https://api.github.com/repos/harryhk/rsData/tags","blobs_url":"https://api.github.com/repos/harryhk/rsData/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/harryhk/rsData/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/harryhk/rsData/git/refs{/sha}","trees_url":"https://api.github.com/repos/harryhk/rsData/git/trees{/sha}","statuses_url":"https://api.github.com/repos/harryhk/rsData/statuses/{sha}","languages_url":"https://api.github.com/repos/harryhk/rsData/languages","stargazers_url":"https://api.github.com/repos/harryhk/rsData/stargazers","contributors_url":"https://api.github.com/repos/harryhk/rsData/contributors","subscribers_url":"https://api.github.com/repos/harryhk/rsData/subscribers","subscription_url":"https://api.github.com/repos/harryhk/rsData/subscription","commits_url":"https://api.github.com/repos/harryhk/rsData/commits{/sha}","git_commits_url":"https://api.github.com/repos/harryhk/rsData/git/commits{/sha}","comments_url":"https://api.github.com/repos/harryhk/rsData/comments{/number}","issue_comment_url":"https://api.github.com/repos/harryhk/rsData/issues/comments{/number}","contents_url":"https://api.github.com/repos/harryhk/rsData/contents/{+path}","compare_url":"https://api.github.com/repos/harryhk/rsData/compare/{base}...{head}","merges_url":"https://api.github.com/repos/harryhk/rsData/merges","archive_url":"https://api.github.com/repos/harryhk/rsData/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/harryhk/rsData/downloads","issues_url":"https://api.github.com/repos/harryhk/rsData/issues{/number}","pulls_url":"https://api.github.com/repos/harryhk/rsData/pulls{/number}","milestones_url":"https://api.github.com/repos/harryhk/rsData/milestones{/number}","notifications_url":"https://api.github.com/repos/harryhk/rsData/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/harryhk/rsData/labels{/name}","releases_url":"https://api.github.com/repos/harryhk/rsData/releases{/id}","deployments_url":"https://api.github.com/repos/harryhk/rsData/deployments","created_at":"2016-06-05T13:50:26Z","updated_at":"2016-06-05T13:50:26Z","pushed_at":"2016-06-15T01:48:28Z","git_url":"git://github.com/harryhk/rsData.git","ssh_url":"git@github.com:harryhk/rsData.git","clone_url":"https://github.com/harryhk/rsData.git","svn_url":"https://github.com/harryhk/rsData","homepage":null,"size":9,"stargazers_count":0,"watchers_count":0,"language":null,"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":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/harryhk/rsData/pulls/3"},"html":{"href":"https://github.com/harryhk/rsData/pull/3"},"issue":{"href":"https://api.github.com/repos/harryhk/rsData/issues/3"},"comments":{"href":"https://api.github.com/repos/harryhk/rsData/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/harryhk/rsData/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/harryhk/rsData/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/harryhk/rsData/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/harryhk/rsData/statuses/ebefe5eab2df573d6528be86a1faf4a61022e03a"}}}}
{"actor":{"display_login":"harryhk"}}