All public methods included in the module. See the Examples pages for some usage examples.
The Client class is a wrapper for Pool, BatchQuery and QueryChain. It also provides the execute and callproc functions.
Parameters: | settings – A dictionary that is passed to the Pool object. |
---|
Run a batch of queries all at once.
Note: Every query needs a free connection. So if three queries are are executed, three free connections are used.
A dictionary with queries looks like this:
{
'query1': ['SELECT 42, 12, %s, %s;', (23, 56)],
'query2': 'SELECT 1, 2, 3, 4, 5;',
'query3': 'SELECT 465767, 4567, 3454;'
}
A query with paramaters is contained in a list: ['some sql here %s, %s', ('and some', 'paramaters here')]. A query without paramaters doesn’t need to be in a list.
Parameters: |
|
---|---|
Returns: | A dictionary with the same keys as the given queries with the resulting cursors as values. |
Call a stored database procedure with the given name.
The sequence of parameters must contain one entry for each argument that the procedure expects. The result of the call is returned as modified copy of the input sequence. Input parameters are left untouched, output and input/output parameters replaced with possibly new values.
The procedure may also provide a result set as output. This must then be made available through the standard fetch*() methods.
Parameters: |
|
---|
Run a chain of queries in the given order.
A list/tuple with queries looks like this:
(
['SELECT 42, 12, %s, 11;', (23,)],
'SELECT 1, 2, 3, 4, 5;'
)
A query with paramaters is contained in a list: ['some sql here %s, %s', ('and some', 'paramaters here')]. A query without paramaters doesn’t need to be in a list.
Parameters: |
|
---|---|
Returns: | A list with the resulting cursors. |
Close all connections in the connection pool.
Prepare and execute a database operation (query or command).
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. Variables are specified either with positional (%s) or named (%(name)s) placeholders. See Passing parameters to SQL queries [1] in the Psycopg2 documentation.
Parameters: |
|
---|
The AdispClient class is a wrapper for Pool and uses adisp to let the developer use the execute, callproc, chain and batch functions in a blocking style. The chain and batch functions are slightly different than the two in Client.
Parameters: | settings – A dictionary that is passed to the Pool object. |
---|
Run a batch of queries all at once.
Note: Every query needs a free connection. So if three queries are are executed, three free connections are used.
A dictionary with queries looks like this:
{
'query1': ['SELECT 42, 12, %s, %s;', (23, 56)],
'query2': 'SELECT 1, 2, 3, 4, 5;',
'query3': 'SELECT 465767, 4567, 3454;'
}
A query with paramaters is contained in a list: ['some sql here %s, %s', ('and some', 'paramaters here')]. A query without paramaters doesn’t need to be in a list.
Parameters: |
|
---|---|
Returns: | A dictionary with the same keys as the given queries with the resulting cursors as values. |
Call a stored database procedure with the given name.
The sequence of parameters must contain one entry for each argument that the procedure expects. The result of the call is returned as modified copy of the input sequence. Input parameters are left untouched, output and input/output parameters replaced with possibly new values.
The procedure may also provide a result set as output. This must then be made available through the standard fetch*() methods.
Parameters: |
|
---|
Run a chain of queries in the given order.
A list/tuple with queries looks like this:
(
['SELECT 42, 12, %s, 11;', (23,)],
'SELECT 1, 2, 3, 4, 5;'
)
A query with paramaters is contained in a list: ['some sql here %s, %s', ('and some', 'paramaters here')]. A query without paramaters doesn’t need to be in a list.
Parameters: |
|
---|---|
Returns: | A list with the resulting cursors. |
Close all connections in the connection pool.
Prepare and execute a database operation (query or command).
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. Variables are specified either with positional (%s) or named (%(name)s) placeholders. See Passing parameters to SQL queries [1] in the Psycopg2 documentation.
Parameters: |
|
---|
A connection pool that manages PostgreSQL connections and cursors.
Parameters: |
|
---|
Close all open connections in the pool.
Create a new cursor.
If there’s no connection available, a new connection will be created and new_cursor will be called again after the connection has been made.
Parameters: |
|
---|
Run a chain of queries in the given order.
A list/tuple with queries looks like this:
(
['SELECT 42, 12, %s, 11;', (23,)],
'SELECT 1, 2, 3, 4, 5;'
)
A query with paramaters is contained in a list: ['some sql here %s, %s', ('and some', 'paramaters here')]. A query without paramaters doesn’t need to be in a list.
Parameters: |
|
---|---|
Returns: | A list with the resulting cursors is passed on to the callback. |
Run a batch of queries all at once.
Note: Every query needs a free connection. So if three queries are are executed, three free connections are used.
A dictionary with queries looks like this:
{
'query1': ['SELECT 42, 12, %s, %s;', (23, 56)],
'query2': 'SELECT 1, 2, 3, 4, 5;',
'query3': 'SELECT 465767, 4567, 3454;'
}
A query with paramaters is contained in a list: ['some sql here %s, %s', ('and some', 'paramaters here')]. A query without paramaters doesn’t need to be in a list.
Parameters: |
|
---|---|
Returns: | A dictionary with the same keys as the given queries with the resulting cursors as values is passed on to the callback. |