dev-python/agate-sql: Remove old

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2023-10-29 11:30:42 +01:00
parent 547259fc72
commit 31dc9cb570
5 changed files with 0 additions and 193 deletions

View File

@@ -1,3 +1 @@
DIST agate-sql-0.5.9.tar.gz 15434 BLAKE2B 4825bfc5d0f78e0cd1bf318fe8797bfe03deaff1ffc962e0f082128af9d05afad97b7488d66b76d59411eb5dd889229be1fe05cf5bf55db4084f3451b21440b2 SHA512 482f257bb16e142d9380b9ae7590f50909639729e229271843686d6316ebfba0e77daac47e809b7aad4ef89d6c3810382d0b6817a418406bf73f13e266e5bcca
DIST agate-sql-0.6.0.tar.gz 13942 BLAKE2B c7940274a8625585fa92c81fdd1d2e2f53e76db3b14620e406df7609057482f8641cfcf20a486bf6f8db381362ee367b4dad9b6a7f04909f5cba4c491d01fde9 SHA512 74e90dad3776f817e92ded312cdf87c78754e9a3b5611a681a4a85d7a8357577a9e4dbb70b453c589417990f3f0a04195a8b0076fd03a1e2012b82893208b824
DIST agate-sql-0.7.0.tar.gz 13488 BLAKE2B 1064747f1f2a11f788c0828123ae3532ffd0aa6b32aa423b877e350e35e4231c21e73226920110ad9369b0b583167e47357acf456607e75e0ad9d5027e265c9c SHA512 6a29bcb19cac6e80a6df8ad51c06838fa4c48a1e5b207a55f7ebaf3b7af1afd56fad61c560f4c7a11da24e9460ab0a8ea6d9459309e05ac162f3ddd3737bb868

View File

@@ -1,40 +0,0 @@
# Copyright 2021-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYPI_NO_NORMALIZE=1
PYTHON_COMPAT=( python3_{9..11} )
inherit distutils-r1 pypi
DESCRIPTION="Adds SQL read/write support to agate"
HOMEPAGE="
https://github.com/wireservice/agate-sql/
https://pypi.org/project/agate-sql/
"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm64-macos ~x64-macos"
RDEPEND="
>=dev-python/agate-1.5.0[${PYTHON_USEDEP}]
>=dev-python/sqlalchemy-1.4[${PYTHON_USEDEP}]
"
BDEPEND="
test? (
dev-python/greenlet[${PYTHON_USEDEP}]
dev-python/lxml[${PYTHON_USEDEP}]
)
"
PATCHES=("${FILESDIR}/agate-sql-0.5.9-sqlalchemy.patch")
distutils_enable_tests pytest
EPYTEST_DESELECT=(
# requires crate
tests/test_agatesql.py::TestSQL::test_to_sql_create_statement_with_dialects
)

View File

@@ -1,38 +0,0 @@
# Copyright 2021-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYPI_NO_NORMALIZE=1
PYTHON_COMPAT=( python3_{9..11} )
inherit distutils-r1 pypi
DESCRIPTION="Adds SQL read/write support to agate"
HOMEPAGE="
https://github.com/wireservice/agate-sql/
https://pypi.org/project/agate-sql/
"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm64-macos ~x64-macos"
RDEPEND="
>=dev-python/agate-1.5.0[${PYTHON_USEDEP}]
<dev-python/sqlalchemy-2[${PYTHON_USEDEP}]
"
BDEPEND="
test? (
dev-python/greenlet[${PYTHON_USEDEP}]
dev-python/lxml[${PYTHON_USEDEP}]
)
"
distutils_enable_tests pytest
EPYTEST_DESELECT=(
# requires crate
tests/test_agatesql.py::TestSQL::test_to_sql_create_statement_with_dialects
)

View File

