{"id":18551889,"url":"https://github.com/linsomniac/python-psycopgwrap","last_synced_at":"2025-05-15T11:10:40.439Z","repository":{"id":1178309,"uuid":"1076293","full_name":"linsomniac/python-psycopgwrap","owner":"linsomniac","description":"A helper wrapper for psycopg to make database coding easier in Python.","archived":false,"fork":false,"pushed_at":"2011-01-20T21:37:15.000Z","size":104,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-08T02:51:36.429Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linsomniac.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-11-13T00:35:33.000Z","updated_at":"2015-11-04T12:14:56.000Z","dependencies_parsed_at":"2022-08-16T12:25:29.111Z","dependency_job_id":null,"html_url":"https://github.com/linsomniac/python-psycopgwrap","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsomniac%2Fpython-psycopgwrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsomniac%2Fpython-psycopgwrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsomniac%2Fpython-psycopgwrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsomniac%2Fpython-psycopgwrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linsomniac","download_url":"https://codeload.github.com/linsomniac/python-psycopgwrap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254328389,"owners_count":22052633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T21:10:59.255Z","updated_at":"2025-05-15T11:10:35.431Z","avatar_url":"https://github.com/linsomniac.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"python-psycopgwrap\nWritten by Sean Reifschneider \u003cjafo@tummy.com\u003e\nPlaced in the public domain.\nNo rights reserved.\n\nPlease submit bugs/fixes at:\n   http://github.com/linsomniac/python-psycopgwrap\n\nA wrapper around psycopg2 to make common things easier.  It really doesn't\nfollow the DB-API.  It's mostly for me to experiment with other ways of\ntalking to the database than the standard DB-API.  I've used this in a\nnumber of projects.  It's primary focus is convenience.\n\nHere are a few of the features:\n\n   Query results can be accessed as a dictionary of columns (row['id']).\n\n   Query results can be accessed as attributes (row.id).\n\n   Query results can be accessed as lists (row[0]).\n\n   Queries return indexable iterators, so you can do things like \"for\n   row in query\", and \"query(cmd)[0]\".  Note that indexes can only be\n   larger than or equal to the last index.\n\n   Query arguments are passed as discrete arguments, not as a tuple.\n   Passing as a tuple always makes me want to do a \"%\" and if I accidentally\n   do that it can open up a SQL injection.\n\n   There's an \"insert\" helper that takes a table name and keyword arguments.\n   Similarly there's a \"dictinsert\" helper that takes a dictionary of\n   row:values.\n\nExamples:\n\n   from psycopgwrap import Database as db\n   db.connect('dbname=testdb')\n   user = db.query('SELECT * FROM users WHERE name = %s', name)\n   if user == None:\n      print 'No such user \"%s\"' % name\n   print 'User id: %s' % user.id        #  or user.id_\n   for row in db.query('SELECT * FROM status WHERE id = %s', 500):\n      print 'id:', row.['id']\n\nOther examples:\n\n   db.insert('users', name = 'Al Bert')\n   db.insert('users', { name : 'Al Bert' })\n\n   user_count = db.queryone('SELECT COUNT(*) FROM users')[0]  #  0-th column\n\n   if db.queryone(\"SELECT * FROM users WHERE name = 'Al Bert'\"):\n      print 'Al is in the house'\n   else: print 'No such user'\n\n   try: db.commit()\n   except: db.rollback()\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinsomniac%2Fpython-psycopgwrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinsomniac%2Fpython-psycopgwrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinsomniac%2Fpython-psycopgwrap/lists"}