Loading...

verticapy.connection.vertica_connection

verticapy.connection.vertica_connection(section: str | None = None, dsn: str | None = None, config: dict | None = None) Connection

Reads the input DSN and creates a Vertica Database connection.

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 VERTICAPY_CONNECTION environment 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

conn

Database connection.

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 VERTICAPY_CONNECTION. However, if you prefer a customized file with a different location, you can specify the file path accordingly.

from verticapy.connection import vertica_connection

vertica_connection("VerticaDSN")

<vertica_python.vertica.connection.Connection at 0x106526198>

See also

current_connection() : Returns the current VerticaPy connection.
new_connection() : Creates a new VerticaPy connection.
set_connection() : Sets the VerticaPy connection.