How to use the etlhelper.db_helpers.db_helper.DbHelper function in etlhelper

To help you get started, we’ve selected a few etlhelper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BritishGeologicalSurvey / etlhelper / etlhelper / db_helpers / oracle.py View on Github external
"""
Database helper for Oracle
"""
from etlhelper.db_helpers.db_helper import DbHelper


class OracleDbHelper(DbHelper):
    """
    Oracle DB helper class
    """
    def __init__(self):
        super().__init__()
        try:
            import cx_Oracle
            self.sql_exceptions = (cx_Oracle.DatabaseError)
            self._connect_func = cx_Oracle.connect
            self.connect_exceptions = (cx_Oracle.DatabaseError)
            self.required_params = {'host', 'port', 'dbname', 'user'}
        except ImportError:
            print("The cxOracle drivers were not found. See setup guide for more information.")

    def get_connection_string(self, db_params, password_variable):
        """
github BritishGeologicalSurvey / etlhelper / etlhelper / db_helpers / postgres.py View on Github external
"""
Database helper for Postgres
"""
from etlhelper.db_helpers.db_helper import DbHelper


class PostgresDbHelper(DbHelper):
    """
    Postgres db helper class
    """
    def __init__(self):
        super().__init__()
        try:
            import psycopg2
            self.sql_exceptions = (psycopg2.ProgrammingError)
            self._connect_func = psycopg2.connect
            self.connect_exceptions = (psycopg2.OperationalError)
            self.required_params = {'host', 'port', 'dbname', 'user'}
        except ImportError:
            print("The PostgreSQL python libraries could not be found.\n"
                  "Run: python -m pip install psycopg2-binary")

    def get_connection_string(self, db_params, password_variable):
github BritishGeologicalSurvey / etlhelper / etlhelper / db_helpers / mssql.py View on Github external
"""
Database helper for mssql
"""
from etlhelper.db_helpers.db_helper import DbHelper


class MSSQLDbHelper(DbHelper):
    """
    MS Sql server helper class
    """
    def __init__(self):
        super().__init__()
        try:
            import pyodbc
            self.sql_exceptions = (pyodbc.DatabaseError)
            self._connect_func = pyodbc.connect
            self.connect_exceptions = (pyodbc.DatabaseError, pyodbc.InterfaceError)
            self.required_params = {'host', 'port', 'dbname', 'user', 'odbc_driver'}
        except ImportError:
            print("The pyodc Python package could not be found.\n"
                  "Run: python -m pip install pyodbc")

    def get_connection_string(self, db_params, password_variable):