pyAttachSQL Module Basics¶
Exceptions¶
- exception attachsql.ClientError¶
An exception on the client side
- exception attachsql.ServerError¶
As exception on the server side
Constants¶
Return Constants¶
- attachsql.RETURN_NONE¶
No return status
- attachsql.RETURN_NOT_CONNECTED¶
The client is not yet connected to the server
- attachsql.RETURN_PROCESSING¶
Data processing / transfer is in-progress
- attachsql.RETURN_ROW_DATA¶
A row is in the buffer ready for processing
- attachsql.RETURN_ERROR¶
An error occurred on the connection
- attachsql.RETURN_EOF¶
A query EOF, typically all rows have been returned
Escape Constants¶
- attachsql.ESCAPE_TYPE_NONE¶
Nothing to escape
- attachsql.ESCAPE_TYPE_CHAR¶
Escape string data adding quote marks around the string
- attachsql.ESCAPE_TYPE_CHAR_LIKE¶
Escape string data without quote marks around the string (for use in LIKE syntax)
- attachsql.ESCAPE_TYPE_INT¶
Insert integer data into the query
- attachsql.ESCAPE_TYPE_BIGINT¶
Insert 64bit integer data into the query
- attachsql.ESCAPE_TYPE_FLOAT¶
Insert float data into the query
- attachsql.ESCAPE_TYPE_DOUBLE¶
Insert double data into the query
Option Constants¶
- attachsql.OPTION_COMPRESS¶
Protocol compression option
- attachsql.OPTION_FOUND_ROWS¶
Found rows counter for results
- attachsql.OPTION_IGNORE_SIGPIPE¶
Ignore sigpipe (not used, sigpipe is ignored anyway)
- attachsql.OPTION_INTERACTIVE¶
Client is interactive
- attachsql.OPTION_LOCAL_FILES¶
Enable LOAD LOCAL INFILE
- attachsql.OPTION_MULTI_STATEMENTS¶
Enable multi-statement queries
- attachsql.OPTION_NO_SCHEMA¶
Disable the schema_name.table_name.column_name syntax (for ODBC)
- attachsql.OPTION_SSL_NO_VERIFY¶
Currently unused
- attachsql.OPTION_SEMI_BLOCKING¶
Enable semi-blocking mode
Column Type Constants¶
- attachsql.COLUMN_TYPE_DECIMAL¶
- attachsql.COLUMN_TYPE_TINY¶
- attachsql.COLUMN_TYPE_SHORT¶
- attachsql.COLUMN_TYPE_LONG¶
- attachsql.COLUMN_TYPE_FLOAT¶
- attachsql.COLUMN_TYPE_DOUBLE¶
- attachsql.COLUMN_TYPE_NULL¶
- attachsql.COLUMN_TYPE_TIMESTAMP¶
- attachsql.COLUMN_TYPE_LONGLONG¶
- attachsql.COLUMN_TYPE_INT24¶
- attachsql.COLUMN_TYPE_DATE¶
- attachsql.COLUMN_TYPE_TIME¶
- attachsql.COLUMN_TYPE_DATETIME¶
- attachsql.COLUMN_TYPE_YEAR¶
- attachsql.COLUMN_TYPE_VARCHAR¶
- attachsql.COLUMN_TYPE_BIT¶
- attachsql.COLUMN_TYPE_NEWDECIMAL¶
- attachsql.COLUMN_TYPE_ENUM¶
- attachsql.COLUMN_TYPE_SET¶
- attachsql.COLUMN_TYPE_TINY_BLOB¶
- attachsql.COLUMN_TYPE_MEDIUM_BLOB¶
- attachsql.COLUMN_TYPE_LONG_BLOB¶
- attachsql.COLUMN_TYPE_BLOB¶
- attachsql.COLUMN_TYPE_VARSTRING¶
- attachsql.COLUMN_TYPE_STRING¶
- attachsql.COLUMN_TYPE_GEOMETRY¶
Callback Event Constants¶
- attachsql.EVENT_CONNECTED¶
- attachsql.EVENT_ERROR¶
- attachsql.EVENT_EOF¶
- attachsql.EVENT_ROW_READY¶
Functions¶
- attachsql.connect(hostname, user, password, database, port)¶
Parameters: - hostname (str) – The hostname to the server
- user (str) – The user name to connect with
- password (str) – The password to connect with
- database (str) – The default database for the connection
- port (int) – The port to connect on or 0 for a Unix Domain Socket connection
Returns: An instance of the connection
- attachsql.get_library_version()¶
Gets the version of libAttachSQL used for pyAttachSQL
Returns: A string representation of the version number Return type: str
Callback Function Prototypes¶
- my_callback(events, con, query, unused):
A user defined callback used for group
Parameters: - events (int) – The event which triggered the callback from Callback Event Constants
- con (object) – The connection object which triggered the callback
- query (object) – The query object which triggered the callback
- context (object) – The user supplied context