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 4358971 commit 8a40e22
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/by-example/sqlalchemy/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 setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def read(path):
'stopit>=1.1.2,<2',
'flake8>=4,<8',
'pandas<2.3',
'pueblo>=0.0.7',
'pytz',
],
doc=['sphinx>=3.5,<8',
Expand Down
4 changes: 2 additions & 2 deletions src/crate/client/sqlalchemy/tests/bulk_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ def test_bulk_save_pandas(self, mock_cursor):
"""
Verify bulk INSERT with pandas.
"""
from pandas._testing import makeTimeDataFrame
from crate.client.sqlalchemy.support import insert_bulk
from pueblo.testing.pandas import makeTimeDataFrame

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

# 42 records / 4 partitions means each partition has a size of 10.5 elements.
# Because the chunk size 8 is slightly smaller than 10, the partition will not
Expand Down

0 comments on commit 8a40e22

Please sign in to comment.