MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / cursor

Method cursor

asyncpg/connection.py:590–627  ·  view source on GitHub ↗

Return a *cursor factory* for the specified query. :param args: Query arguments. :param int prefetch: The number of rows the *cursor iterator* will prefetch (defaults to ``50``.) :param float timeout: Optional timeout in second

(
        self,
        query,
        *args,
        prefetch=None,
        timeout=None,
        record_class=None
    )

Source from the content-addressed store, hash-verified

588 return rows[0]
589
590 def cursor(
591 self,
592 query,
593 *args,
594 prefetch=None,
595 timeout=None,
596 record_class=None
597 ):
598 """Return a *cursor factory* for the specified query.
599
600 :param args:
601 Query arguments.
602 :param int prefetch:
603 The number of rows the *cursor iterator*
604 will prefetch (defaults to ``50``.)
605 :param float timeout:
606 Optional timeout in seconds.
607 :param type record_class:
608 If specified, the class to use for records returned by this cursor.
609 Must be a subclass of :class:`~asyncpg.Record`. If not specified,
610 a per-connection *record_class* is used.
611
612 :return:
613 A :class:`~cursor.CursorFactory` object.
614
615 .. versionchanged:: 0.22.0
616 Added the *record_class* parameter.
617 """
618 self._check_open()
619 return cursor.CursorFactory(
620 self,
621 query,
622 None,
623 args,
624 prefetch,
625 timeout,
626 record_class,
627 )
628
629 async def prepare(
630 self,

Callers 15

test8Method · 0.45
test_pool_11Method · 0.45
test_standby_cursorsMethod · 0.45
test_timeout_04Method · 0.45
test_timeout_06Method · 0.45

Calls 1

_check_openMethod · 0.95

Tested by 15

test8Method · 0.36
test_pool_11Method · 0.36
test_standby_cursorsMethod · 0.36
test_timeout_04Method · 0.36
test_timeout_06Method · 0.36