Module spin_sdk.wit.imports.postgres
Classes
class Connection
-
A connection to a postgres database.
Expand source code
class Connection: """ A connection to a postgres database. """ @classmethod def open(cls, address: str) -> Self: """ Open a connection to the Postgres instance at `address`. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)` """ raise NotImplementedError def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet: """ Query the database. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)` """ raise NotImplementedError def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> int: """ Execute command to the database. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)` """ raise NotImplementedError def __enter__(self) -> Self: """Returns self""" return self def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None: """ Release this resource. """ raise NotImplementedError
Static methods
def open(address: str) ‑> Self
Methods
def execute(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> intdef query(self,
statement: str,
params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> RowSet