vastorbit.connection.vast_connection¶
- vastorbit.connection.vast_connection(section: str | None = None, dsn: str | None = None, config: dict | None = None) Any¶
Reads the input DSN and creates a VAST DataBase connection using Trino.
- Parameters:
section (str, optional) – Name of the section in the configuration file.
dsn (str, optional) – Path to the file containing the credentials. If empty, the
vastorbit_CONNECTIONenvironment variable will be used.config (dict, optional) – Configuration object override used to create a connection. If specified, will ignore the section and dsn properties.
- Returns:
Database connection.
- Return type:
conn
Examples
Create a connection using the input DSN:
Note
This example utilizes a Data Source Name (DSN) to establish the connection, which is stored in the file specified by the global variable
vastorbit_CONNECTION. However, if you prefer a customized file with a different location, you can specify the file path accordingly.from vastorbit.connection import vast_connection vast_connection("VASTDSN")
<trino.dbapi.Connection object at 0x106526198>See also
current_connection(): Returns the current vastorbit connection.new_connection(): Creates a new vastorbit connection.set_connection(): Sets the vastorbit connection.