How to use the etlhelper.connect 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 / test / integration / db / test_sqlite.py View on Github external
def test_connect(sqlitedb):
    conn = connect(sqlitedb)
    assert isinstance(conn, sqlite3.Connection)
    assert os.path.isfile(sqlitedb.filename)
github BritishGeologicalSurvey / etlhelper / test / integration / db / test_sqlite.py View on Github external
def test_bad_connect(tmpdir):
    # Attemping to create file in non-existent directory should fail
    try:
        db_params = DbParams(dbtype='SQLITE', filename='/does/not/exist')
        with pytest.raises(ETLHelperConnectionError):
            connect(db_params)
    finally:
        # Restore permissions prior to cleanup
        os.chmod(tmpdir, 0o666)
github BritishGeologicalSurvey / etlhelper / test / integration / db / test_oracle.py View on Github external
def test_connect():
    conn = connect(ORADB, 'TEST_ORACLE_PASSWORD')
    assert isinstance(conn, cx_Oracle.Connection)
github BritishGeologicalSurvey / etlhelper / test / integration / db / test_oracle.py View on Github external
def testdb_conn():
    """Get connection to test MS SQL database."""
    with connect(ORADB, 'TEST_ORACLE_PASSWORD', encoding="UTF-8",
                 nencoding="UTF-8") as conn:
        yield conn
github BritishGeologicalSurvey / etlhelper / test / integration / db / test_sqlite.py View on Github external
def testdb_conn(sqlitedb):
    """Get connection to test SQLite database."""
    with connect(sqlitedb) as conn:
        yield conn
github BritishGeologicalSurvey / etlhelper / test / integration / db / test_oracle.py View on Github external
def test_connect_wrong_password(monkeypatch):
    monkeypatch.setitem(os.environ, 'TEST_ORACLE_PASSWORD', 'bad_password')
    with pytest.raises(ETLHelperConnectionError):
        connect(ORADB, 'TEST_ORACLE_PASSWORD')