@@ -520,6 +520,54 @@ class Connection(object):
520
520
521
521
The proper way to get an instance of this class is to call
522
522
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)
523
571
"""
524
572
525
573
_sock = None
@@ -537,55 +585,6 @@ def __init__(self, host=None, user=None, password="",
537
585
max_allowed_packet = 16 * 1024 * 1024 , defer_connect = False ,
538
586
auth_plugin_map = {}, read_timeout = None , write_timeout = None ,
539
587
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
- """
589
588
if no_delay is not None :
590
589
warnings .warn ("no_delay option is deprecated" , DeprecationWarning )
591
590
0 commit comments