How to use the turbodbc.InterfaceError function in turbodbc

To help you get started, we’ve selected a few turbodbc 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 blue-yonder / turbodbc / python / turbodbc_test / test_connection.py View on Github external
def test_commit_on_closed_connection_raises(dsn, configuration):
    connection = connect(dsn, **get_credentials(configuration))
    connection.close()

    with pytest.raises(InterfaceError):
        connection.commit()
github blue-yonder / turbodbc / python / turbodbc_test / test_cursor_select.py View on Github external
def test_fetchmany_with_bad_global_arraysize_raises(dsn, configuration):
    with open_cursor(configuration) as cursor:
        with query_fixture(cursor, configuration, 'SELECT MULTIPLE INTEGERS') as query:
            cursor.execute(query)

            cursor.arraysize = -1
            with pytest.raises(turbodbc.InterfaceError):
                cursor.fetchmany()

            cursor.arraysize = 0
            with pytest.raises(turbodbc.InterfaceError):
                cursor.fetchmany()
github blue-yonder / turbodbc / python / turbodbc_test / test_executemanycolumns_corner_cases.py View on Github external
def test_column_with_non_contiguous_data_raises(dsn, configuration):
    with open_cursor(configuration) as cursor:
        with query_fixture(cursor, configuration, 'INSERT INTEGER') as table_name:
            two_dimensional = array([[1, 2, 3], [4, 5, 6]], dtype='int64')
            one_dimensional = two_dimensional[:, 1]
            assert one_dimensional.flags.c_contiguous == False
            columns = [one_dimensional]
            with pytest.raises(turbodbc.InterfaceError):
                cursor.executemanycolumns("INSERT INTO {} VALUES (?)".format(table_name), columns)
github blue-yonder / turbodbc / python / turbodbc_test / test_cursor_basics.py View on Github external
def test_closed_cursor_raises_when_used(dsn, configuration):
    connection = connect(dsn, **get_credentials(configuration))
    cursor = connection.cursor()

    cursor.close()

    with pytest.raises(InterfaceError):
        cursor.execute("SELECT 42")

    with pytest.raises(InterfaceError):
        cursor.executemany("SELECT 42")

    with pytest.raises(InterfaceError):
        cursor.executemanycolumns("SELECT 42", [])

    with pytest.raises(InterfaceError):
        cursor.fetchone()

    with pytest.raises(InterfaceError):
        cursor.fetchmany()

    with pytest.raises(InterfaceError):
        cursor.fetchall()
github blue-yonder / turbodbc / python / turbodbc_test / test_cursor_basics.py View on Github external
def test_pep343_with_statement(dsn, configuration):
    with connect(dsn, **get_credentials(configuration)) as connection:
        with connection.cursor() as cursor:
            cursor.execute("SELECT 42")

        # cursor should be closed
        with pytest.raises(InterfaceError):
            cursor.execute("SELECT 42")
github blue-yonder / turbodbc / python / turbodbc_test / test_cursor_select.py View on Github external
def test_fetchmany_with_bad_global_arraysize_raises(dsn, configuration):
    with open_cursor(configuration) as cursor:
        with query_fixture(cursor, configuration, 'SELECT MULTIPLE INTEGERS') as query:
            cursor.execute(query)

            cursor.arraysize = -1
            with pytest.raises(turbodbc.InterfaceError):
                cursor.fetchmany()

            cursor.arraysize = 0
            with pytest.raises(turbodbc.InterfaceError):
                cursor.fetchmany()
github blue-yonder / turbodbc / python / turbodbc_test / test_executemanycolumns_corner_cases.py View on Github external
def test_column_of_unsupported_type_raises(dsn, configuration):
    with open_cursor(configuration) as cursor:
        with query_fixture(cursor, configuration, 'INSERT INTEGER') as table_name:
            columns = ["this is not a NumPy MaskedArray"]
            with pytest.raises(turbodbc.InterfaceError):
                cursor.executemanycolumns("INSERT INTO {} VALUES (?)".format(table_name), columns)
github blue-yonder / turbodbc / python / turbodbc_test / test_select_numpy.py View on Github external
def test_numpy_without_result_set_raises(dsn, configuration):
    with open_cursor(configuration) as cursor:
        with pytest.raises(turbodbc.InterfaceError):
            cursor.fetchallnumpy()
github blue-yonder / turbodbc / python / turbodbc_test / test_select_arrow.py View on Github external
def test_arrow_without_result_set_raises(dsn, configuration):
    with open_cursor(configuration) as cursor:
        with pytest.raises(turbodbc.InterfaceError):
            cursor.fetchallarrow()
github blue-yonder / turbodbc / python / turbodbc_test / test_connection.py View on Github external
def test_cursor_on_closed_connection_raises(dsn, configuration):
    connection = connect(dsn, **get_credentials(configuration))
    connection.close()

    with pytest.raises(InterfaceError):
        connection.cursor()