diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-09-26 05:27:14 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-09-26 05:27:14 +0100 |
commit | 1aa38370b2506ce90ad64cd4e18968d6612ebea5 (patch) | |
tree | 6b1793ce3afd366d8591b0ef5106c1fb29c28380 /dev-python/agate-sql | |
parent | 04092be5ecd421ee24c421b2e57b6379f55e0ca1 (diff) |
gentoo auto-resync : 26:09:2023 - 05:27:14
Diffstat (limited to 'dev-python/agate-sql')
-rw-r--r-- | dev-python/agate-sql/Manifest | 2 | ||||
-rw-r--r-- | dev-python/agate-sql/agate-sql-0.5.9-r1.ebuild | 40 | ||||
-rw-r--r-- | dev-python/agate-sql/files/agate-sql-0.5.9-sqlalchemy.patch | 75 |
3 files changed, 117 insertions, 0 deletions
diff --git a/dev-python/agate-sql/Manifest b/dev-python/agate-sql/Manifest index 70375be8ccc0..9f63be1d15d7 100644 --- a/dev-python/agate-sql/Manifest +++ b/dev-python/agate-sql/Manifest @@ -1,3 +1,5 @@ +AUX agate-sql-0.5.9-sqlalchemy.patch 3565 BLAKE2B 97b1846e0b825c4fd4ac38e6eb773525be4c6be80b38f05d965177d21bd4744519a75282b90a9d78dc524a3f65a0c34cd9bb2d0a85d5bcea8a76844ed2ba2be8 SHA512 8124f08c2087aabfbe231d353c2eeda290c1bfe33c6f6137cadeabcc144168e8295ad492815fe4143bc64c11ea14a02556a243ac93389bcfaccd8e152cffc025 DIST agate-sql-0.5.9.tar.gz 15434 BLAKE2B 4825bfc5d0f78e0cd1bf318fe8797bfe03deaff1ffc962e0f082128af9d05afad97b7488d66b76d59411eb5dd889229be1fe05cf5bf55db4084f3451b21440b2 SHA512 482f257bb16e142d9380b9ae7590f50909639729e229271843686d6316ebfba0e77daac47e809b7aad4ef89d6c3810382d0b6817a418406bf73f13e266e5bcca +EBUILD agate-sql-0.5.9-r1.ebuild 847 BLAKE2B f2f1ff98f2d876353f74d0e563f448425d945b3df5b867ee662dfe6f303df3f55966a9da68a743ffa2a21d502f8fd66717b3f23e54926aaf68a68be6c1411f13 SHA512 2a71717220b7dfac06139526ced91d8c0135da0fdd8119b2b0fd540b2fc7647a6edae828819ff3cd2999da70db0181285634612fd0e02f763b250bee2a678e15 EBUILD agate-sql-0.5.9.ebuild 786 BLAKE2B 7e090d37390a6b2926198eb6f5fa96941f4ec536bc066e1fffbdddb1bb9edd8b99efd50bb05746c3ca888ffbb34d04c26ccb016c36406d6990e4558a02f3b04e SHA512 6a6a99e9667180cef8c0f7d5ea229d2c1d039978b05dcb7de65c879725743537423a2fb8e98190f88c358089125cd8dd713c49aa55235c13366c06d59f29d71c MISC metadata.xml 638 BLAKE2B aa62813cba6c3eb26352e63e05a9a5e00817049dec03befd4df97c6f7b1a01bc142440813c8ad5a67cdebc0e3cb72a8d272f96a59758547709bca11131092cee SHA512 916aea41b52015c5d57d052fc9908dc711a3e600b585dbb92f604846af9222243b7acddb04042e67567aefc9d7d976a69bbecf10e328691e04ac028dc58c5a08 diff --git a/dev-python/agate-sql/agate-sql-0.5.9-r1.ebuild b/dev-python/agate-sql/agate-sql-0.5.9-r1.ebuild new file mode 100644 index 000000000000..b74f616a7459 --- /dev/null +++ b/dev-python/agate-sql/agate-sql-0.5.9-r1.ebuild @@ -0,0 +1,40 @@ +# 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 +) diff --git a/dev-python/agate-sql/files/agate-sql-0.5.9-sqlalchemy.patch b/dev-python/agate-sql/files/agate-sql-0.5.9-sqlalchemy.patch new file mode 100644 index 000000000000..46a12ab68c9e --- /dev/null +++ b/dev-python/agate-sql/files/agate-sql-0.5.9-sqlalchemy.patch @@ -0,0 +1,75 @@ +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', |