Skip to content

Commit

Permalink
Bumped ADBC min to 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Nov 10, 2023
1 parent e8d93c7 commit 3eed897
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 66 deletions.
4 changes: 2 additions & 2 deletions ci/deps/actions-310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dependencies:
- zstandard>=0.19.0

- pip:
- adbc-driver-postgresql>=0.7.0
- adbc-driver-sqlite>=0.7.0
- adbc-driver-postgresql>=0.8.0
- adbc-driver-sqlite>=0.8.0
- pyqt5>=5.15.8
- tzdata>=2022.7
4 changes: 2 additions & 2 deletions ci/deps/actions-311-downstream_compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ dependencies:
- pyyaml
- py
- pip:
- adbc-driver-postgresql>=0.7.0
- adbc-driver-sqlite>=0.7.0
- adbc-driver-postgresql>=0.8.0
- adbc-driver-sqlite>=0.8.0
- dataframe-api-compat>=0.1.7
- pyqt5>=5.15.8
- tzdata>=2022.7
4 changes: 2 additions & 2 deletions ci/deps/actions-311.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dependencies:
- zstandard>=0.19.0

- pip:
- adbc-driver-postgresql>=0.7.0
- adbc-driver-sqlite>=0.7.0
- adbc-driver-postgresql>=0.8.0
- adbc-driver-sqlite>=0.8.0
- pyqt5>=5.15.8
- tzdata>=2022.7
4 changes: 2 additions & 2 deletions ci/deps/actions-39-minimum_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ dependencies:
- zstandard=0.19.0

- pip:
- adbc-driver-postgresql==0.7.0
- adbc-driver-sqlite==0.7.0
- adbc-driver-postgresql==0.8.0
- adbc-driver-sqlite==0.8.0
- dataframe-api-compat==0.1.7
- pyqt5==5.15.8
- tzdata==2022.7
4 changes: 2 additions & 2 deletions ci/deps/actions-39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dependencies:
- zstandard>=0.19.0

- pip:
- adbc-driver-postgresql>=0.7.0
- adbc-driver-sqlite>=0.7.0
- adbc-driver-postgresql>=0.8.0
- adbc-driver-sqlite>=0.8.0
- pyqt5>=5.15.8
- tzdata>=2022.7
4 changes: 2 additions & 2 deletions ci/deps/circle-310-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ dependencies:
- xlsxwriter>=3.0.5
- zstandard>=0.19.0
- pip:
- adbc-driver-postgresql>=0.7.0
- adbc-driver-sqlite>=0.7.0
- adbc-driver-postgresql>=0.8.0
- adbc-driver-sqlite>=0.8.0
4 changes: 2 additions & 2 deletions doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ SQLAlchemy 2.0.0 postgresql, SQL support for dat
sql-other
psycopg2 2.9.6 postgresql PostgreSQL engine for sqlalchemy
pymysql 1.0.2 mysql MySQL engine for sqlalchemy
adbc-driver-postgresql 0.7.0 ADBC Driver for PostgreSQL
adbc-driver-sqlite 0.7.0 ADBC Driver for SQLite
adbc-driver-postgresql 0.8.0 ADBC Driver for PostgreSQL
adbc-driver-sqlite 0.8.0 ADBC Driver for SQLite
========================= ================== =============== =============================================================

Other data sources
Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ dependencies:
- pygments # Code highlighting

- pip:
- adbc-driver-postgresql>=0.7.0
- adbc-driver-sqlite>=0.7.0
- adbc-driver-postgresql>=0.8.0
- adbc-driver-sqlite>=0.8.0
- dataframe-api-compat>=0.1.7
- sphinx-toggleprompt # conda-forge version has stricter pins on jinja2
- typing_extensions; python_version<"3.11"
Expand Down
4 changes: 2 additions & 2 deletions pandas/compat/_optional.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# Update install.rst & setup.cfg when updating versions!

