Skip to content

Commit

Permalink
Merge pull request #444 from alippai/patch-134
Browse files Browse the repository at this point in the history
Fix turbodbc_intern import and test pyarrow as a hard dependency
  • Loading branch information
xhochy authored Oct 18, 2024
2 parents d972d72 + 67a06fb commit 062047f
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 41 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------

Expand Down
1 change: 0 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 2 additions & 11 deletions tests/test_executemanycolumns.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime

import pyarrow as pa
import pytest
from helpers import (
for_each_database,
Expand All @@ -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)


Expand Down
15 changes: 1 addition & 14 deletions tests/test_executemanycolumns_corner_cases.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pyarrow as pa
import pytest
from helpers import for_one_database, open_cursor
from numpy import array
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
11 changes: 0 additions & 11 deletions turbodbc/arrow_support.py

This file was deleted.

5 changes: 2 additions & 3 deletions turbodbc/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 062047f

Please sign in to comment.