Group Class

class attachsql.group(callback_function, callback_context)

Creates a group of connections to execute statements in the same event loop. In this mode events trigger callbacks instead of the normal polling so a callback function is required.

Parameters:
  • callback_function (object) – The function name to use for the callback
  • callback_context (object) – An object of arbitrary data to send to the callback function
create_connection(hostname, user, password, database, port)

Creates a new connection in the connection group and returns the connection object. The connection itself is not made at this time.

Parameters:
  • hostname (str) – The hostname to the server
  • user (str) – The user name to connect with
  • password (str) – The password to connect with
  • port (int) – The port to connect on or 0 for a Unix Domain Socket connection
Returns:

A connection class which is attached to this group

Return type:

connection

run()

Runs a single iteration of the event loop. If an event is triggered the py:function:my_callback will be fired before this returns.

Returns:None