vertica_db_client
Configure your database connection.
-
vertica_db_client.connect(dsn=None, database=None, user=None, password=None, host=None, port=None, sslmode=None, sessionlabel=None, connsettings=None)
Returns a new database connection object.
- Args:
- dsn (Optional[str]): Data Source Name (DSN) is the ODBC logical name for the drive
- and other information the database needs to access data.
database (str): The name of your Vertica database.
user (str): Your Vertica user name.
password (str): The password for the user’s account.
host (Optional[str]): The name of the host.
port (Optional[str]): The port number on which Vertica listens for ODBC connections. Default value: 5433
- sslmode (Optional[str]): Specifies how (or whether) clients use SSL when connecting to servers.
- The default value is prefer, meaning to use SSL if the server offers it. Legal values are
“require”, “prefer”, “allow”, and “disable”.
- sessionlabel (Optional[str]): Sets a label for the connection on the server. This value appears in the
- session_id column of the V_MONITOR.SESSIONS system table.
- connsettings (Optional[str]): A string containing SQL commands that the driver should execute immediately
- after connecting to the server. You can use this parameter to configure the connection,
such as setting a schema search path. Reserved symbols: In the connection string ‘;’
is a reserved symbol. To set multiple parameters as part of ConnSettings parameters, use ‘%3B’
for ‘,’. Also use ‘+’ for spaces.
- Examples:
As a connection string:
conn = vertica_db_client.connect("database=verticadb user=user_name password=pwd")
As a set of keyword arguments:
conn = vertica_db_client.connect(database="verticadb", user='user_name', password='pwd')
As a dictionary:
dict_conn = {'database': 'verticadb', 'user': 'user_name', 'password': 'pwd'}
conn = vertica_db_client.connect(dict_conn)