MCPcopy Index your code
hub / github.com/MagicStack/asyncpg / fetchval

Method fetchval

asyncpg/prepared_stmt.py:181–197  ·  view source on GitHub ↗

Execute the statement and return a value in the first row. :param args: Query arguments. :param int column: Numeric index within the record of the value to return (defaults to 0). :param float timeout: Optional timeout value in seconds.

(self, *args, column=0, timeout=None)

Source from the content-addressed store, hash-verified

179
180 @connresource.guarded
181 async def fetchval(self, *args, column=0, timeout=None):
182 """Execute the statement and return a value in the first row.
183
184 :param args: Query arguments.
185 :param int column: Numeric index within the record of the value to
186 return (defaults to 0).
187 :param float timeout: Optional timeout value in seconds.
188 If not specified, defaults to the value of
189 ``command_timeout`` argument to the ``Connection``
190 instance constructor.
191
192 :return: The value of the specified column of the first record.
193 """
194 data = await self.__bind_execute(args, 1, timeout)
195 if not data:
196 return None
197 return data[0][column]
198
199 @connresource.guarded
200 async def fetchrow(self, *args, timeout=None):

Callers 1

explainMethod · 0.45

Calls 1

__bind_executeMethod · 0.95

Tested by

no test coverage detected