mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
psycopg2: Accept Composable in place of query string (#7494)
https://www.psycopg.org/docs/sql.html#psycopg2.sql.Composable “Composable objects can be passed directly to execute(), executemany(), copy_expert() in place of the query string.” Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
@@ -5,6 +5,7 @@ from typing import Any, TypeVar, overload
|
||||
|
||||
import psycopg2
|
||||
import psycopg2.extensions
|
||||
from psycopg2.sql import Composable
|
||||
|
||||
_Vars = Sequence[Any] | Mapping[str, Any] | None
|
||||
|
||||
@@ -360,11 +361,11 @@ class cursor:
|
||||
def callproc(self, procname, parameters=...): ...
|
||||
def cast(self, oid, s): ...
|
||||
def close(self): ...
|
||||
def copy_expert(self, sql, file, size=...): ...
|
||||
def copy_expert(self, sql: str | bytes | Composable, file, size=...): ...
|
||||
def copy_from(self, file, table, sep=..., null=..., size=..., columns=...): ...
|
||||
def copy_to(self, file, table, sep=..., null=..., columns=...): ...
|
||||
def execute(self, query: str | bytes, vars: _Vars = ...) -> None: ...
|
||||
def executemany(self, query: str | bytes, vars_list: Iterable[_Vars]) -> None: ...
|
||||
def execute(self, query: str | bytes | Composable, vars: _Vars = ...) -> None: ...
|
||||
def executemany(self, query: str | bytes | Composable, vars_list: Iterable[_Vars]) -> None: ...
|
||||
def fetchall(self) -> list[tuple[Any, ...]]: ...
|
||||
def fetchmany(self, size=...) -> list[tuple[Any, ...]]: ...
|
||||
def fetchone(self) -> tuple[Any, ...] | Any: ...
|
||||
|
||||
Reference in New Issue
Block a user