MCPcopy
hub / github.com/MagicStack/asyncpg / cursor

Method cursor

asyncpg/connection.py:567–604  ·  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

565 return rows[0]
566
567 def cursor(
568 self,
569 query,
570 *args,
571 prefetch=None,
572 timeout=None,
573 record_class=None
574 ):
575 """Return a *cursor factory* for the specified query.
576
577 :param args:
578 Query arguments.
579 :param int prefetch:
580 The number of rows the *cursor iterator*
581 will prefetch (defaults to ``50``.)
582 :param float timeout:
583 Optional timeout in seconds.
584 :param type record_class:
585 If specified, the class to use for records returned by this cursor.
586 Must be a subclass of :class:`~asyncpg.Record`. If not specified,
587 a per-connection *record_class* is used.
588
589 :return:
590 A :class:`~cursor.CursorFactory` object.
591
592 .. versionchanged:: 0.22.0
593 Added the *record_class* parameter.
594 """
595 self._check_open()
596 return cursor.CursorFactory(
597 self,
598 query,
599 None,
600 args,
601 prefetch,
602 timeout,
603 record_class,
604 )
605
606 async def prepare(
607 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