{"id":13558025,"url":"https://github.com/benoitc/couchdbkit","last_synced_at":"2025-04-06T22:10:33.185Z","repository":{"id":64057471,"uuid":"481525","full_name":"benoitc/couchdbkit","owner":"benoitc","description":"CouchDB python framework","archived":false,"fork":false,"pushed_at":"2018-07-20T20:54:57.000Z","size":3291,"stargazers_count":264,"open_issues_count":38,"forks_count":94,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-30T21:08:16.410Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://couchdbkit.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benoitc.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-01-21T01:15:19.000Z","updated_at":"2024-11-28T16:27:53.000Z","dependencies_parsed_at":"2022-12-02T10:28:51.047Z","dependency_job_id":null,"html_url":"https://github.com/benoitc/couchdbkit","commit_stats":null,"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fcouchdbkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fcouchdbkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fcouchdbkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fcouchdbkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benoitc","download_url":"https://codeload.github.com/benoitc/couchdbkit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557767,"owners_count":20958047,"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-08-01T12:04:41.740Z","updated_at":"2025-04-06T22:10:33.169Z","avatar_url":"https://github.com/benoitc.png","language":"Python","readme":"About\n-----\n\n`Couchdbkit`_ provides you a full featured and easy client to access and\nmanage CouchDB. It allows you to manage a CouchDBserver, databases, doc\nmanagements and view access. All objects mostly reflect python objects for\nconvenience. Server and Databases objects could be used for example as easy\nas using a dict.\n\n.. image:: https://secure.travis-ci.org/benoitc/couchdbkit.png?branch=master\n    :alt: Build Status\n    :target: https://secure.travis-ci.org/benoitc/couchdbkit\n\nInstallation\n------------\n\nCouchdbkit requires Python 2.x superior to 2.6.\n\nTo install couchdbkit using pip you must make sure you have a\nrecent version of distribute installed::\n\n    $ curl -O http://python-distribute.org/distribute_setup.py\n    $ sudo python distribute_setup.py\n    $ easy_install pip\n\nTo install or upgrade to the latest released version of couchdbkit::\n\n    $ pip install couchdbkit\n\nGetting started\n---------------\n\nThis tutorial exposes key features of this library mainly through code\nexamples. For in-depth description of the modules, you'll want to read\nthe `API`_ documentation.\n\nWrite your first CouchDB document\n+++++++++++++++++++++++++++++++++\n\n::\n\n  from couchdbkit import Server\n  # server object\n  server = Server()\n\n  # create database\n  db = server.get_or_create_db(\"greeting\")\n\n  doc = {\"mydoc\": \"test\"}\n  db.save_doc(doc)\n\n::\n\n  import datetime\n  from couchdbkit import *\n\n  class Greeting(Document):\n      author = StringProperty()\n      content = StringProperty()\n      date = DateTimeProperty()\n\n\nStore the submitted Greetings\n+++++++++++++++++++++++++++++\n\nHere is the code to save a greet on ``Greeting``  database. We also see how to create a database::\n\n  from couchdbkit import Server\n\n  # associate Greeting to the db\n  Greeting.set_db(db)\n\n  # create a new greet\n  greet = Greeting(\n      author=\"Benoit\",\n      content=\"Welcome to couchdbkit world\",\n      date=datetime.datetime.utcnow()\n  )\n\n  # save it\n  greet.save()\n\n.. NOTE::\n\n  You can just use the db object to save a Schema: ``db.save(greet)`` .\n\n\nYour document ``greet`` is now in the ``greetings`` db. Each document\nis saved with a ``doc_type`` field that allow you to find easily each\nkind of document with the views. By default ``doc_type`` is the name of\nthe class.\n\nNow that you saved your document, you can update it::\n\n  greet.author = u\"Benoit Chesneau\"\n  greet.save()\n\nHere we updated the author name.\n\nDynamic properties\n++++++++++++++++++\n\nMmm ok, but isn't CouchDB storing documents schema less? Do you want to\nadd a property ? Easy::\n\n  greet.homepage = \"http://www.e-engura.org\"\n  greet.save()\n\nNow you have just added an homepage property to the document.\n\nGet all greetings\n+++++++++++++++++\n\nYou first have to create a view and save it in the db. We will call it\n``greeting/all``. To do this we will use the loader system of couchdbkit\nthat allows you to send views to CouchDB.\n\nLet's create a folder that contains the design doc, and then the folder\nfor the view. On unix::\n\n  mkdir -p ~/Work/couchdbkit/example/_design/greeting/views/all\n\nIn this folder we edit a file `map.js`::\n\n  function(doc) {\n    if (doc.doc_type == \"Greeting\")\n      emit(doc._id, doc);\n      }\n  }\n\nHere is a folder structure::\n\n  /Work/couchdbkit/example/:\n\n  --_design/\n  ---- greetings\n  ------ view\n\nHere is a  screenshot:\n\n.. image:: http://couchdbkit.org/images/gettingstarted.png\n\n\nA system will be provided to manage view creation and other things. As\nsome  noticed, this system works like `couchapp`_ and is fully\ncompatible.\n\nThen we use push function to send the design document to CouchDB::\n\n  from couchdbkit.designer import push\n  push('/path/to/example/_design/greetings', db)\n\nThe design doc is now in the ``greetings`` database and you can get all\ngreets::\n\n  greets = Greeting.view('greeting/all')\n\n.. _Couchdbkit: http://couchdbkit.org\n.. _API: http://couchdbkit.org/doc/api/\n.. _couchapp:  http://github.com/couchapp/couchapp/tree/\n","funding_links":[],"categories":["Python","others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitc%2Fcouchdbkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenoitc%2Fcouchdbkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitc%2Fcouchdbkit/lists"}