VERSIONS = {
"adbc-driver-postgresql": "0.7.0",
"adbc-driver-sqlite": "0.7.0",
"adbc-driver-postgresql": "0.8.0",
"adbc-driver-sqlite": "0.8.0",
"bs4": "4.11.2",
"blosc": "1.21.3",
"bottleneck": "1.3.6",
Expand Down
48 changes: 4 additions & 44 deletions pandas/tests/io/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,25 +274,17 @@ def create_and_load_types_sqlite3(conn, types_data: list[dict]):


def create_and_load_types_postgresql(conn, types_data: list[dict]):
# Boolean support not added until 0.8.0
adbc = import_optional_dependency("adbc_driver_manager", errors="ignore")

if adbc and Version(adbc.__version__) < Version("0.8.0"):
bool_type = "INTEGER"
else:
bool_type = "BOOLEAN"

with conn.cursor() as cur:
stmt = f"""CREATE TABLE types (
stmt = """CREATE TABLE types (
"TextCol" TEXT,
"DateCol" TIMESTAMP,
"IntDateCol" INTEGER,
"IntDateOnlyCol" INTEGER,
"FloatCol" DOUBLE PRECISION,
"IntCol" INTEGER,
"BoolCol" {bool_type},
"BoolCol" BOOLEAN,
"IntColWithNull" INTEGER,
"BoolColWithNull" {bool_type}
"BoolColWithNull" BOOLEAN
)"""
cur.execute(stmt)

Expand Down Expand Up @@ -724,17 +716,7 @@ def postgresql_adbc_types(postgresql_adbc_conn, types_data):
conn.adbc_get_table_schema("types")
except mgr.ProgrammingError:
conn.rollback()
# Boolean support not added until 0.8.0
adbc = import_optional_dependency("adbc_driver_manager")
if Version(adbc.__version__) < Version("0.8.0"):
new_data = []
for entry in types_data:
entry["BoolCol"] = int(entry["BoolCol"])
if entry["BoolColWithNull"] is not None:
entry["BoolColWithNull"] = int(entry["BoolColWithNull"])
new_data.append(tuple(entry.values()))
else:
new_data = [tuple(entry.values()) for entry in types_data]
new_data = [tuple(entry.values()) for entry in types_data]

create_and_load_types_postgresql(conn, new_data)

Expand Down Expand Up @@ -3539,22 +3521,13 @@ def test_read_sql_dtype_backend(
conn = request.getfixturevalue(conn)
table = "test"
df = dtype_backend_data
if "adbc" in conn_name:
# Boolean support not added until 0.8.0
adbc = import_optional_dependency("adbc_driver_manager")
if Version(adbc.__version__) < Version("0.8.0"):
df = df.drop(columns=["e", "f"])
df.to_sql(name=table, con=conn, index=False, if_exists="replace")

with pd.option_context("mode.string_storage", string_storage):
result = getattr(pd, func)(
f"Select * from {table}", conn, dtype_backend=dtype_backend
)
expected = dtype_backend_expected(string_storage, dtype_backend, conn_name)
if "adbc" in conn_name:
adbc = import_optional_dependency("adbc_driver_manager")
if Version(adbc.__version__) < Version("0.8.0"):
expected = expected.drop(columns=["e", "f"])
tm.assert_frame_equal(result, expected)

if "adbc" in conn_name:
Expand Down Expand Up @@ -3598,19 +3571,11 @@ def test_read_sql_dtype_backend_table(
conn = request.getfixturevalue(conn)
table = "test"
df = dtype_backend_data
if "adbc" in conn_name:
adbc = import_optional_dependency("adbc_driver_manager")
if Version(adbc.__version__) < Version("0.8.0"):
df = df.drop(columns=["e", "f"])
df.to_sql(name=table, con=conn, index=False, if_exists="replace")

with pd.option_context("mode.string_storage", string_storage):
result = getattr(pd, func)(table, conn, dtype_backend=dtype_backend)
expected = dtype_backend_expected(string_storage, dtype_backend, conn_name)
if "adbc" in conn_name:
adbc = import_optional_dependency("adbc_driver_manager")
if Version(adbc.__version__) < Version("0.8.0"):
expected = expected.drop(columns=["e", "f"])
tm.assert_frame_equal(result, expected)

if "adbc" in conn_name:
Expand All @@ -3632,14 +3597,9 @@ def test_read_sql_dtype_backend_table(
@pytest.mark.parametrize("conn", all_connectable)
@pytest.mark.parametrize("func", ["read_sql", "read_sql_table", "read_sql_query"])
def test_read_sql_invalid_dtype_backend_table(conn, request, func, dtype_backend_data):
conn_name = conn
conn = request.getfixturevalue(conn)
table = "test"
df = dtype_backend_data
if "adbc" in conn_name:
adbc = import_optional_dependency("adbc_driver_manager")
if Version(adbc.__version__) < Version("0.8.0"):
df = df.drop(columns=["e", "f"])
df.to_sql(name=table, con=conn, index=False, if_exists="replace")

msg = (
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ output-formatting = ['jinja2>=3.1.2', 'tabulate>=0.9.0']
clipboard = ['PyQt5>=5.15.8', 'qtpy>=2.3.0']
compression = ['zstandard>=0.19.0']
consortium-standard = ['dataframe-api-compat>=0.1.7']
all = ['adbc-driver-postgresql>=0.7.0',
'adbc-driver-sqlite>=0.7.0',
all = ['adbc-driver-postgresql>=0.8.0',
'adbc-driver-sqlite>=0.8.0',
'beautifulsoup4>=4.11.2',
# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
#'blosc>=1.21.3',
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ feedparser
pyyaml
requests
pygments
adbc-driver-postgresql>=0.7.0
adbc-driver-sqlite>=0.7.0
adbc-driver-postgresql>=0.8.0
adbc-driver-sqlite>=0.8.0
dataframe-api-compat>=0.1.7
sphinx-toggleprompt
typing_extensions; python_version<"3.11"
Expand Down

0 comments on commit 3eed897

Please sign in to comment.