8000 Update API docs (#573) · ammogcoder/PyMySQL@73c22c7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 73c22c7

Browse files
spenceforcemethane
authored andcommitted
Update API docs (PyMySQL#573)
1 parent c364263 commit 73c22c7

File tree

6 files changed

+78
-60
lines changed

6 files changed

+78
-60
lines changed

docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# If extensions (or modules to document with autodoc) are in another directory,
1919
# add these directories to sys.path here. If the directory is relative to the
2020
# documentation root, use os.path.abspath to make it absolute, like shown here.
21-
#sys.path.insert(0, os.path.abspath('.'))
21+
sys.path.insert(0, os.path.abspath('../../'))
2222

2323
# -- General configuration ------------------------------------------------
2424

docs/source/modules/connections.rst

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
:mod:`pymysql.connections`
2-
==========================
1+
Connection Object
2+
=================
33

4-
.. automodule:: pymysql.connections
4+
.. module:: pymysql.connections
55

66
.. autoclass:: Connection
7+
:members:
8+
:exclude-members: DataError, DatabaseError, Error, InterfaceError,
9+
IntegrityError, InternalError, NotSupportedError,
10+
OperationalError, ProgrammingError, Warning,
11+
escape, literal, write_packet

docs/source/modules/cursors.rst

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
:mod:`pymysql.cursors`
2-
======================
1+
Cursor Objects
2+
==============
33

4-
.. automodule:: pymysql.cursors
4+
.. module:: pymysql.cursors
55

66
.. autoclass:: Cursor
7+
:members:
8+
:exclude-members: DataError, DatabaseError, Error, InterfaceError,
9+
IntegrityError, InternalError, NotSupportedError,
10+
OperationalError, ProgrammingError, Warning
11+
712
.. autoclass:: SSCursor
13+
:members:
14+
15+
.. autoclass:: DictCursor
16+
:members:
17+
18+
.. autoclass:: SSDictCursor
19+
:members:

docs/source/modules/index.rst

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ API Reference
44
If you are looking for information on a specific function, class or
55
method, this part of the documentation is for you.
66

7+
For more information, please read the `Python Database API specification
8+
<https://www.python.org/dev/peps/pep-0249>`_.
9+
710
.. toctree::
811
:maxdepth: 2
912

pymysql/connections.py

+48-49
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,54 @@ class Connection(object):
520520
521521
The proper way to get an instance of this class is to call
522522
connect().
523+
524+
Establish a connection to the MySQL database. Accepts several
525+
arguments:
526+
527+
:param host: Host where the database server is located
528+
:param user: Username to log in as
529+
:param password: Password to use.
530+
:param database: Database to use, None to not use a particular one.
531+
:param port: MySQL port to use, default is usually OK. (default: 3306)
532+
:param bind_address: When the client has multiple network interfaces, specify
533+
the interface from which to connect to the host. Argument can be
534+
a hostname or an IP address.
535+
:param unix_socket: Optionally, you can use a unix socket rather than TCP/IP.
536+
:param charset: Charset you want to use.
537+
:param sql_mode: Default SQL_MODE to use.
538+
:param read_default_file:
539+
Specifies my.cnf file to read these parameters from under the [client] section.
540+
:param conv:
541+
Conversion dictionary to use instead of the default one.
542+
This is used to provide custom marshalling and unmarshaling of types.
543+
See converters.
544+
:param use_unicode:
545+
Whether or not to default to unicode strings.
546+
This option defaults to true for Py3k.
547+
:param client_flag: Custom flags to send to MySQL. Find potential values in constants.CLIENT.
548+
:param cursorclass: Custom cursor class to use.
549+
:param init_command: Initial SQL statement to run when connection is established.
550+
:param connect_timeout: Timeout before throwing an exception when connecting.
551+
(default: 10, min: 1, max: 31536000)
552+
:param ssl:
553+
A dict of arguments similar to mysql_ssl_set()'s parameters.
554+
For now the capath and cipher arguments are not supported.
555+
:param read_default_group: Group to read from in the configuration file.
556+
:param compress: Not supported
557+
:param named_pipe: Not supported
558+
:param autocommit: Autocommit mode. None means use server default. (default: False)
559+
:param local_infile: Boolean to enable the use of LOAD DATA LOCAL command. (default: False)
560+
:param max_allowed_packet: Max size of packet sent to server in bytes. (default: 16MB)
561+
Only used to limit size of "LOAD LOCAL INFILE" data packet smaller than default (16KB).
562+
:param defer_connect: Don't explicitly connect on contruction - wait for connect call.
563+
(default: False)
564+
:param auth_plugin_map: A dict of plugin names to a class that processes that plugin.
565+
The class will take the Connection object as the argument to the constructor.
566+
The class needs an authenticate method taking an authentication packet as
567+
an argument. For the dialog plugin, a prompt(echo, prompt) method can be used
568+
(if no authenticate method) for returning a string from the user. (experimental)
569+
:param db: Alias for database. (for compatibility to MySQLdb)
570+
:param passwd: Alias for password. (for compatibility to MySQLdb)
523571
"""
524572

525573
_sock = None
@@ -537,55 +585,6 @@ def __init__(self, host=None, user=None, password="",
537585
max_allowed_packet=16*1024*1024, defer_connect=False,
538586
auth_plugin_map={}, read_timeout=None, write_timeout=None,
539587
bind_address=None):
540-
"""
541-
Establish a connection to the MySQL database. Accepts several
542-
arguments:
543-
544-
host: Host where the database server is located
545-
user: Username to log in as
546-
password: Password to use.
547-
database: Database to use, None to not use a particular one.
548-
port: MySQL port to use, default is usually OK. (default: 3306)
549-
bind_address: When the client has multiple network interfaces, specify
550-
the interface from which to connect to the host. Argument can be
551-
a hostname or an IP address.
552-
unix_socket: Optionally, you can use a unix socket rather than TCP/IP.
553-
charset: Charset you want to use.
554-
sql_mode: Default SQL_MODE to use.
555-
read_default_file:
556-
Specifies my.cnf file to read these parameters from under the [client] section.
557-
conv:
558-
Conversion dictionary to use instead of the default one.
559-
This is used to provide custom marshalling and unmarshaling of types.
560-
See converters.
561-
use_unicode:
562-
Whether or not to default to unicode strings.
563-
This option defaults to true for Py3k.
564-
client_flag: Custom flags to send to MySQL. Find potential values in constants.CLIENT.
565-
cursorclass: Custom cursor class to use.
566-
init_command: Initial SQL statement to run when connection is established.
567-
connect_timeout: Timeout before throwing an exception when connecting.
568-
(default: 10, min: 1, max: 31536000)
569-
ssl:
570-
A dict of arguments similar to mysql_ssl_set()'s parameters.
571-
For now the capath and cipher arguments are not supported.
572-
read_default_group: Group to read from in the configuration file.
573-
compress; Not supported
574-
named_pipe: Not supported
575-
autocommit: Autocommit mode. None means use server default. (default: False)
576-
local_infile: Boolean to enable the use of LOAD DATA LOCAL command. (default: False)
577-
max_allowed_packet: Max size of packet sent to server in bytes. (default: 16MB)
578-
Only used to limit size of "LOAD LOCAL INFILE" data packet smaller than default (16KB).
579-
defer_connect: Don't explicitly connect on contruction - wait for connect call.
580-
(default: False)
581-
auth_plugin_map: A dict of plugin names to a class that processes that plugin.
582-
The class will take the Connection object as the argument to the constructor.
583-
The class needs an authenticate method taking an authentication packet as
584-
an argument. For the dialog plugin, a prompt(echo, prompt) method can be used
585-
(if no authenticate method) for returning a string from the user. (experimental)
586-
db: Alias for database. (for compatibility to MySQLdb)
587-
passwd: Alias for password. (for compatibility to MySQLdb)
588-
"""
589588
if no_delay is not None:
590589
warnings.warn("no_delay option is deprecated", DeprecationWarning)
591590

pymysql/cursors.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
class Cursor(object):
2222
"""
2323
This is the object you use to interact with the database.
24+
25+
Do not create an instance of a Cursor yourself. Call
26+
connections.Connection.cursor().
2427
"""
2528

2629
#: Max statement size which :meth:`executemany` generates.
@@ -32,10 +35,6 @@ class Cursor(object):
3235
_defer_warnings = False
3336

3437
def __init__(self, connection):
35-
"""
36-
Do not create an instance of a Cursor yourself. Call
37-
connections.Connection.cursor().
38-
"""
3938
self.connection = connection
4039
self.description = None
4140
self.rownumber = 0

0 commit comments

Comments
 (0)
0