SAP-archive/PyHDB

Add docstrings

cdeil opened this issue · 2 comments

cdeil commented

I'm a first-time user of pyhdb, trying to establish a connection, but having issues (see #114 (comment)).

It would be great if you could add a docstring to pyhdb.connect and possibly in other places that documents the available options.

Currently it looks like this:

$ ipython

In [1]: import pyhdb                                                                                                                 

In [2]: pyhdb.connect?                                                                                                               
Signature: pyhdb.connect(*args, **kwargs)
Docstring: <no docstring>
File:      ~/software/anaconda3/envs/hackdays/lib/python3.7/site-packages/pyhdb/__init__.py
Type:      function

Good catch! Note that pyhdb.connect is a thin wrapper around pyhdb.Connection. I see this

>>> import pyhdb
>>> help(pyhdb.Connection)
Help on class Connection in module pyhdb.connection:

class Connection(builtins.object)
 |  Connection(host, port, user, password, autocommit=False, timeout=None)
 |
 |  Database connection class
 |
 |  Methods defined here:
 |
 |  __init__(self, host, port, user, password, autocommit=False, timeout=None)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  close(self)
 |
 |  commit(self)
 |
 |  connect(self)
 |
 |  cursor(self)
 |      Return a new Cursor Object using the connection.
 |
 |  get_next_packet_count(self)
 |
 |  getautocommit(self)
 |      # Methods for compatibility with hdbclient
...
>>> help(pyhdb.connect)
Help on function connect in module pyhdb:

connect(host, port, user, password, autocommit=False)

Here is where the docstring should be defined: https://github.com/SAP/PyHDB/blob/826539d06b8bcef74fe755e7489b8a8255628f12/pyhdb/__init__.py#L28

Closing due to the sunset of the project. Please check active maintained alternative: https://pypi.org/project/hdbcli/