DB API Connection Class¶
- class attachdb.Connection(host, port=3306, user='', password='', database='', autocommit=False)¶
Parameters: - host (str) – The hostname to the server or path to Unix Domain Socket
- port (int) – The port number for the server or 0 for Unix Domain Socket
- user (str) – The username for the server
- password (str) – The password for the server
- database (str) – The default database for the connection
- autocommit (bool) – Enable/disable autocommit (None for server default)
- autocommit(setting)¶
Enables/disables autocommit for the connection
Parameters: setting (bool) – True to enable, False to disable
- commit()¶
Commit a transaction
- rollback()¶
Roll back a transaction
- close()¶
Close the connection
- cursor()¶
Create a new cursor for the connection to execute queries
Returns: The new cursor Return type: Cursor