@@ -1,38 +0,0 @@
# Copyright 2021-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYPI_NO_NORMALIZE=1
PYTHON_COMPAT=( python3_{10..11} )
inherit distutils-r1 pypi
DESCRIPTION="Adds SQL read/write support to agate"
HOMEPAGE="
https://github.com/wireservice/agate-sql/
https://pypi.org/project/agate-sql/
"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm64-macos ~x64-macos"
RDEPEND="
>=dev-python/agate-1.5.0[${PYTHON_USEDEP}]
>=dev-python/sqlalchemy-1.4[${PYTHON_USEDEP}]
"
BDEPEND="
test? (
dev-python/greenlet[${PYTHON_USEDEP}]
dev-python/lxml[${PYTHON_USEDEP}]
)
"
distutils_enable_tests pytest
EPYTEST_DESELECT=(
# requires crate
tests/test_agatesql.py::TestSQL::test_to_sql_create_statement_with_dialects
)

View File

@@ -1,75 +0,0 @@
From 90d5b8e220db51465e4dbac8df6e4bd4941c9ba6 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Tue, 26 Sep 2023 11:59:39 +1000
Subject: [PATCH] Migrate to SQLAlchemy 2
https://github.com/wireservice/agate-sql/pull/40
Remove the upper bound on SQLAlchemy by converting the code idioms in
use to support both SQLAlchemy 1.4 and SQLAlchemy 2, and only setting a
lower bound SQLAlchemy of >= 1.4.
Closes #39
diff --git a/agatesql/table.py b/agatesql/table.py
index b141937..e4efe91 100644
--- a/agatesql/table.py
+++ b/agatesql/table.py
@@ -82,2 +82,2 @@ def from_sql(cls, connection_or_string, table_name):
- metadata = MetaData(connection)
- sql_table = Table(table_name, metadata, autoload=True, autoload_with=connection)
+ metadata = MetaData()
+ sql_table = Table(table_name, metadata, autoload_with=connection)
@@ -113 +113 @@ def from_sql(cls, connection_or_string, table_name):
- s = select([sql_table])
+ s = select(sql_table)
@@ -182 +182 @@ def make_sql_table(table, table_name, dialect=None, db_schema=None, constraints=
- metadata = MetaData(connection)
+ metadata = MetaData()
@@ -276,2 +276,3 @@ def to_sql(self, connection_or_string, table_name, overwrite=False,
- if overwrite:
- sql_table.drop(checkfirst=True)
+ with connection.begin():
+ if overwrite:
+ sql_table.drop(bind=connection, checkfirst=True)
@@ -279 +280 @@ def to_sql(self, connection_or_string, table_name, overwrite=False,
- sql_table.create(checkfirst=create_if_not_exists)
+ sql_table.create(bind=connection, checkfirst=create_if_not_exists)
@@ -282,13 +283,14 @@ def to_sql(self, connection_or_string, table_name, overwrite=False,
- insert = sql_table.insert()
- for prefix in prefixes:
- insert = insert.prefix_with(prefix)
- if chunk_size is None:
- connection.execute(insert, [dict(zip(self.column_names, row)) for row in self.rows])
- else:
- number_of_rows = len(self.rows)
- for index in range((number_of_rows - 1) // chunk_size + 1):
- end_index = (index + 1) * chunk_size
- if end_index > number_of_rows:
- end_index = number_of_rows
- connection.execute(insert, [dict(zip(self.column_names, row)) for row in
- self.rows[index * chunk_size:end_index]])
+ with connection.begin():
+ insert = sql_table.insert()
+ for prefix in prefixes:
+ insert = insert.prefix_with(prefix)
+ if chunk_size is None:
+ connection.execute(insert, [dict(zip(self.column_names, row)) for row in self.rows])
+ else:
+ number_of_rows = len(self.rows)
+ for index in range((number_of_rows - 1) // chunk_size + 1):
+ end_index = (index + 1) * chunk_size
+ if end_index > number_of_rows:
+ end_index = number_of_rows
+ connection.execute(insert, [dict(zip(self.column_names, row)) for row in
+ self.rows[index * chunk_size:end_index]])
@@ -354 +356 @@ def sql_query(self, query, table_name='agate'):
- rows = connection.execute(q)
+ rows = connection.exec_driver_sql(q)
diff --git a/setup.py b/setup.py
index 3905203..7257399 100644
--- a/setup.py
+++ b/setup.py
@@ -37 +37 @@ setup(
- 'sqlalchemy<2',
+ 'sqlalchemy>=1.4',