|
1 | 1 | """ |
2 | | -This module contains the Connection class that manages the connection to the database, |
3 | | - and the `conn` function that provides access to a persistent connection in datajoint. |
| 2 | +This module contains the Connection class that manages the connection to the database, and |
| 3 | +the ``conn`` function that provides access to a persistent connection in datajoint. |
4 | 4 | """ |
5 | 5 | import warnings |
6 | 6 | from contextlib import contextmanager |
@@ -52,6 +52,7 @@ def connect_host_hook(connection_obj): |
52 | 52 | def translate_query_error(client_error, query): |
53 | 53 | """ |
54 | 54 | Take client error and original query and return the corresponding DataJoint exception. |
| 55 | +
|
55 | 56 | :param client_error: the exception raised by the client interface |
56 | 57 | :param query: sql query with placeholders |
57 | 58 | :return: an instance of the corresponding subclass of datajoint.errors.DataJointError |
@@ -108,11 +109,9 @@ def conn( |
108 | 109 | :param password: mysql password |
109 | 110 | :param init_fun: initialization function |
110 | 111 | :param reset: whether the connection should be reset or not |
111 | | - :param use_tls: TLS encryption option. Valid options are: True (required), |
112 | | - False (required no TLS), None (TLS prefered, default), |
113 | | - dict (Manually specify values per |
114 | | - https://dev.mysql.com/doc/refman/5.7/en/connection-options.html |
115 | | - #encrypted-connection-options). |
| 112 | + :param use_tls: TLS encryption option. Valid options are: True (required), False |
| 113 | + (required no TLS), None (TLS prefered, default), dict (Manually specify values per |
| 114 | + https://dev.mysql.com/doc/refman/5.7/en/connection-options.html#encrypted-connection-options). |
116 | 115 | """ |
117 | 116 | if not hasattr(conn, "connection") or reset: |
118 | 117 | host = host if host is not None else config["database.host"] |
@@ -247,6 +246,7 @@ def set_query_cache(self, query_cache=None): |
247 | 246 | 1. Only SELECT queries are allowed. |
248 | 247 | 2. The results of queries are cached under the path indicated by dj.config['query_cache'] |
249 | 248 | 3. query_cache is a string that differentiates different cache states. |
| 249 | +
|
250 | 250 | :param query_cache: a string to initialize the hash for query results |
251 | 251 | """ |
252 | 252 | self._query_cache = query_cache |
@@ -298,6 +298,7 @@ def query( |
298 | 298 | ): |
299 | 299 | """ |
300 | 300 | Execute the specified query and return the tuple generator (cursor). |
| 301 | +
|
301 | 302 | :param query: SQL query |
302 | 303 | :param args: additional arguments for the client.cursor |
303 | 304 | :param as_dict: If as_dict is set to True, the returned cursor objects returns |
|
0 commit comments