new_auto_connection

In [ ]:
new_auto_connection(dsn: dict,
                    name: str = "VML")

Saves a connection to automatically create database cursors, creating a used-as-needed file to automatically set up a connection. Useful for preventing redundant cursors. The function 'get_connection_file' returns the connection file path.

Parameters

Name Type Optional Description
dsn
dict
Dictionnary containing the information to set up the connection.
  • database : Database Name
  • host : Server ID
  • password : User Password
  • port : Database Port (optional, default: 5433)
  • user : User ID (optional, default: dbadmin)
name
str
Name of the auto connection.

Example

In [6]:
from verticapy.connect import *

new_auto_connection({"host": "10.211.55.14", 
                     "port": "5433", 
                     "database": "testdb", 
                     "password": "XxX", 
                     "user": "dbadmin"},
                     name = "my_auto_connection")
# Set the main auto connection
change_auto_connection("my_auto_connection")

# Displays the available connections
available_auto_connection()
The available connections are the following: my_auto_connection, VerticaDSN
Out[6]:
['my_auto_connection', 'VerticaDSN']

See Also

change_auto_connection Changes the current auto connection.
read_auto_connect Automatically creates a connection.
vertica_conn Creates a Vertica Database connection.