API Reference

Connection

Module with extensions of asyncpg Connection class.

class asyncpgx.connection.ConnectionX(protocol, transport, loop, addr, config: ConnectionConfiguration, params: ConnectionParameters)[source]

Extended version of asyncpg Connection class.

Provides various extension methods, but doesn’t touches the original ones

named_cursor(query: str, args: Dict, prefetch: Optional[int] = None, timeout: Optional[float] = None) CursorFactory[source]

Extended version of cursor with support of the named parameters.

Parameters
  • query – SQL query to execute (could include named parameters).

  • args – Dict with the parameters values.

  • prefetch – The number of rows the cursor iterator will prefetch (defaults to 50.)

  • timeout – Optional timeout value in seconds.

async named_execute(query: str, args: Dict, timeout: Optional[float] = None) str[source]

Extended versions of execute with support of the named parameters.

Parameters
  • query – SQL query to execute (could include named parameters).

  • args – Dict with the parameters values.

  • timeout – Optional timeout value in seconds.

async named_executemany(query: str, args: List, *, timeout: Optional[float] = None) None[source]

Extended versions of executemany with support of the named parameters.

Parameters
  • query – SQL query to execute (could include named parameters).

  • args – List of dicts with the parameters values.

  • timeout – Optional timeout value in seconds.

async named_fetch(query: str, args: Dict, timeout: Optional[float] = None) List[Record][source]

Extended versions of fetch with support of the named parameters.

Parameters
  • query – SQL query to execute (could include named parameters).

  • args – Dict with the parameters values.

  • timeout – Optional timeout value in seconds.

async named_fetchrow(query: str, args: Dict, timeout: Optional[float] = None) Optional[Record][source]

Extended versions of fetchrow with support of the named parameters.

Parameters
  • query – SQL query to execute (could include named parameters).

  • args – Dict with the parameters values.

  • timeout – Optional timeout value in seconds.

async named_fetchval(query: str, args: Dict, column: int = 0, timeout: Optional[float] = None) Optional[Any][source]

Extended versions of fetchval with support of the named parameters.

Parameters
  • query – SQL query to execute (could include named parameters).

  • args – Dict with the parameters values.

  • column – Numeric index within the record of the value to return.

  • timeout – Optional timeout value in seconds.

async named_prepare(query: str, *, timeout: Optional[float] = None) PreparedStatementX[source]

Extended version of prepare with support of the named parameters.

Parameters
  • query – SQL query to execute (could include named parameters).

  • timeout – Optional timeout value in seconds.

Prepared Statements

Module with extensions of asyncpg PreparedStatement class.

class asyncpgx.prepared_statement.PreparedStatementX(connection: Connection, query: str, state: Any, original_query: str, params_order_list: List)[source]

Extended version of asyncpg PreparedStatement class.

Provides various extension methods, but doesn’t touches the original ones

named_cursor(args: Dict, prefetch: Optional[int] = None, timeout: Optional[float] = None) CursorFactory[source]

Extended version of cursor with support of the named parameters.

Parameters
  • args – Dict with the parameters values.

  • prefetch – The number of rows the cursor iterator will prefetch (defaults to 50.)

  • timeout – Optional timeout value in seconds.

async named_fetch(args: Dict, timeout: Optional[float] = None) List[Record][source]

Extended version of fetch with support of the named parameters.

Parameters
  • args – Dict with the parameters values.

  • timeout – Optional timeout value in seconds.

async named_fetchrow(args: Dict, timeout: Optional[float] = None) Record[source]

Extended version of fetchrow with support of the named parameters.

Parameters
  • args – Dict with the parameters values.

  • timeout – Optional timeout value in seconds.

async named_fetchval(args: Dict, column: int = 0, timeout: Optional[float] = None) Any[source]

Extended version of fetchval with support of the named parameters.

Parameters
  • args – Dict with the parameters values.

  • column – Numeric index within the record of the value to return.

  • timeout – Optional timeout value in seconds.

Exceptions

Library exceptions.

exception asyncpgx.exceptions.MissingRequiredArgumentError[source]

There is a missing argument in query.

exception asyncpgx.exceptions.UnusedArgumentsError[source]

There are unused arguments in query.