Loading...

vastorbit.connection.global_connection.GlobalConnection.set_connection

GlobalConnection.set_connection(conn: Any, section: str | None = None, dsn: str | None = None) None

Sets the current connection.

Examples

The following code demonstrates the usage of the function.

# Import the Global Connection.
from vastorbit.connection.global_connection import get_global_connection

# Import the VAST connection function
from vastorbit.connection import vast_connection

# Building a connection
conn = vast_connection("VASTDSN")

# Example
get_global_connection().set_connection(conn)

Note

These functions serve as utilities to construct others, simplifying the overall code.