read_dsn

In [ ]:
read_dsn(section: str, 
         dsn: str = "")

Reads the DSN information from the ODBCINI environment variable or the input file.

Parameters

Name Type Optional Description
section
str
Name of the section in the configuration file.
dsn
str
Path to the file containing the credentials. If empty, the ODBCINI environment variable will be used.

Returns

dict : dictionary with all the credentials

Example

In [3]:
from verticapy.connect import *

# Reading from DSN (ODBCINI)
dsn = read_dsn("VerticaDSN")
dsn
Out[3]:
{'database': 'testdb',
 'description': 'DSN for Vertica',
 'driver': '/Library/Vertica/ODBC/lib/libverticaodbc.dylib',
 'host': '10.211.55.14',
 'kerberos_host_name': 'badr',
 'password': 'XxX',
 'port': '5433',
 'user': 'dbadmin'}
In [24]:
# Reading from a file
dsn = read_dsn("vp_test_config", 
               "/Users/Badr/Library/Python/3.6/lib/python/site-packages/verticapy/tests/verticaPy_test.conf")
dsn
Out[24]:
{'password': 'XxX',
 'port': 5433,
 'user': 'dbadmin',
 'vp_test_database': 'testdb',
 'vp_test_host': '10.211.55.14',
 'vp_test_log_dir': 'mylog/vp_tox_tests_log',
 'vp_test_password': 'XxX',
 'vp_test_port': '5433',
 'vp_test_user': 'dbadmin'}