From 100ee53537c64d21b1ccbffbbd00fba2890c9b23 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 12:01:20 -0600 Subject: [PATCH 1/8] [edgetest] automated change (#299) Co-authored-by: fdosani --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6d10c89..a45bc23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name="Faisal Dosani", email="faisal.dosani@capitalone.com" }, ] license = {text = "Apache Software License"} -dependencies = ["boto3<=1.35.9,>=1.9.92", "PyYAML<=6.0.1,>=5.1", "pandas<=2.2.2,>=0.25.2", "numpy<=2.0.2,>=1.22.0", "polars>=0.20.0"] +dependencies = ["boto3<=1.35.18,>=1.9.92", "PyYAML<=6.0.1,>=5.1", "pandas<=2.2.2,>=0.25.2", "numpy<=2.0.2,>=1.22.0", "polars>=0.20.0"] requires-python = ">=3.9.0" classifiers = [ From ba7bc36e664f6f02caf546e0b26aba99724f1db5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 07:55:02 -0600 Subject: [PATCH 2/8] [edgetest] automated change (#300) Co-authored-by: fdosani --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a45bc23..a9efe4a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name="Faisal Dosani", email="faisal.dosani@capitalone.com" }, ] license = {text = "Apache Software License"} -dependencies = ["boto3<=1.35.18,>=1.9.92", "PyYAML<=6.0.1,>=5.1", "pandas<=2.2.2,>=0.25.2", "numpy<=2.0.2,>=1.22.0", "polars>=0.20.0"] +dependencies = ["boto3<=1.35.23,>=1.9.92", "PyYAML<=6.0.1,>=5.1", "pandas<=2.2.3,>=0.25.2", "numpy<=2.0.2,>=1.22.0", "polars>=0.20.0"] requires-python = ">=3.9.0" classifiers = [ From de4bc637fbc480d4fbce19db9c763513934f5ef5 Mon Sep 17 00:00:00 2001 From: Gladys Teh <97971054+gladysteh99@users.noreply.github.com> Date: Thu, 26 Sep 2024 10:42:24 -0400 Subject: [PATCH 3/8] remove mocking, update call for pandas because setting columns=[] is not correct (#301) --- locopy/database.py | 2 +- tests/test_database.py | 38 +++++++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/locopy/database.py b/locopy/database.py index 2112d22..e5dfd58 100644 --- a/locopy/database.py +++ b/locopy/database.py @@ -225,7 +225,7 @@ def to_dataframe(self, df_type="pandas", size=None): return None if df_type == "pandas": - return pandas.DataFrame(fetched, columns=columns) + return pandas.DataFrame(fetched, columns=columns or None) elif df_type == "polars": return polars.DataFrame(fetched, schema=columns, orient="row") diff --git a/tests/test_database.py b/tests/test_database.py index d8e0777..85f8f82 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -23,7 +23,10 @@ import sqlite3 from unittest import mock +import pandas as pd import pg8000 +import polars as pl +import polars.testing as pltest import psycopg2 import pytest import snowflake.connector @@ -220,37 +223,47 @@ def test_execute_sql_exception(credentials, dbapi): @pytest.mark.parametrize("dbapi", DBAPIS) -@mock.patch("pandas.DataFrame") -def test_to_dataframe_all(mock_pandas, credentials, dbapi): +def test_to_dataframe_all_pandas(credentials, dbapi): with mock.patch(dbapi.__name__ + ".connect") as mock_connect: mock_connect.return_value.cursor.return_value.fetchall.return_value = [ (1, 2), (2, 3), (3,), ] + expected_df = pd.DataFrame( + [ + (1, 2), + (2, 3), + (3,), + ] + ) with Database(dbapi=dbapi, **credentials) as test: test.execute("SELECT 'hello world' AS fld") - df = test.to_dataframe() - + df = test.to_dataframe(df_type="pandas") + pd.testing.assert_frame_equal(df, expected_df) assert mock_connect.return_value.cursor.return_value.fetchall.called - mock_pandas.assert_called_with(test.cursor.fetchall(), columns=[]) @pytest.mark.parametrize("dbapi", DBAPIS) -@mock.patch("pandas.DataFrame") -def test_to_dataframe_custom_size(mock_pandas, credentials, dbapi): +def test_to_dataframe_custom_size(credentials, dbapi): with mock.patch(dbapi.__name__ + ".connect") as mock_connect: mock_connect.return_value.cursor.return_value.fetchmany.return_value = [ (1, 2), (2, 3), (3,), ] + expected_df = pd.DataFrame( + [ + (1, 2), + (2, 3), + (3,), + ] + ) with Database(dbapi=dbapi, **credentials) as test: test.execute("SELECT 'hello world' AS fld") df = test.to_dataframe(size=5) - + pd.testing.assert_frame_equal(df, expected_df) mock_connect.return_value.cursor.return_value.fetchmany.assert_called_with(5) - mock_pandas.assert_called_with(test.cursor.fetchmany(), columns=[]) @pytest.mark.parametrize("dbapi", DBAPIS) @@ -264,22 +277,21 @@ def test_to_dataframe_none(mock_pandas, credentials, dbapi): mock_pandas.assert_not_called() -# TODO: remove dataframe mocking @pytest.mark.parametrize("dbapi", DBAPIS) -@mock.patch("polars.DataFrame") -def test_to_dataframe_all_polars(mock_polars, credentials, dbapi): +def test_to_dataframe_all_polars(credentials, dbapi): with mock.patch(dbapi.__name__ + ".connect") as mock_connect: mock_connect.return_value.cursor.return_value.fetchall.return_value = [ (1, 2), (2, 3), (3, 4), ] + expected_df = pl.DataFrame([[1, 2, 3], [2, 3, 4]]) with Database(dbapi=dbapi, **credentials) as test: test.execute("SELECT 'hello world' AS fld") df = test.to_dataframe(df_type="polars") + pltest.assert_frame_equal(df, expected_df) assert mock_connect.return_value.cursor.return_value.fetchall.called - mock_polars.assert_called_with(test.cursor.fetchall(), schema=[], orient="row") @pytest.mark.parametrize("dbapi", DBAPIS) From a0fb8fa65359ed83558ed1e4d664e26c131905d2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 08:43:05 -0600 Subject: [PATCH 4/8] [edgetest] automated change (#302) Co-authored-by: fdosani --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a9efe4a..046d0e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name="Faisal Dosani", email="faisal.dosani@capitalone.com" }, ] license = {text = "Apache Software License"} -dependencies = ["boto3<=1.35.23,>=1.9.92", "PyYAML<=6.0.1,>=5.1", "pandas<=2.2.3,>=0.25.2", "numpy<=2.0.2,>=1.22.0", "polars>=0.20.0"] +dependencies = ["boto3<=1.35.28,>=1.9.92", "PyYAML<=6.0.1,>=5.1", "pandas<=2.2.3,>=0.25.2", "numpy<=2.0.2,>=1.22.0", "polars>=0.20.0"] requires-python = ">=3.9.0" classifiers = [ From e344de63f2c894566bf272d874b6ea44005faae2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 4 Oct 2024 11:45:01 -0600 Subject: [PATCH 5/8] [edgetest] automated change (#303) Co-authored-by: fdosani --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 046d0e4..afedaa1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name="Faisal Dosani", email="faisal.dosani@capitalone.com" }, ] license = {text = "Apache Software License"} -dependencies = ["boto3<=1.35.28,>=1.9.92", "PyYAML<=6.0.1,>=5.1", "pandas<=2.2.3,>=0.25.2", "numpy<=2.0.2,>=1.22.0", "polars>=0.20.0"] +dependencies = ["boto3<=1.35.33,>=1.9.92", "PyYAML<=6.0.1,>=5.1", "pandas<=2.2.3,>=0.25.2", "numpy<=2.0.2,>=1.22.0", "polars>=0.20.0"] requires-python = ">=3.9.0" classifiers = [ From 07e2e7c462e647455f23d1ce0c1361ab295db95f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 13 Oct 2024 08:07:56 -0300 Subject: [PATCH 6/8] [edgetest] automated change (#304) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index afedaa1..9559810 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name="Faisal Dosani", email="faisal.dosani@capitalone.com" }, ] license = {text = "Apache Software License"} -dependencies = ["boto3<=1.35.33,>=1.9.92", "PyYAML<=6.0.1,>=5.1", "pandas<=2.2.3,>=0.25.2", "numpy<=2.0.2,>=1.22.0", "polars>=0.20.0"] +dependencies = ["boto3<=1.35.38,>=1.9.92", "PyYAML<=6.0.1,>=5.1", "pandas<=2.2.3,>=0.25.2", "numpy<=2.0.2,>=1.22.0", "polars>=0.20.0"] requires-python = ">=3.9.0" classifiers = [ From f4df7d56a2d0894f4961ef7e32b7dba95016e03b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 11:46:45 -0600 Subject: [PATCH 7/8] [edgetest] automated change (#305) Co-authored-by: fdosani --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9559810..ab77965 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name="Faisal Dosani", email="faisal.dosani@capitalone.com" }, ] license = {text = "Apache Software License"} -dependencies = ["boto3<=1.35.38,>=1.9.92", "PyYAML<=6.0.1,>=5.1", "pandas<=2.2.3,>=0.25.2", "numpy<=2.0.2,>=1.22.0", "polars>=0.20.0"] +dependencies = ["boto3<=1.35.43,>=1.9.92", "PyYAML<=6.0.1,>=5.1", "pandas<=2.2.3,>=0.25.2", "numpy<=2.0.2,>=1.22.0", "polars>=0.20.0"] requires-python = ">=3.9.0" classifiers = [ From 718c054fd2efc5ce9283b71872537b928d9597ee Mon Sep 17 00:00:00 2001 From: Faisal Date: Tue, 22 Oct 2024 17:54:18 -0300 Subject: [PATCH 8/8] Update _version.py (#306) --- locopy/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locopy/_version.py b/locopy/_version.py index a9633c5..dc3ce4d 100644 --- a/locopy/_version.py +++ b/locopy/_version.py @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.6.1" +__version__ = "0.6.2"