Skip to content

Commit

Permalink
Testing: Pull makeTimeDataFrame and makeMixedDataFrame from pueblo
Browse files Browse the repository at this point in the history
`pandas._testing.{makeTimeDataFrame,makeMixedDataFrame}` were removed on
behalf of pandas 2.2.0. This patch pulls corresponding polyfills from
a hostel package.
  • Loading branch information
amotl committed Jan 30, 2024
1 parent 720db5e commit a325c9b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/dataframe.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ The package provides a ``bulk_insert`` function to use the
workload across multiple batches, using a defined chunk size.

>>> import sqlalchemy as sa
>>> from pandas._testing import makeTimeDataFrame
>>> from crate.client.sqlalchemy.support import insert_bulk
>>> from pueblo.testing.pandas import makeTimeDataFrame
...
>>> # Define number of records, and chunk size.
>>> INSERT_RECORDS = 42
Expand Down Expand Up @@ -159,8 +159,8 @@ in a batched/chunked manner, using a defined chunk size, effectively using the
pandas implementation introduced in the previous section.

>>> import dask.dataframe as dd
>>> from pandas._testing import makeTimeDataFrame
>>> from crate.client.sqlalchemy.support import insert_bulk
>>> from pueblo.testing.pandas import makeTimeDataFrame
...
>>> # Define the number of records, the number of computing partitions,
>>> # and the chunk size of each database insert operation.
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ release = [
test = [
"dask",
"pandas<2.3",
"pueblo>=0.0.7",
"pytest<9",
"pytest-cov<5",
"pytest-mock<4",
Expand Down
4 changes: 2 additions & 2 deletions tests/bulk_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def test_bulk_save_pandas(self, mock_cursor):
"""
Verify bulk INSERT with pandas.
"""
from pandas._testing import makeTimeDataFrame
from pueblo.testing.pandas import makeTimeDataFrame
from sqlalchemy_cratedb import insert_bulk

# 42 records / 8 chunksize = 5.25, which means 6 batches will be emitted.
Expand Down Expand Up @@ -216,7 +216,7 @@ def test_bulk_save_dask(self, mock_cursor):
Verify bulk INSERT with Dask.
"""
import dask.dataframe as dd
from pandas._testing import makeTimeDataFrame
from pueblo.testing.pandas import makeTimeDataFrame
from sqlalchemy_cratedb import insert_bulk

# 42 records / 4 partitions means each partition has a size of 10.5 elements.
Expand Down

0 comments on commit a325c9b

Please sign in to comment.