PandasSqlHandler

The class has a few helper methods for setting up the database connection, assigning the database environment, reading tables, and executing queries.

Methods

__init__

First assign the environment. Environment configurations are set up in the config/sql_config.yaml file.

Next based on the environment, return the SQL_Driver string from the config/sql_config.yaml file.

Next combine the connection elements into the URL formatted string

Lastly invoke the sql alchemy create engine method.

__assign_conn_str

The method will read config/sql_config.yaml file, and return the applicable SQL_Driver string from the config/sql_config.yaml file.

read_table

Using Pandas package, call the read_sql method and return a Pandas Dataframe.

execute_query

With the sql database connection defined earlier, execute the sql query and commit the query.

On the next page we will discuss the configuration files.