diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ca9a442c..b56bc54b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,11 @@ Version history / changelog From version 2.0.0, turbodbc adapts semantic versioning. +Version 5.0.2 +------------- + +* Fix and clean up the PyArrow integration + Version 5.0.0 ------------- diff --git a/meson.build b/meson.build index df8c256b..e5420399 100644 --- a/meson.build +++ b/meson.build @@ -190,7 +190,6 @@ py.install_sources( 'turbodbc/data_types.py', 'turbodbc/api_constants.py', 'turbodbc/connection.py', - 'turbodbc/arrow_support.py', 'turbodbc/exceptions.py', 'turbodbc/constructors.py', 'turbodbc/cursor.py', diff --git a/pyproject.toml b/pyproject.toml index 2df87f3f..41b9d69b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ build-backend = "mesonpy" [project] name = "turbodbc" -version = "5.0.1" +version = "5.0.2" description = "turbodbc is a Python DB API 2.0 compatible ODBC driver" readme = "README.md" requires-python = ">=3.10" diff --git a/tests/test_executemanycolumns.py b/tests/test_executemanycolumns.py index 0dcc56f6..6f902f31 100644 --- a/tests/test_executemanycolumns.py +++ b/tests/test_executemanycolumns.py @@ -1,5 +1,6 @@ import datetime +import pyarrow as pa import pytest from helpers import ( for_each_database, @@ -11,17 +12,7 @@ from numpy.ma import MaskedArray from query_fixture import query_fixture -column_backends = ["numpy"] - -try: - import pyarrow as pa - import turbodbc_arrow_support # noqa: F401 - - column_backends.append("arrow") - # column_backends.append('pandas') -except ImportError: - pass - +column_backends = ["numpy", "arrow"] for_each_column_backend = pytest.mark.parametrize("column_backend", column_backends) diff --git a/tests/test_executemanycolumns_corner_cases.py b/tests/test_executemanycolumns_corner_cases.py index 32a9ec02..75654140 100644 --- a/tests/test_executemanycolumns_corner_cases.py +++ b/tests/test_executemanycolumns_corner_cases.py @@ -1,3 +1,4 @@ +import pyarrow as pa import pytest from helpers import for_one_database, open_cursor from numpy import array @@ -7,18 +8,6 @@ import turbodbc from turbodbc import InterfaceError -try: - import pyarrow as pa - import turbodbc_arrow_support # noqa: F401 - - HAVE_ARROW = True -except ImportError: - HAVE_ARROW = False - - -arrow_support = pytest.mark.skipif( - not HAVE_ARROW, reason="not build with Arrow support" -) @for_one_database @@ -119,7 +108,6 @@ def test_passing_empty_column_is_ok(dsn, configuration): assert results == [] -@arrow_support @for_one_database def test_arrow_table_exceeds_expected_columns(dsn, configuration): with open_cursor(configuration) as cursor: @@ -140,7 +128,6 @@ def test_arrow_table_exceeds_expected_columns(dsn, configuration): ) -@arrow_support @for_one_database def test_arrow_table_chunked_arrays_not_supported(dsn, configuration): with open_cursor(configuration) as cursor: diff --git a/turbodbc/arrow_support.py b/turbodbc/arrow_support.py deleted file mode 100644 index ea059b63..00000000 --- a/turbodbc/arrow_support.py +++ /dev/null @@ -1,11 +0,0 @@ -import os -import sys - -import pyarrow - -# Ensure arrow_python${SHLIB_EXT} is on the PATH. -if sys.platform == "win32": - for lib_dir in pyarrow.get_library_dirs(): - os.add_dll_directory(lib_dir) - -from turbodbc_arrow_support import * # noqa diff --git a/turbodbc/cursor.py b/turbodbc/cursor.py index d5c0f2ff..572186c8 100644 --- a/turbodbc/cursor.py +++ b/turbodbc/cursor.py @@ -8,7 +8,8 @@ make_numpy_result_set, make_parameter_set, make_row_based_result_set, - set_numpy_parameters, + set_arrow_parameters, + set_numpy_parameters ) from .exceptions import InterfaceError, translate_exceptions @@ -184,8 +185,6 @@ def _num_chunks(c): return c.num_chunks if isinstance(columns, pa.Table): - from turbodbc.arrow_support import set_arrow_parameters # type: ignore - for column in columns.itercolumns(): if _num_chunks(column) != 1: raise NotImplementedError("Chunked Arrays are " "not yet supported")