This constructor accepts all those keyword args the MySQL module's
connect function knows about. They're passed on 'as is'.
The only exception is 'encoding' which lets you determine which
encoding orm uses to send data to the backend. It defaults to utf-8. The
set_character_set() function is used on the database connection to set
this. Encodings must be referred to by their MySQL name.
From the MySQL-Python documentation:
Create a connection to the database. It is strongly recommended that
you only use keyword parameters. 'NULL pointer' indicates that NULL will
be passed to mysql_real_connect(); the value in parenthesis indicates how
MySQL interprets the NULL. Consult the MySQL C API documentation for more
information.
-
host -- string, host to connect to or NULL pointer (localhost)
-
user -- string, user to connect as or NULL pointer (your
username)
-
passwd -- string, password to use or NULL pointer (no
password)
-
db -- string, database to use or NULL (no DB selected)
-
port -- integer, TCP/IP port to connect to or default MySQL
port
-
unix_socket -- string, location of unix_socket to use or use
TCP
-
client_flags -- integer, flags to use or 0 (see MySQL docs)
-
conv -- conversion dictionary, see MySQLdb.converters
-
connect_time -- number of seconds to wait before the connection
attempt fails.
-
compress -- if set, compression is enabled
-
init_command -- command which is run once the connection is
created
-
read_default_file -- see the MySQL documentation for
mysql_options()
-
read_default_group -- see the MySQL documentation for
mysql_options()
-
cursorclass -- class object, used to create cursors or
cursors.Cursor.
This parameter MUST be specified as a keyword parameter.
-
- Overrides:
datasource.datasource_base.__init__
|