A Python library for Cloudant and CouchDB

Overview

Cloudant Python Client

Build Status Readthedocs Compatibility pypi

This is the official Cloudant library for Python.

Installation and Usage

Released versions of this library are hosted on PyPI and can be installed with pip.

In order to install the latest version, execute

pip install cloudant

Getting started

See Getting started (readthedocs.io)

API Reference

See API reference docs (readthedocs.io)

Related Documentation

Development

See CONTRIBUTING.md

Using in other projects

The preferred approach for using python-cloudant in other projects is to use the PyPI as described above.

Examples in open source projects

Getting Started with Python Flask on IBM Cloud

Movie Recommender Demo:

Watson Recipe Bot:

License

Copyright © 2015 IBM. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Issues

Before opening a new issue please consider the following:

  • Only the latest release is supported. If at all possible please try to reproduce the issue using the latest version.
  • Please check the existing issues to see if the problem has already been reported. Note that the default search includes only open issues, but it may already have been closed.
  • Cloudant customers should contact Cloudant support for urgent issues.
  • When opening a new issue here in github please complete the template fully.

Migrating to cloudant-python-sdk library

We have a newly supported Cloudant Python SDK named cloudant-python-sdk. For advice on migrating from this module see MIGRATION.md.

Comments
  • encoding with 'idna' codec failed (UnicodeError: label empty or too long)

    encoding with 'idna' codec failed (UnicodeError: label empty or too long)

    client = Cloudant(serviceUsername, servicePassword, url=serviceURL) client.connect()

    • Python 3 `--------------------------------------------------------------------------- UnicodeError Traceback (most recent call last) /Users/dsg281/anaconda/lib/python3.6/encodings/idna.py in encode(self, input, errors) 164 if not (0 < len(label) < 64): --> 165 raise UnicodeError("label empty or too long") 166 if len(labels[-1]) >= 64:

    UnicodeError: label empty or too long

    The above exception was the direct cause of the following exception:

    UnicodeError Traceback (most recent call last) in () 1 # Use the Cloudant library to create a Cloudant client. 2 client = Cloudant(serviceUsername, servicePassword, url=serviceURL) ----> 3 client.connect()

    /Users/dsg281/anaconda/lib/python3.6/site-packages/cloudant/client.py in connect(self) 140 self.r_session.headers.update(self._client_user_header) 141 --> 142 self.session_login() 143 144 # Utilize an event hook to append to the response message

    /Users/dsg281/anaconda/lib/python3.6/site-packages/cloudant/client.py in session_login(self, user, passwd) 181 :param str auth_token: Authentication token used to connect to server. 182 """ --> 183 self.change_credentials(user=user, auth_token=passwd) 184 185 def change_credentials(self, user=None, auth_token=None):

    /Users/dsg281/anaconda/lib/python3.6/site-packages/cloudant/client.py in change_credentials(self, user, auth_token) 191 """ 192 self.r_session.set_credentials(user, auth_token) --> 193 self.r_session.login() 194 195 def session_logout(self):

    /Users/dsg281/anaconda/lib/python3.6/site-packages/cloudant/_client_session.py in login(self) 148 'POST', 149 self._session_url, --> 150 data={'name': self._username, 'password': self._password}, 151 ) 152 resp.raise_for_status()

    /Users/dsg281/anaconda/lib/python3.6/site-packages/cloudant/_client_session.py in request(self, method, url, **kwargs) 63 """ 64 resp = super(ClientSession, self).request( ---> 65 method, url, timeout=self._timeout, **kwargs) 66 67 return resp

    /Users/dsg281/anaconda/lib/python3.6/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) 497 498 settings = self.merge_environment_settings( --> 499 prep.url, proxies, stream, verify, cert 500 ) 501

    /Users/dsg281/anaconda/lib/python3.6/site-packages/requests/sessions.py in merge_environment_settings(self, url, proxies, stream, verify, cert) 670 # Set environment's proxies. 671 no_proxy = proxies.get('no_proxy') if proxies is not None else None --> 672 env_proxies = get_environ_proxies(url, no_proxy=no_proxy) 673 for (k, v) in env_proxies.items(): 674 proxies.setdefault(k, v)

    /Users/dsg281/anaconda/lib/python3.6/site-packages/requests/utils.py in get_environ_proxies(url, no_proxy) 690 :rtype: dict 691 """ --> 692 if should_bypass_proxies(url, no_proxy=no_proxy): 693 return {} 694 else:

    /Users/dsg281/anaconda/lib/python3.6/site-packages/requests/utils.py in should_bypass_proxies(url, no_proxy) 674 with set_environ('no_proxy', no_proxy_arg): 675 try: --> 676 bypass = proxy_bypass(netloc) 677 except (TypeError, socket.gaierror): 678 bypass = False

    /Users/dsg281/anaconda/lib/python3.6/urllib/request.py in proxy_bypass(host) 2610 return proxy_bypass_environment(host, proxies) 2611 else: -> 2612 return proxy_bypass_macosx_sysconf(host) 2613 2614 def getproxies():

    /Users/dsg281/anaconda/lib/python3.6/urllib/request.py in proxy_bypass_macosx_sysconf(host) 2587 def proxy_bypass_macosx_sysconf(host): 2588 proxy_settings = _get_proxy_settings() -> 2589 return _proxy_bypass_macosx_sysconf(host, proxy_settings) 2590 2591 def getproxies_macosx_sysconf():

    /Users/dsg281/anaconda/lib/python3.6/urllib/request.py in _proxy_bypass_macosx_sysconf(host, proxy_settings) 2560 if hostIP is None: 2561 try: -> 2562 hostIP = socket.gethostbyname(hostonly) 2563 hostIP = ip2num(hostIP) 2564 except OSError:

    UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long)`

    opened by Rahulvks 25
  • Can you connect using an auth token/API key instead of user/password?

    Can you connect using an auth token/API key instead of user/password?

    Is there a way to pass a base64 auth token to Cloudant() for creating a new client? Right now I only see passing it username and password. It calls the attribute "auth_token" but it doesn't seem to work unless I use the explicit password.

    Code I'm trying:

        with Cloudant(config['cloudant_user'],config['cloudant_auth'], account=config['cloudant_user']) as client:
    

    Reponse:

    Traceback (most recent call last):
      File "./dirscan.py", line 818, in <module>
        main(sys.argv[1:])
      File "./dirscan.py", line 152, in main
        load_config(config['passed_config_file'])
      File "./dirscan.py", line 390, in load_config
        with Cloudant(config['cloudant_user'], config['cloudant_auth'], account=config['cloudant_user']) as client:
    AttributeError: __exit__
    

    Related question: I see that I can generate an API key pair, but I don't see any calls in the API to set what permissions those keys have. (Such as setting their permissions on a specific database once they're created.) Am I just missing it?

    question 
    opened by bradwbonn 24
  • paginate by startkey

    paginate by startkey

    Checklist

    • [x] Tick to sign-off your agreement to the Developer Certificate of Origin (DCO) 1.1
    • [x] Added tests for code changes or test/build only changes
    • [x] Updated the change log file (CHANGES.md|CHANGELOG.md) or test/build only changes
    • [x] Completed the PR template below:

    Description

    Make Result's iteration faster paginating by startkey instead of skip.

    Fixes #436

    Approach

    As per #436 , paginating by skip could be super-slow. This patch fix the problem by using startkey so every iteration run in constant time.

    Schema & API Changes

    • "No change"

    Security and Privacy

    • "No change"

    Testing

    • No new tests because current ones are enough

    Monitoring and Logging

    • "No change"
    opened by aogier 15
  • Document fetch fails when uses its default json decoder and module simplejson is present

    Document fetch fails when uses its default json decoder and module simplejson is present

    Bug Description

    Document.fetch() fails when it uses its default json decoder and simplejson is in the environment.

    Steps to reproduce and code sample to demonstrate the issue

    To reproduce, just run a simple document fetch like this having simplejson package in the environment:

    from cloudant import cloudant
    from cloudant.database import CloudantDatabase
    from cloudant.document import Document
    
    def fetch_by_id(usr, pwd,url,db_name,id):
      with cloudant(user=usr, passwd=pwd, url=url) as client:
        db = CloudantDatabase(client, db_name)
        doc = Document(db, id)
        if doc.exists():
            doc.fetch()
    

    Expected behavior

    The full document should be retrieved by fetch function, instead when simplejson is reachable in the environment, it will raise the following error:

    File \"/usr/local/lib/python3.6/site-packages/simplejson/__init__.py\", line 535, in loads
    return cls(encoding=encoding, **kw).decode(s)
    TypeError: __init__() got an unexpected keyword argument 'encoding'
    

    What actually happened

    Starting in this line: self.update(resp.json(cls=self.decoder)):

    1. json() function from requests.models is called with argument cls and value json.JSONDecoder, as self.decoder was initialized by default when no decoder is passed to Document
    2. a JSON decoder is imported selectively in requests.compat module: when simplejson is present, then the json decoder implementation comes from that package
    3. the JSON decoder from simplejson package is used to load the contents of the response
    4. now, argument cls is a json.JSONDecoder (see point 1), and it does not expect an argument called encoding, thus a TypeError is raised.

    Environment details

    Version affected: 2.10.0 Note that in version 2.9.0, cls=self.decoder was not passed to resp.json().

    opened by dariosm 15
  • db.all_docs() with keys returns HTTP 415

    db.all_docs() with keys returns HTTP 415 "Unsupported media type with url"

    • Cloudant (python-cloudant) version 2.0.0
    • Python version 2.7.10

    I can POST a list of keys as JSON data to the requests library, but on the same DB using the Cloudant python library, the call fails with an unsupported media type error. Is it not specifying the content-type properly?

    Below is the code. old_method() uses requests, new_method() uses python-cloudant.

            def old_method():
                # Uses requests library
                myurl = 'https://{0}.cloudant.com/{1}/_all_docs?include_docs=true'.format(
                    self.config['cloudant_account'],
                    self.scandb.metadata()['db_name']
                )
                my_header = {'Content-Type': 'application/json'}
                try:
                    r = requests.post(
                        myurl,
                        headers = my_header,
                        auth = (config['cloudant_user'],config['cloudant_auth']),
                        data = json.dumps({ 'keys': self.file_doc_batch.keys() })
                    )
                    result = r.json()
                except Exception as e:
                    logging.fatal("Unable to execute HTTP POST: {0}".format(e))
                    sys.exit("Unable to execute HTTP POST: {0}".format(e))
                return result
    
            def new_method():
                # Uses Cloudant python library
                result = self.scandb.all_docs(
                    include_docs = True,
                    keys = self.file_doc_batch.keys()
                )
                return result
    
    

    old_method() returns JSON from the _all_docs endpoint with the expected 'rows' array for each key included.
    new_method() errors with HTTP 415:

      File "./dirscan.py", line 758, in new_method
        keys = self.file_doc_batch.keys()
      File "/Library/Python/2.7/site-packages/cloudant/database.py", line 372, in all_docs
        resp.raise_for_status()
      File "/Library/Python/2.7/site-packages/requests/models.py", line 844, in raise_for_status
        raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 415 Client Error: Unsupported Media Type for url: https://bradwbonn.cloudant.com/scandb-1464114444/_all_docs?include_docs=true
    
    bug 
    opened by bradwbonn 13
  • Get document by revision

    Get document by revision

    …ocument if it is available in the database

    Checklist

    • [v] Tick to sign-off your agreement to the Developer Certificate of Origin (DCO) 1.1
    • [v] Added tests for code changes or test/build only changes
    • [v] Updated the change log file (CHANGES.md|CHANGELOG.md) or test/build only changes
    • [v] Completed the PR template below:

    Description

    This adds a simple way to retrieve a previous revision of a document.

    Approach

    Changed cloudant.document.Document.fetch to take keyword arguments and pass them through to the raw session object.

    Changed cloudant.document.Document.exists to take keyword arguments and pass them through to the raw session object when making the HEAD request.

    Added a new method cloudant.document.Document.get_revision which creates a new Document instance, checks if the data for the revision exists, and returns a dict holding the document data for that revision.

    Schema & API Changes

    cloudant.document.Document.exists and cloudant.document.Document.fetch now can also take keyword arguments.

    Security and Privacy

    No change

    Testing

    Modified tests.unit.document_tests.test_document_exists_raises_httperror to account for the changed API

    Monitoring and Logging

    No change

    opened by RaduG 11
  • Fix Document.get_attachment bug

    Fix Document.get_attachment bug

    What

    Fix the Document get_attachment method so that it now correctly creates text and binary files as exepected as well as returns text, binary, and json content appropriately.

    How

    • Make the attachment_type method argument optional.
    • Add logic to figure out what type of content should be returned by the method as well as what kind of file should be created if a write_to argument is provided.

    Testing

    • Add a test to verify getting a text attachment and writing it to a file.
    • Add a test to verify getting a json attachment and writing it to a file.
    • Add a test to verify getting a binary attachment and writing it to a file.

    Reviewers

    reviewer: @emlaver reviewer: @ricellis

    Issues

    • #102
    opened by alfinkel 11
  • py3 support

    py3 support

    What:

    Add Python 3 compatibility.

    Why:

    Python 3, now in it's fifth revision, has obtained enough critical mass in the developer community to make supporting it worthwhile. Bluemix supports Python 3 Cloud Foundry applications as a built in community runtime and makes attaching a Cloudant service an easy and desirable option. Lack of a Python 3 compatible API inhibits adoption of the Cloudant service.

    How:

    A new private module, _2to3.py, was added containing compatibility methods. py2 or py3 unique types and methods were replaced throughout the code base with equivalents from the compatibility module. Python 2 is treated as the special case given it's unique semantics are "deprecated" and py3 and onward is the new normal (all hail the BDFL).

    Tests:

    All test cases under the tests/ directory were updated to function under py2 and py3 with similar compatibility methods. All unit tests (tests/unit/*) were run and pass with py2.7 and py3.5 using a local couchdb instance. The 85 cloudant specific test cases have not yet been run to my knowledge. The Travis CI environment only executes a py2.7 test -- a py3.5 test should be added before a final merge is complete (I'm not sure how to do it).

    Issues: #23

    reviewer @alfinkel reviewer @evansde77

    opened by rredburn 11
  • Remove the fields parameter from required Query parameters

    Remove the fields parameter from required Query parameters

    What:

    Remove the enforcement of the fields as a required parameter for making a query.

    Why:

    Cloudant supports not passing in the fields when making a query. If no fields are provided then all the fields of each document are returned. This PR makes sure that python-cloudant mimics that behavior.

    How:

    • In CloudantDatabase.get_query_result() the fields parameter is checked for existence before instantiating the Query.
    • In Query.__call__ I removed the check for fields being None or empty.

    Tests:

    • The query callable tests that test for fields being empty or None were removed.
    • The tests were updated to treat fields as a **kwargs argument.
    • Test that calling db.get_query_result handles a nonexistent fields parameter.

    Issues:

    • #86

    reviewer @alfinkel reviewer @ricellis

    opened by JanekLehr 11
  • ConnectionResetError: [Errno 104] Connection reset by peer

    ConnectionResetError: [Errno 104] Connection reset by peer

    Bug Description

    We are using the cloudant-python lib to handle our connections with our database. Randomly the code raises a ConnectionResetError.

    1. Steps to reproduce and the simplest code sample possible to demonstrate the issue

    I could not create a external scenario to reproduce it, but I will outline the context of the error scenario.

    I have an code that make iterative calls to our couchdb. Every loop make the same call to an specific view, but with different keys.

    Sometimes, the request is not sent and the program return the error below.

    At the first I thought that could be something related with our proxy - Haproxy. But, I have tested the script connecting directly with the database and the error continued. On the next, without the HAPROXY, I replaced the request call (from the python-cloudant) to a simple request (from request package) and the error disappeared, so I think that the error is related with this lib. In addition, my couchdb server does not log any request call, so, its is one more info that suggest that the error is on the client side.

    2. What you expected to happen

    The script should make the requests and finish without any error.

    3. What actually happened

    Eventually in some requests the script raise the error below.

    2021-02-10 11:16:14 ERROR: Exception occurred on parse_candidate
    Traceback (most recent call last):
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
        httplib_response = self._make_request(
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/urllib3/connectionpool.py", line 445, in _make_request
        six.raise_from(e, None)
      File "<string>", line 3, in raise_from
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/urllib3/connectionpool.py", line 440, in _make_request
        httplib_response = conn.getresponse()
      File "/usr/lib/python3.9/http/client.py", line 1347, in getresponse
        response.begin()
      File "/usr/lib/python3.9/http/client.py", line 307, in begin
        version, status, reason = self._read_status()
      File "/usr/lib/python3.9/http/client.py", line 268, in _read_status
        line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
      File "/usr/lib/python3.9/socket.py", line 704, in readinto
        return self._sock.recv_into(b)
    ConnectionResetError: [Errno 104] Connection reset by peer
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
        resp = conn.urlopen(
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
        retries = retries.increment(
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/urllib3/util/retry.py", line 531, in increment
        raise six.reraise(type(error), error, _stacktrace)
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/urllib3/packages/six.py", line 734, in reraise
        raise value.with_traceback(tb)
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
        httplib_response = self._make_request(
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/urllib3/connectionpool.py", line 445, in _make_request
        six.raise_from(e, None)
      File "<string>", line 3, in raise_from
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/urllib3/connectionpool.py", line 440, in _make_request
        httplib_response = conn.getresponse()
      File "/usr/lib/python3.9/http/client.py", line 1347, in getresponse
        response.begin()
      File "/usr/lib/python3.9/http/client.py", line 307, in begin
        version, status, reason = self._read_status()
      File "/usr/lib/python3.9/http/client.py", line 268, in _read_status
        line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
      File "/usr/lib/python3.9/socket.py", line 704, in readinto
        return self._sock.recv_into(b)
    urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/common/decorators/log_exception.py", line 8, in _log_exception_and_ignore
        return function(*args, **kwargs)
      File "/home/danilo/Workspace/stakeholders-extraction/sl_stakeholders_extraction/tse/parsers/candidature_parser.py", line 57, in parse_candidate
        candidate_info['CurrentParty'] = get_party(candidature['SiglaPartido'])
      File "/home/danilo/Workspace/stakeholders-extraction/sl_stakeholders_extraction/tse/parsers/__init__.py", line 5, in get_party
        return get_party_by_initials(party_initials)
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/common/utils/parties.py", line 16, in get_party_by_initials
        return _get_party(initials, PARTIES_VIEW_NAME, 'by_initials')
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/common/utils/parties.py", line 21, in _get_party
        party = _get_party_from_view(ddoc_id, view_name, key)
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/common/utils/parties.py", line 28, in _get_party_from_view
        view_result = PARTIES_DB.get_view_result(view_name=view_name,
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/cloudant/result.py", line 427, in all
        return self[:]
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/cloudant/result.py", line 223, in __getitem__
        data = self._ref(**self.options)
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/cloudant/view.py", line 236, in __call__
        resp = get_docs(self._r_session,
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/cloudant/_common_util.py", line 261, in get_docs
        resp = r_session.get(url, headers=headers, params=f_params)
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/requests/sessions.py", line 555, in get
        return self.request('GET', url, **kwargs)
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/cloudant/_client_session.py", line 130, in request
        return super(BasicSession, self).request(
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/cloudant/_client_session.py", line 65, in request
        resp = super(ClientSession, self).request(
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
        resp = self.send(prep, **send_kwargs)
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
        r = adapter.send(request, **kwargs)
      File "/home/danilo/Workspace/stakeholders-extraction/env/lib/python3.9/site-packages/requests/adapters.py", line 498, in send
        raise ConnectionError(err, request=request)
    requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
    

    Environment details

    • Cloudant

      2.14.0

    • Python version

      3.9.1

    opened by DaniloOliveira28 9
  • Query index in couchdb and support dict syntax: _id in database

    Query index in couchdb and support dict syntax: _id in database

    What

    I added 2 things, I needed both of them at the same time so I ended up doing a single PR instead of 2, sorry for that.

    • Move create_query_index from CloudantDatabase to CouchDatabase as the JSON indexes for Mango queries are now part of CouchDB.
    • Add a feature to allow checking if a document exists in a DB without having to resort to try-catch blocks, using standard dict syntax:
    _id = 'julia30'
    doc_exists = _id in my_database
    
    if doc_exists:
        print('doc with _id julia30 exists in DB')
    

    How

    • create_query_index: move the method from one class to the other. Move the tests from Cloudant specific to CouchDB.
    • Add a dict override for __contains__ that checks in the remote DB if the document exists.

    Testing

    Create a CouchDatabase object and call the create_query_index the same way you would for a Cloudant database.

    Issues

    I didn't create an issue before solving it.

    opened by tiangolo 9
Releases(2.15.0)
  • 2.15.0(Aug 26, 2021)

    • [NEW] Override dict.get method for CouchDatabase to add remote parameter allowing it to retrieve a remote document if specified.
    • [FIXED] Fixed the documentation for bookmarks.
    • [FIXED] Also exit follow_replication for failed state.
    • [FIXED] Fixed result paging for grouped view queries.
    • [FIXED] Incorrect use of username as account name in Cloudant.bluemix().
    • [FIXED] Use custom encoder (if provided) for all view key params not just keys.
    • [FIXED] Support boolean type for key, endkey, and startkey in view requests.
    • [DEPRECATED] This library is now deprecated and will be EOL on Dec 31 2021.
    • [REMOVED] Removed Python 2 compatibility from the supported environments.
    • [IMPROVED] Documented use of None account name and url override for Cloudant.iam().
    • [IMPROVED] - Document IDs and attachment names are now rejected if they could cause an unexpected Cloudant request. We have seen that some applications pass unsantized document IDs to SDK functions (e.g. direct from user requests). In response to this we have updated many functions to reject obviously invalid paths. However, for complete safety applications must still validate that document IDs and attachment names match expected patterns.
    Source code(tar.gz)
    Source code(zip)
  • 2.14.0(Aug 18, 2020)

    • [FIXED] Set default value for partitioned parameter to false when creating a design document.
    • [FIXED] Corrected setting of partitioned flag for create_query_index requests.
    • [FIXED] Added a workaround for installation on Python 2.
    Source code(tar.gz)
    Source code(zip)
  • 2.13.0(Apr 16, 2020)

  • 2.12.0(Mar 28, 2019)

    • [NEW] Added partitioned database support.
    • [FIXED] Bug where document context manager performed remote save despite uncaught exceptions being raised inside with block.
    • [FIXED] Fixed parameter type of selector in docstring.
    • [FIXED] Removed internal Document._document_id property to allow a safe use of dict's methods.
    • [IMPROVED] Performance of Result iteration by releasing result objects immediately after they are returned to the client.
    • [IMPROVED] Updated Getting started section with a get_query_result example.
    • [IMPROVED] Updated Result iteration by paginating with views' startkey and queries' bookmark.
    Source code(tar.gz)
    Source code(zip)
  • 2.11.0(Jan 21, 2019)

  • 2.10.2(Dec 19, 2018)

  • 2.10.1(Nov 16, 2018)

    • [FIXED] Unexpected keyword argument errors when using the library with the simplejson module present in the environment caused by requests preferentially loading it over the system json module.
    Source code(tar.gz)
    Source code(zip)
  • 2.10.0(Sep 20, 2018)

    • [NEW] Add custom JSON encoder/decoder option to Document constructor.
    • [NEW] Add new view parameters, stable and update, as keyword arguments to get_view_result.
    • [NEW] Allow arbitrary query parameters to be passed to custom changes filters.
    • [FIXED] Case where an exception was raised after successful retry when using doc.update_field.
    • [FIXED] Removed unnecessary request when retrieving a Result collection that is less than the page_size value.
    Source code(tar.gz)
    Source code(zip)
  • 2.9.0(Jun 13, 2018)

    • [NEW] Added functionality to test if a key is in a database as in key in db, overriding dict __contains__ and checking in the remote database.
    • [NEW] Moved create_query_index and other query related methods to CouchDatabase as the _index/_find API is available in CouchDB 2.x.
    • [NEW] Support IAM authentication in replication documents.
    • [FIXED] Case where Document context manager would throw instead of creating a new document if no _id was provided.
    • [IMPROVED] Added support for IAM API key in cloudant_bluemix method.
    • [IMPROVED] Shortened length of client URLs by removing username and password.
    • [IMPROVED] Verified library operation on Python 3.6.3.
    Source code(tar.gz)
    Source code(zip)
  • 2.8.1(Feb 16, 2018)

  • 2.8.0(Feb 15, 2018)

    • [NEW] Added support for /_search_disk_size endpoint which retrieves disk size information for a specific search index.
    • [FIXED] Updated default IBM Cloud Identity and Access Management token URL.
    • [REMOVED] Removed broken source and target parameters that constantly threw AttributeError when creating a replication document.
    Source code(tar.gz)
    Source code(zip)
  • 2.7.0(Oct 31, 2017)

    • [NEW] Added API for upcoming Bluemix Identity and Access Management support for Cloudant on Bluemix. Note: IAM API key support is not yet enabled in the service.
    • [NEW] Added HTTP basic authentication support.
    • [NEW] Added Result.all() convenience method.
    • [NEW] Allow service_name to be specified when instantiating from a Bluemix VCAP_SERVICES environment variable.
    • [IMPROVED] Updated posixpath.join references to use '/'.join when concatenating URL parts.
    • [IMPROVED] Updated documentation by replacing deprecated Cloudant links with the latest Bluemix links.
    Source code(tar.gz)
    Source code(zip)
  • 2.6.0(Aug 10, 2017)

    • [NEW] Added Cloudant.bluemix() class method to the Cloudant client allowing service credentials to be passed using the CloudFoundry VCAP_SERVICES environment variable.
    • [FIXED] Fixed client construction in cloudant_bluemix context manager.
    • [FIXED] Fixed validation for feed options to accept zero as a valid value.
    Source code(tar.gz)
    Source code(zip)
  • 2.5.0(Jul 6, 2017)

    • [FIXED] Fixed crash caused by non-UTF8 chars in design documents.
    • [FIXED] Fixed TypeError when setting revision limits on Python>=3.6.
    • [FIXED] Fixed the exists() double check on client.py and database.py.
    • [FIXED] Fixed Cloudant exception code 409 with 412 when creating a database that already exists.
    • [FIXED] Catch error if throw_on_exists flag is False for creating a document.
    • [FIXED] Fixed /_all_docs call where keys is an empty list.
    • [FIXED] Issue where docs with IDs that sorted lower than 0 were not returned when iterating through _all_docs.
    Source code(tar.gz)
    Source code(zip)
  • 2.4.0(Feb 14, 2017)

    • [NEW] Added timeout option to the client constructor for setting a timeout on a HTTP connection or a response.
    • [NEW] Added cloudant_bluemix method to the Cloudant client allowing service credentials to be passed using the CloudFoundry VCAP_SERVICES environment variable.
    • [IMPROVED] Updated non-response related errors with additional status code and improved error message for easier debugging. All non-response error are handled using either CloudantException or CloudantArgumentError.
    • [FIXED] Support long type argument when executing in Python 2.
    Source code(tar.gz)
    Source code(zip)
  • 2.3.1(Nov 30, 2016)

    • [FIXED] Resolved issue where generated UUIDs for replication documents would not be converted to strings.
    • [FIXED] Resolved issue where CouchDatabase.infinite_changes() method can cause a stack overflow.
    Source code(tar.gz)
    Source code(zip)
Owner
Cloudant
Cloudant
Python interface to Oracle Database conforming to the Python DB API 2.0 specification.

cx_Oracle version 8.2 (Development) cx_Oracle is a Python extension module that enables access to Oracle Database. It conforms to the Python database

Oracle 841 Dec 21, 2022
AWS SDK for Python

Boto3 - The AWS SDK for Python Boto3 is the Amazon Web Services (AWS) Software Development Kit (SDK) for Python, which allows Python developers to wri

the boto project 7.8k Jan 04, 2023
A fast unobtrusive MongoDB ODM for Python.

MongoFrames MongoFrames is a fast unobtrusive MongoDB ODM for Python designed to fit into a workflow not dictate one. Documentation is available at Mo

getme 45 Jun 01, 2022
aiosql - Simple SQL in Python

aiosql - Simple SQL in Python SQL is code. Write it, version control it, comment it, and run it using files. Writing your SQL code in Python programs

Will Vaughn 1.1k Jan 08, 2023
Confluent's Kafka Python Client

Confluent's Python Client for Apache KafkaTM confluent-kafka-python provides a high-level Producer, Consumer and AdminClient compatible with all Apach

Confluent Inc. 3.1k Jan 05, 2023
SQL for Humans™

Records: SQL for Humans™ Records is a very simple, but powerful, library for making raw SQL queries to most relational databases. Just write SQL. No b

Kenneth Reitz 6.9k Jan 07, 2023
dask-sql is a distributed SQL query engine in python using Dask

dask-sql is a distributed SQL query engine in Python. It allows you to query and transform your data using a mixture of common SQL operations and Python code and also scale up the calculation easily

Nils Braun 271 Dec 30, 2022
A tutorial designed to introduce you to SQlite 3 database using python

SQLite3-python-tutorial A tutorial designed to introduce you to SQlite 3 database using python What is SQLite? SQLite is an in-process library that im

0 Dec 28, 2021
An asyncio compatible Redis driver, written purely in Python. This is really just a pet-project for me.

asyncredis An asyncio compatible Redis driver. Just a pet-project. Information asyncredis is, like I've said above, just a pet-project for me. I reall

Vish M 1 Dec 25, 2021
Script em python para carregar os arquivos de cnpj dos dados públicos da Receita Federal em MYSQL.

cnpj-mysql Script em python para carregar os arquivos de cnpj dos dados públicos da Receita Federal em MYSQL. Dados públicos de cnpj no site da Receit

17 Dec 25, 2022
TileDB-Py is a Python interface to the TileDB Storage Engine.

TileDB-Py TileDB-Py is a Python interface to the TileDB Storage Engine. Quick Links Installation Build Instructions TileDB Documentation Python API re

TileDB, Inc. 149 Nov 28, 2022
Async ORM based on PyPika

PyPika-ORM - ORM for PyPika SQL Query Builder The package gives you ORM for PyPika with asycio support for a range of databases (SQLite, PostgreSQL, M

Kirill Klenov 7 Jun 04, 2022
Redis Python Client

redis-py The Python interface to the Redis key-value store. Python 2 Compatibility Note redis-py 3.5.x will be the last version of redis-py that suppo

Andy McCurdy 11k Dec 29, 2022
High level Python client for Elasticsearch

Elasticsearch DSL Elasticsearch DSL is a high-level library whose aim is to help with writing and running queries against Elasticsearch. It is built o

elastic 3.6k Jan 03, 2023
A wrapper around asyncpg for use with sqlalchemy

asyncpgsa A python library wrapper around asyncpg for use with sqlalchemy Backwards incompatibility notice Since this library is still in pre 1.0 worl

Canopy 404 Dec 03, 2022
Application which allows you to make PostgreSQL databases with Python

Automate PostgreSQL Databases with Python Application which allows you to make PostgreSQL databases with Python I used the psycopg2 library which is u

Marc-Alistair Coffi 0 Dec 31, 2021
Creating a python package to convert /transfer excelsheet data to a mysql Database Table

Creating a python package to convert /transfer excelsheet data to a mysql Database Table

Odiwuor Lameck 1 Jan 07, 2022
Simplest SQL mapper in Python, probably

SQL MAPPER Basically what it does is: it executes some SQL thru a database connector you fed it, maps it to some model and gives to u. Also it can cre

2 Nov 07, 2022
SQL queries to collections

SQC SQL Queries to Collections Examples from sqc import sqc data = [ {"a": 1, "b": 1}, {"a": 2, "b": 1}, {"a": 3, "b": 2}, ] Simple filte

Alexander Volkovsky 0 Jul 06, 2022
asyncio (PEP 3156) Redis support

aioredis asyncio (PEP 3156) Redis client library. Features hiredis parser Yes Pure-python parser Yes Low-level & High-level APIs Yes Connections Pool

aio-libs 2.2k Jan 04, 2023