Public-safe normalized rows for auditability.
| Issue | Bucket | Score | Linked | Labels | Excerpt |
|---|---|---|---|---|---|
| Issue #13420: oracledb async dialect enters cursors synchronously, silently breaking async cursor wrappers | has linked PR | 44 | PR #13421 | bug, task, oracle, asyncio | ### Describe the use case ### AsyncAdapt_oracledb_cursor._aenter_cursor uses sync __enter__() instead of async __aenter__() **Where:** https://github.com/sqlalchemy/sqlalchemy/blob/c8e26d5c9ffcde0a82b4b7fa5de27f0c6bc46bec/lib/sqlalchemy/dialects/oracle/oracledb.py#L754-L758 Compare to the base class it overrides, wh... |
| Issue #13419: catastrophic regex backtracking in sqlite inline UNIQUE reflection (ReDoS on get_unique_constraints) | has linked PR | 44 | PR #13398 | bug, reflection | ### Describe the bug `get_unique_constraints` on the SQLite dialect scans the stored `CREATE TABLE` text (taken verbatim from `sqlite_master.sql`) with an inline-`UNIQUE` regex whose tail is `[\t ]+[a-z0-9_ ]+?[\t ]+UNIQUE`. The lazy middle class itself contains a space, so all three quantifiers can lay claim to the... |
| Issue #13407: Cython batch instance processor — ~10–30% on most loads | has linked PR | 44 | PR #13405 | orm, performance | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/13378 <div type='discussions-op-text'> <sup>Originally posted by **ollz272** June 16, 2026</sup> Add `orm/_loading_cy.py` with `_InstancesBatch`, a whole-chunk row processor built by `_instance_processor()` for the non-refresh, non-polymorphic loa... |
| Issue #13406: use new _raw_all_tuples with subqueryloads | has linked PR | 44 | PR #13404 | orm, performance | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/13375 <div type='discussions-op-text'> <sup>Originally posted by **ollz272** June 16, 2026</sup> `_SubqCollections._load` iterated the `Query`, which routes through `Query.__iter__ -> result.unique()` and builds a `Row` object (plus runs the uniqu... |
| Issue #13357: Type check error when passing lists to `any_`/`all_` | needs maintainer decision | 28 | none | documentation, functions, typing | ### Ensure stubs packages are not installed - [x] No sqlalchemy stub packages is installed (both `sqlalchemy-stubs` and `sqlalchemy2-stubs` are not compatible with v2) ### Verify if the api is typed - [x] The api is not in a module listed in [#6810](https://github.com/sqlalchemy/sqlalchemy/issues/6810) so it should... |
| Issue #13311: Provide a many-table version for has_table | needs maintainer decision | 28 | none | reflection, performance, use case | ### Describe the use case This could be used for example to speed-up the check done by the `create_all` metadata something similar to the multi-reflection api, the method could be called `has_multi_table` discussed in #13295 ### Databases / Backends / Drivers targeted any ### Example Use ```py inspect(conn).has_muti... |
| Issue #13281: Modernize type annotations to PEP 604 union syntax | needs maintainer decision | 28 | none | typing | ## Summary SQLAlchemy now targets Python >= 3.10, so legacy `typing.Union` and `typing.Optional` annotations can be modernized to PEP 604 union syntax. Examples: - `Optional[T]` -> `T | None` - `Union[A, B]` -> `A | B` - `typing.Optional[T]` -> `T | None` - `typing.Union[A, B]` -> `A | B` ## Scope Audit and update P... |
| Issue #13253: im not sure we can type hybrid_methods fully | needs maintainer decision | 28 | none | bug, quagmire, typing | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/13249 trying to do this, cannot get any typing combination to be accepted by pyright much less mypy: ```py from typing import overload from sqlalchemy import func, Integer, column from sqlalchemy import select from sqlalchemy.ext.hybrid import hyb... |
| Issue #13227: WriteOnlyMapped: default_factory=list broken in 2.1 due to new declarative_scan validation | has linked PR | 44 | PR #13289 | orm, use case | ### Describe the bug The new `default_factory` validation introduced in commit [95ad9fe](https://github.com/sqlalchemy/sqlalchemy/commit/95ad9fe42b888d7cdea60b7a71c833cbb8667887) (related to #12168) breaks `WriteOnlyMapped` relationships that use `default_factory=list` in Declarative Dataclass Mapping. ### Optional... |
| Issue #13212: Support for native JSON in mssql | needs maintainer decision | 28 | none | SQL Server, datatypes, use case | ### Describe the use case Sql server 2025 seems to have added native json support https://learn.microsoft.com/en-us/sql/t-sql/data-types/json-data-type?view=sql-server-ver17 I guess we should decide what to do with the existing JSON type: https://docs.sqlalchemy.org/en/20/dialects/mssql.html#sqlalchemy.dialects.mssq... |
| Issue #13210: Applying a loader option to a parent relationship when using with_polymorphic does not work properly | needs maintainer decision | 28 | none | bug, orm, loader options | > Asked claude to fuzz this and it did find a similar case, let me know if you prefer me to open another issue or if we should re-open this one. Seem very similar: it accesses the parent relationship via `poly.Cls.parent_rel` that's similar to what was fixed here `poly.Cls.cls_rel` > > while strange I think it shoul... |
| Issue #13204: Immediateload fails to load when combined with inheritance | needs maintainer decision | 28 | none | bug, orm, loader options, fuzzer | There are a couple of cases where immediateload fails when using inheritance on relationships: - loading using immediateload a relationship on an inheritance chain that's being loaded via eager loading: `select(Meta).option(anyloader(Meta.parent_cls).immediateload(ParentCls.relationship))` - loading using immediatel... |
| Issue #13169: Connection pool soft invalidation uses `time.time()` comparison that can silently fail on low-resolution clocks (e.g. Windows ~16 ms) | has linked PR | 44 | PR #13288 | connection pool, use case | In `lib/sqlalchemy/pool/base.py`, `_ConnectionRecord.get_connection` detects soft invalidation via: ```python # base.py, line 852 elif self._soft_invalidate_time > self.starttime: do_connect = True ``` `_soft_invalidate_time` is set with `time.time()` (line 812) and `starttime` is also set with `time.time()` (line 8... |
| Issue #13157: PostgreSQL check constraint reflection strips brackets naively | has linked PR | 62 | PR #13303 | bug, postgresql, reflection, great mcve | ### Describe the bug Check constraint reflection strips brackets from some expressions such that they are syntactically invalid ### Optional link from https://docs.sqlalchemy.org which documents the behavior that is expected _No response_ ### SQLAlchemy Version in Use 2.0.48 ### DBAPI (i.e. the database driver) psyc... |
| Issue #13153: `composite` with in-place custom values getter | needs maintainer decision | 28 | none | orm, use case | ### Describe the use case Currently, nested composites or custom classes require implementing `__composite_values__`, which is not always an option. Internally there is `_generated_composite_accessor` which is generated if no such method provided. I suggest adding `values_getter` as an argument to `composite()` so i... |
| Issue #13113: SQLite insert supports multiple on-conflict clauses in inserts | needs maintainer decision | 28 | none | sqlite, use case, dml | ### Describe the use case Apparently sqlite supports multiple on-conflict clauses in inserts: https://sqlite.org/lang_upsert.html > If the insert operation would cause the conflict target uniqueness constraint to fail, then the insert is omitted and the corresponding DO NOTHING or DO UPDATE operation is performed in... |
| Issue #13049: Provide an implementation for avg / abs function with proper type | has linked PR | 44 | PR #13051 | functions, use case | ### Describe the use case Currently `avg` and `abs` do not have an implementation in the functions module Since these are fairly common i thing we could provide an implementation so that the correct type can be inferred. - avg is numeric (or Double) - abs instead derives its type from the input ### Databases / Backe... |
| Issue #13048: Add option for disabling automatic addition of constraint/indexes to the table | has linked PR | 44 | PR #13399 | schema, use case | ### Describe the use case Add a flag in the constraints and index to prevent them from automatically being added to the table collections. They can be added manually either by providing them to the table constructor or using the table methods to add constraints ### Databases / Backends / Drivers targeted Any ### Exa... |
| Issue #13007: Change the default to False of addconstraint / dropconstraint isolate_from_table | stale/low urgency | 2 | none | schema, use case | Follow up of #13006 Set to False the default value and remove the warning |
| Issue #12972: Move asyncio out of ext into the library proper | stale/low urgency | 2 | none | use case, asyncio | a long term solution would be to pull the asyncio extension out of the .ext/ namespace so that the imports would be `from sqlalchemy.asyncio import create_async_engine` and `from sqlalchemy.orm.asycnio import AsyncSession`. Then `sqlalchemy.ext.asyncio` would be a compatibility shim that isn't needed, the same way D... |
| Issue #12803: Expose Two Phase Transaction in async layer | stale/low urgency | 2 | none | use case, asyncio | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/12797 <div type='discussions-op-text'> <sup>Originally posted by **OscarRomaFever** August 12, 2025</sup> Hi! I would like to know if it is possible to manage a Two-Phase Commit (2PC) transaction using asynchronous connections with PostgreSQL in S... |
| Issue #12710: add extra shielding to async connection create | stale/low urgency | 2 | none | bug, engine, asyncio | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/12709 Locally I can only reproduce this using a trusted connection against a PG database running in a local container, which I can run like this: podman run -d --rm -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=... |
| Issue #12689: WriteOnlyScalar companion to WriteOnlyMapped (which would be Collection?) , as WOM suits an async use case that applies to scalars as well | stale/low urgency | 2 | none | orm, use case | ### Describe the use case Traditional strategies ('select', 'raise', 'subquery') for accessing a lazy-loaded relationship relationship don't work in an async context, as the database call loading the related instance yields to the event loop before a necessarily synchronous attribute access would otherwise return. T... |
| Issue #12628: Add support for MariaDB Vector data type | stale/low urgency | 2 | none | oracle, datatypes, use case, mariadb | ### Describe the use case MariaDB has introduced a new Vector data type in version 11.7. Details can be found here: https://mariadb.org/projects/mariadb-vector/ The main issue I'm running into now is that reflection fails when reflecting on any table that has a vector column. The reflection fails to retrieve the col... |
| Issue #12585: support SQLite .autocommit=False mode, improve documentation | stale/low urgency | 2 | none | task, sqlite, big job | ### Describe the use case see https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.autocommit for the new feature (which was many years in the making) from discussion at https://github.com/sqlalchemy/alembic/issues/1655 : 1. SQLAlchemy's documentation needs to be updated to reflect that the "correct tra... |
| Issue #12575: prefixing Composite Column Types | stale/low urgency | 2 | none | orm, use case | ### Describe the use case ```python @dataclasses.dataclass class Person: first_name: int last_name: str # ... class Housing(Base): person: composite(Person, column_prefix='person') ``` would result in mapped column names `person_first_name` and `person_last_name` right now, the API is a bit verbose and hard to read:... |
| Issue #12561: Recover two-phase in mysql is currently unusable since it uses a legacy row index method | stale/low urgency | 2 | none | bug, mysql, mariadb | This has likely been broken since v2 https://github.com/sqlalchemy/sqlalchemy/blob/a84444fca1c436179ad847ce99e8a013a84b5b33/lib/sqlalchemy/dialects/mysql/base.py#L2772-L2774 Apparently there is no test that covers this |
| Issue #12398: Add existing strategy to conflicting strategies error message | has linked PR | 26 | PR #12401 | orm, use case | ### Describe the use case I just received the following error of in my project and have an improvement request similar to #10668 : ``` sqlalchemy.exc.InvalidRequestError: Loader strategies for ORM Path[Mapper[Cable(cable)] -> Cable.cablesides -> Mapper[CadCableSide(cad_cable_side)]] conflict ``` While this tells me... |
| Issue #12341: Add dialect-specific support for Oracle's FETCH EXACT/APPROXIMATE | stale/low urgency | 2 | none | oracle, use case | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/12337 support for FETCH EXACT/APPROXIMATE feature described at https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/SELECT.html#GUID-CFA006CA-6FF1-4972-821E-6996142A51C6__BABBADDD |
| Issue #12186: Improve `eager_default=True` behavior in insert / updates | stale/low urgency | 2 | none | orm, unit of work, use case, eager_defaults | ## update Currently `eager_default=True` in case of an update of multiple rows does the following: - when the driver supports returning, runs single updates with returning, one for each row. Results in n queries - when the driver does not support returning, runs execute many updates and one select for each rows. Res... |
| Issue #12101: Better support of locking clauses (FOR UPDATE/SHARE) when supported | needs maintainer decision | 28 | none | postgresql, oracle, use case | ### Describe the use case The [Postgres docs](https://www.postgresql.org/docs/17/sql-select.html) specifically say that you should be able to have both a FOR UPDATE and a FOR SHARE in the same query: > Multiple locking clauses can be written if it is necessary to specify different locking behavior for different tabl... |
| Issue #12097: can't adapt type for enum in case() | stale/low urgency | 2 | none | question, documentation, expected behavior, law of twos | ### Describe the bug I can't use an enum type as part of a `case()` without casting. Looks very similar to https://github.com/sqlalchemy/sqlalchemy/issues/6515 ### Optional link from https://docs.sqlalchemy.org which documents the behavior that is expected _No response_ ### SQLAlchemy Version in Use 2.0.36 ### DBAPI... |
| Issue #12096: delete with join and returning clause doesn't work on SQLAlchemy 2 | stale/low urgency | 2 | none | bug, orm, hard orm, dml | ### Describe the bug I have a statement like the following, which works on SQLAlchemy 1.4 but not on 2.0 ```python delete(Author).where(Author.id == Book.author_id).returning(Book.title) ``` ### Optional link from https://docs.sqlalchemy.org which documents the behavior that is expected https://docs.sqlalchemy.org/e... |
| Issue #11686: Unexpected relationship kwarg with mypy from a mixin | stale/low urgency | 2 | none | dataclasses, typing | ### Ensure stubs packages are not installed - [X] No sqlalchemy stub packages is installed (both `sqlalchemy-stubs` and `sqlalchemy2-stubs` are not compatible with v2) ### Verify if the api is typed - [X] The api is not in a module listed in [#6810](https://github.com/sqlalchemy/sqlalchemy/issues/6810) so it should... |
| Issue #11677: SQLITE: SQLiteDialect.get_check_constraints incorrectly reflects multiline check constraints | stale/low urgency | 2 | none | bug, sqlite, reflection, quagmire, law of twos | ### Describe the bug The `get_check_constraints` method of SQLiteDialect, does not correctly handle multi line CHECK constraints in SQLAlchemy reflection. When performing a alembic batch_op for example, multi line check constraints will not be or wrongly reflected and can result in SQL errors. ### Optional link from... |
| Issue #11623: omit column_property from rendering inside subquery() / CTE() ? | stale/low urgency | 2 | none | orm, performance, expected behavior | ### Describe the bug Given a model `A` with a column_property `B`, a query that loads an `aliased` of `A` will emit the `B` expression multiple times (exact number depends on the complexity of the query). ### Optional link from https://docs.sqlalchemy.org which documents the behavior that is expected _No response_ #... |
| Issue #11620: Deprecate MSSQL enable_identity_insert by default, gate it behind a flag | has linked PR | 44 | PR #12297 | sql, SQL Server, fairly easy | Discussed in #11613 Add a boolean flag in the mssql dialect, the default will be set to `warn` meaning that a warning will be raised when `_enable_identity_insert` is detected set to true. User can opt into the current behaviour or disable it |
| Issue #11597: sqltypes.Enum not generic enough | stale/low urgency | 2 | none | bug, datatypes, typing | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/11548 The generic type for `Enum` needs to be a typevar for pyright: ```py from __future__ import annotations import enum from sqlalchemy import Enum from sqlalchemy import func from sqlalchemy.orm import column_property from sqlalchemy.orm import... |
| Issue #11536: support module-qualified paths inside of Mapped[], including with/without future mode / pep563 etc | stale/low urgency | 2 | none | orm, use case, orm - annotated declarative | ### Describe the bug When using PEP563 postponed annotations (i.e. `from __future__ import annotations`), mapped classes with the same name in different modules cannot be used in relationships using type annotations alone. For example, if `mod1` and `mod2` both contain mapped classes called `Model`, then `attr: Mapp... |
| Issue #11385: Add additional information to the `ReflectedColumn` | stale/low urgency | 2 | none | reflection, use case | The reflected column dict https://docs.sqlalchemy.org/en/20/core/reflection.html#sqlalchemy.engine.interfaces.ReflectedColumn includes only the already reflected type instance from the dialect. This means that for unknown sql types, the sqlalchemy nulltype is provided, losing any information about what was reflected... |
| Issue #11312: reflecting oracle synonym of synonym over dblink | good volunteer slice | 20 | none | oracle, reflection, PRs (with tests!) welcome | ### Describe the bug I get a table not found error when trying to reflect a synonym of a synonym on a dblink. I try reflecting the table as such ``` self._engine = sql.create_engine(uri, echo='debug') sql.Table(table_name, self._metadata, schema=self._schema, autoload_with=self._engine, oracle_resolve_synonyms=True)... |
| Issue #11284: Missing batch_op.f() | stale/low urgency | 2 | none | bug, documentation, tests, schema | ### Discussed in https://github.com/sqlalchemy/alembic/discussions/1458 the [conv](https://docs.sqlalchemy.org/en/20/core/constraints.html#sqlalchemy.schema.conv) construct applies truncation rules to identifiers, and users are using it this way. We can't change that, so document it and ensure unit tests are present... |
| Issue #11136: Delete Propagation to Parent Table for Joined Table Inheritance | waiting on contributor | 0 | none | awaiting info, use case | ### Describe the use case When a polymorphic table is created via joined table inheritance, I would expect that deleting a row in the subclass table would also delete the row in the parent table. I've found that when the subclass row is explicitly deleted, the delete propgates to the parent table as I would expect.... |
| Issue #11132: MySQL DOUBLE accepts deprecated params that dont propagate from the base DOUBLE type, document this caveat | has linked PR | 44 | PR #13368 | documentation, mysql, datatypes, PRs (with tests!) welcome | ### Describe the bug Hi im trying to get startet with sql alchemy and alembic and just found a bug. during the translation of a double precision=17, and decimal_return_scale=7 into mysql i always get an exception. `sqlalchemy.exc.ArgumentError: You must specify both precision and scale or omit both altogether.` When... |
| Issue #11122: Postregresql create table add "with" argument | has linked PR | 44 | PR #11296 | postgresql, PRs (with tests!) welcome, use case | ### Describe the use case In postgresql documentation (https://www.postgresql.org/docs/current/sql-createtable.html) create table have the "with" option that is not supported by sqlalchemy currently. The change is simple: https://github.com/sqlalchemy/sqlalchemy/commit/45b70d4e7c0ac31005f8a93253fe477dfc27afb4 ### Da... |
| Issue #11062: Could not de-stringify annotation | stale/low urgency | 2 | none | documentation, orm, orm - annotated declarative | ### Describe the bug Hey, the following code raises an `NameError: Could not de-stringify annotation 'long str'`. But as soon as I changed `Annotated[str, "long str"]` to `Annotated[str, "long_str"]` it works. Any idea about what's going on here? fin swimmer ### Optional link from https://docs.sqlalchemy.org which d... |
| Issue #10960: "implicit combining column" warning not emitting for two columns from two different aliases against same parent table | stale/low urgency | 2 | none | bug, orm | ### Describe the bug ## Description The following code yields a strange result. I'm expecting `bar_1`, `bar_2`, and `bar_3` to be mapped as `CompositeBar(value_1="a", value_2="b")`, `CompositeBar(value_1="c", value_2="d")`, and `CompositeBar(value_1="e", value_2="f")` respectively, but actually it ended up with ever... |
| Issue #10936: post_update double UPDATE on delete of object with bi-directional | stale/low urgency | 2 | none | bug, quagmire, unit of work, post-update | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/10934 looks like this was never tested. might not have an immediate solution ```py def test_no_double_update_on_delete_bidirectional_post_update(self): person, ball, Ball, Person = ( self.tables.person, self.tables.ball, self.classes.Ball, self.cl... |
| Issue #10888: OrderingList typing incorrect / incomplete and implementation doesn't accept non-int indices | good volunteer slice | 20 | none | sqlalchemy.ext, PRs (with tests!) welcome, typing | ### Describe the bug There are a number of issues with the sqlalchemy.ext.orderinglist:OrderingList type hints and implementation: 1. The ordering function is documented as being allowed to return any type of object, and the tests demonstrate this by returning strings. The type annotation requires it to return integ... |
| Issue #10859: move lazy="select" to lazy="mapper_default"; add mapper "default_lazy" | stale/low urgency | 2 | none | feature, orm | this can come in alongside #4641 this would make a change to `relationship` such that it does not set up `strategy_key` until mapper config stage, where it gets a look at its parent mapper. should be mentioned in docs particularly here: https://github.com/sqlalchemy/sqlalchemy/blob/d9ed5cb521d5e7a2b62646b43eaebc1ccf... |
| Issue #10835: sqlalchemy.util.OrderedSet does not work with v2 in ORM mappings | stale/low urgency | 2 | none | bug, cextensions, orm - annotated declarative | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/10833 This apparently was possible in 1.4 but not in 2.0 when cython extensions are built: ```py # sqlalchemy 2.0.25 from sqlalchemy import ForeignKey from sqlalchemy import inspect from sqlalchemy.orm import DeclarativeBase from sqlalchemy.orm im... |
| Issue #10780: name with flat for aliased() | stale/low urgency | 2 | none | sql, use case | ### Describe the use case aliased() currently prohibits a name in conjunction with `flat=True`. Presumably this is because it would require some arbitrary naming convention. In reality, `flat=True` already has an arbitrary naming convention (suffix with numbers) which is useful for the query compiler, but not so muc... |
| Issue #10748: schemes that attempt to reload modules are blocked by the inspection registry | has linked PR | 62 | PR #13402 | bug, orm, PRs (with tests!) welcome, external library/application issues | ### Describe the bug There's a nasty interaction between the following: * some import-time caching in SQLAlchemy (in [`sqlalchemy.inspection._registrars`](https://github.com/sqlalchemy/sqlalchemy/blob/66be1482db06adb908432b2e3b41d9393d1319f7/lib/sqlalchemy/inspection.py#L53)), * the way Coverage.py handles editable... |
| Issue #10742: Bad PrimaryKeyConstraint metadata for MSSQL temporary table | stale/low urgency | 2 | none | bug, SQL Server, reflection | ### Describe the bug If I create a temporary table (name starting with a `#`) using MSSQL, then inspect the table metadata, it has a constraint `{PrimaryKeyConstraint()}`. However, none of the columns are detected as primary keys and the primary key constraint has no name. The names of the primary key constraints ar... |
| Issue #10680: upgrade default driver for psycopg, oracledb | stale/low urgency | 2 | none | use case, dialects | The current default drivers selection for some database is outdated or not really useful anymore. An idea for 2.1 is to start raising a deprecation warning when a default drivers is selected. Optionally the default behaviour is something that can be kept were it makes sense. In particular oracle and sqlite seem the... |
| Issue #10676: Add reasonable min version for the internal dialects packages / databases | needs maintainer decision | 28 | none | setup | Will compile a table with min version. Let's target at least 2 years for dialect packages and something sensible for the databases Databases |db | best_effort | normal |full| notes | |---|-------------|--------|----|-------| |mssql|2005 -> 2008| - | -|remove warning on _setup_version_attributes| |mysql|5.0.2->5.1|-|... |
| Issue #10675: syntax error with mysql bulk update via INSERT ... SELECT ... ON DUPLICATE KEY UPDATE | good volunteer slice | 38 | none | bug, mysql, PRs (with tests!) welcome, dml | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/10514 <div type='discussions-op-text'> <sup>Originally posted by **anentropic** October 20, 2023</sup> I am trying to bulk update via an insert on duplicate, but using `from_select` (instead of list of values as seen here https://github.com/sqlalc... |
| Issue #10617: Improve how `Select.refresh` works with relationships | stale/low urgency | 2 | none | orm, use case | Since version 1.4 that added support for relationship refresh, the implementation is sub-optimal, since it will always perform a query to the model table, followed by a query to the related table. ```py from __future__ import annotations from sqlalchemy import create_engine from sqlalchemy import ForeignKey from sql... |
| Issue #10544: pysqlcipher open fail with err: TypeError: function takes at most 3 arguments (4 given) in dbapi_connection.create_function | stale/low urgency | 2 | none | bug, sqlite | ### Describe the bug using windows and pysqlcipher in python 3.11 get error to create engine with very basic usage ### Optional link from https://docs.sqlalchemy.org which documents the behavior that is expected _No response_ ### SQLAlchemy Version in Use 2.0.22 ### DBAPI (i.e. the database driver) pysqlcipher ### D... |
| Issue #10541: Improve scalars performance by trying to avoid the creation of a Row | needs maintainer decision | 28 | none | performance, result fetching API improvements | The current code when executing something like `conn.execute(...).scalars().all()` will create a Row object, at least in some cases, that is then discarded. The code should try to avoid doing the unnecessary row creation |
| Issue #10531: Issue with relationship typing when using Declarative-Imparative Mapping | waiting on contributor | 0 | none | bug, documentation, awaiting info, orm - annotated declarative | ### Describe the bug Hi :wave: First of all thank you for the huge amount of work done on SQLAlchemy, I really enjoy using this library :rocket: I'm trying to implement a many-to-many relationship (like explained [here](https://docs.sqlalchemy.org/en/20/orm/basic_relationships.html#setting-bi-directional-many-to-man... |
| Issue #10527: Wrong typing for `with_for_update()`'s `of` argument. | good volunteer slice | 38 | none | bug, PRs (with tests!) welcome, typing | ### Ensure stubs packages are not installed - [X] No sqlalchemy stub packages is installed (both `sqlalchemy-stubs` and `sqlalchemy2-stubs` are not compatible with v2) ### Verify if the api is typed - [X] The api is not in a module listed in [#6810](https://github.com/sqlalchemy/sqlalchemy/issues/6810) so it should... |
| Issue #10446: Support synonym with bulk_insert_mappings and insert | stale/low urgency | 2 | none | orm, use case, dml | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/10439 <div type='discussions-op-text'> <sup>Originally posted by **flyly0755** October 9, 2023</sup> There is such a situation, data of different sources need to insert to one table, but the data column is a little different, for example: Data fro... |
| Issue #10435: sql server metadata.reflect() fails if your SQL Server connection uses "tempdb" as the primary connection's database | stale/low urgency | 2 | none | SQL Server, reflection | ### Describe the bug When trying to fetch all the tables from a MSSQL database (clean database via Docker https://hub.docker.com/_/microsoft-mssql-server) with the MetaData().reflect(bind=engine) it raises a NoSuchTableError on a temporary table (starting with a #) that indeed does not exist. This worked on SQLAlche... |
| Issue #10417: mypy: coerced legacy syntax with subquery can not be typed | stale/low urgency | 2 | none | wontfix / out of scope, expected behavior, typing | ### Describe the bug I found a typing oddity with 2.0 that is not in the guide. Legacy code utilizing a `Session().query().subquery()` will run fine (and emit warnings that is it making a coercion) - but does not pass mypy becauce of the coercion. I'm not sure if this is a typing bug or not, as the legacy format is... |
| Issue #10380: Declaring Composite Column Types as Optional leads to NULL data type for constituent columns in table definition | stale/low urgency | 2 | none | bug, orm, orm - annotated declarative | ### Describe the bug I was going through the tutorial for adding composite column types where sets of columns can be associated with a single user-defined datatype (FYR https://docs.sqlalchemy.org/en/20/orm/composites.html#composite-column-types). I tweaked the example a bit to make the composite column types option... |
| Issue #10351: allow Nullable to be used with column_property() | stale/low urgency | 2 | none | orm, use case, typing | ### Ensure stubs packages are not installed - [X] No sqlalchemy stub packages is installed (both `sqlalchemy-stubs` and `sqlalchemy2-stubs` are not compatible with v2) ### Verify if the api is typed - [X] The api is not in a module listed in [#6810](https://github.com/sqlalchemy/sqlalchemy/issues/6810) so it should... |
| Issue #10341: add official API to have naming conventions work for alternate constraint types | good volunteer slice | 20 | none | schema, naming conventions, PRs (with tests!) welcome | Using them is poorly tested and the use case seems quite limited. |
| Issue #10335: Support `Final[Mapped[...]]` in the ORM | good volunteer slice | 20 | none | orm, PRs (with tests!) welcome, orm - annotated declarative | In some cases generics are consired invariant since the mapped descriptors are not declared as final. While this use case for this is likely very small, it should not be too hard to support the following form: ```py from sqlalchemy import ForeignKey from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column,... |
| Issue #10326: Allow InstrumentedAttribute in corresponding_column | stale/low urgency | 2 | none | sql, use case | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/10325 <div type='discussions-op-text'> <sup>Originally posted by **CaselIT** September 8, 2023</sup> Currently InstrumentedAttribute is not a KeyedColumnElement so trying to use `corresponding_column` and similar raises a typing error This does no... |
| Issue #10310: Select Values in Mysql | good volunteer slice | 20 | none | mysql, sql, PRs (with tests!) welcome, use case | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/10309 <div type='discussions-op-text'> <sup>Originally posted by **RasulGafarov** September 4, 2023</sup> The following code: ``` my_select = select( Values( sqlalchemy.column("column_1", String), sqlalchemy.column("column_1", String), name="temp_... |
| Issue #10116: re-entrant handle_error call if an exception is raised in result.all() within a DML process | stale/low urgency | 2 | none | bug, documentation, engine | this is from https://review.opendev.org/c/openstack/oslo.db/+/888580 so far, the reproducer so far is this docker container: ``` FROM ubuntu:22.04 SHELL ["/bin/bash", "-c"] RUN apt-get update && apt-get install -y python3 tox git WORKDIR /root RUN git clone --depth 1 https://opendev.org/openstack/barbican WORKDIR /r... |
| Issue #10094: document asyncio gotchas so far | stale/low urgency | 2 | none | documentation, asyncio | - gether is messy to use with multiple sessions not created inside the task. Ref https://github.com/sqlalchemy/sqlalchemy/discussions/9312#discussioncomment-6419638 |
| Issue #10064: MappedAsDataclass, prohibit constructor use and/or creation for non-mapped classes, abstract, mixins | stale/low urgency | 2 | none | bug, dataclasses, orm - annotated declarative | see #10027. MappedAsDataclass basically cannot support the dataclass "init" feature on a class that isn't mapped, and likely can't support *any* dataclass features on such a class as instantiated. Propose instantiation of mixins / abstract emit a warning if they are also "dataclass" produced under 2.0, error in 2.1. |
| Issue #9944: Reflect don't recognize foreign tables in postgresql | stale/low urgency | 2 | none | postgresql, schema, reflection, use case | ### Describe the use case Currently, when I call the MetaData().reflect() function, the foreign tables are not reflected. It would be interesting to have an argument in the function to be able to search for foreign tables as well. This way facilitates DML operations on foreign tables. ### Databases / Backends / Driv... |
| Issue #9930: need docs /warnings that `__init__` is not called on load | high-priority/blocker | 52 | none | documentation, high priority, orm | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/9928 since we retired https://docs.sqlalchemy.org/en/20/orm/constructors.html#mapping-constructors this information has been lost. also update links to that page such as https://docs.sqlalchemy.org/en/20/orm/events.html#sqlalchemy.orm.InstanceEven... |
| Issue #9839: document network-related caveats for insertmanyvalues | stale/low urgency | 2 | none | documentation, SQL Server, performance, insertmanyvalues | ### Describe the bug We upgraded our sql alchemy version and observed a massive spike in execution time on the database. We are bulk uploading several 100k rows. We are using sql server on azure and pyodbc. We believe it relates to changes made in https://github.com/sqlalchemy/sqlalchemy/issues/9603 or https://githu... |
| Issue #9833: Ignore classvar attributes defined in declarative classes | stale/low urgency | 2 | none | orm, use case, orm - annotated declarative | Something that certainly **should** work, but does not, is to declare the type as a ``ClassVar[]``, since we scan these also in declarative: ```py class AlertItem2(Base): __tablename__ = "alert_items2" id = Column(BigInteger, primary_key=True, autoincrement=True) signature = Column(String) data_source_model_id = Col... |
| Issue #9693: Text type columns using schema qualified collations compile a quoted DDL statement on Postgres | has linked PR | 44 | PR #12697PR #13418 | postgresql, schema, datatypes, PRs (with tests!) welcome, use case | ### Describe the bug If you use a `Text` type that includes a fully schema qualified collation (ie. `Text(collation="my_schema.my_collation")`), the DDL statement created when running `metadata.create_all()` is incorrect for Postgres. The statement created presently is: `TEXT COLLATE "my_schema.my_collation"` Which... |
| Issue #9690: reroute group_by coercion to expand fromclause using ORM-enabled plugin points | stale/low urgency | 2 | none | orm, sql, use case | ### Describe the bug What I want to do is to associate an ORM entity _USER_ with columns of FromClause produced by subquery() as described in tutorial. But when I use associated \<AliasedClass\> instance in group_by() of new _stmt_ it 'unpacks' all columns that are selected in a subquery instead of unpacking just Us... |
| Issue #9587: Use python type in Mapped to boolean expression catching thinks like `Mapped[int] == 'a string'` | stale/low urgency | 2 | none | use case, typing | ### Ensure stubs packages are not installed - [X] No sqlalchemy stub packages is installed (both `sqlalchemy-stubs` and `sqlalchemy2-stubs` are not compatible with v2) ### Verify if the api is typed - [X] The api is not in a module listed in [#6810](https://github.com/sqlalchemy/sqlalchemy/issues/6810) so it should... |
| Issue #9548: relationship loader options do a "recursive" thing inconsistently | high-priority/blocker | 52 | none | bug, high priority, orm, loader options | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/9528 the wildcard option '*' acts recursively in some sitiuations (with no way to not be recursive) and non-recursively in others: ```py from sqlalchemy import Column from sqlalchemy import create_engine from sqlalchemy import ForeignKey from sqla... |
| Issue #9493: MappedAsDataclass inherits dataclasses attributes, while the spec says they don't | good volunteer slice | 20 | none | bug, orm, PRs (with tests!) welcome, dataclasses, orm - annotated declarative | We also seem to make inherit dataclasses attributes, while we probably should not. Not sure if it's connected to this other issue #9350 ```py from dataclasses import dataclass import sqlalchemy as sa import sqlalchemy.orm as sao import inspect class Base(sao.MappedAsDataclass, sao.DeclarativeBase, kw_only=True): pas... |
| Issue #9468: Implementation for get_unique_constraints for MS SQL Server | needs maintainer decision | 28 | none | SQL Server, reflection, use case | ### Describe the use case It would be useful to have the method [Inspector.get_unique_constraints](https://github.com/sqlalchemy/sqlalchemy/blob/rel_2_0_5/lib/sqlalchemy/engine/interfaces.py#L1562) implemented for SQL Server. My immediate use case is that alembic [uses this method](https://github.com/sqlalchemy/alem... |
| Issue #9425: tighten up compoundselect + textualselect use cases | stale/low urgency | 2 | none | bug, sql | The following is not allowed ```py t = sa.Table( "x", sa.MetaData(), sa.Column("a", sa.Integer), sa.Column("b", sa.Integer) ) sql = """ SELECT 1 as x, 2 as y UNION ALL SELECT 3, 4 """ q = sa.select(t).union_all(sa.text(sql)) ``` but it seems to render correctly if the coerce is removed for debug |
| Issue #9410: document dataclass gotchas so far | good volunteer slice | 20 | none | documentation, PRs (with tests!) welcome, dataclasses | 1. relationship = None issue : #9383 , #9856 - issue created: https://github.com/sqlalchemy/sqlalchemy/issues/12168 2. declared_attr on a mixin w/ dataclasses: #9408 3. order matters regarding the default value and init generated. this all comes from dataclasses, but it may be worth reiterate that 4. mention that al... |
| Issue #9370: Create a way to run all the examples in the pipeline | stale/low urgency | 2 | none | bug, tests | There are some examples that are not compatible with 2.0, like nested sets https://github.com/sqlalchemy/sqlalchemy/blob/8b108297d075ae68178cd18a9cb4d06feee7e075/examples/nested_sets/nested_sets.py#L56-L73 Creating a way of running the tests as part of the pipeline work help avoiding having old examples laying around |
| Issue #9369: allow_unmapped seems to not be honored in all cases | stale/low urgency | 2 | none | bug, orm, orm - annotated declarative | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/9368 ```py from typing import List from sqlalchemy import Column, ForeignKey from sqlalchemy.orm import relationship from sqlalchemy.types import Integer from sqlalchemy.orm import declarative_base # qualify the base with __allow_unmapped__. Can a... |
| Issue #9348: modify expunge() operation in uow to cascade along delete-orphan in addition to expunge | stale/low urgency | 2 | none | bug, orm, unit of work | ### Describe the bug In SQLAlchemy, when adding new objects to relationship with default cascades and then deleting them, they are kept inside session and then inserted on flush. But when having delete-orphan cascade, the desired behavior is to remove relative object from session as it is removed from relationship c... |
| Issue #9301: Support mapped attributes that have deferred definitions | stale/low urgency | 2 | none | documentation, orm, use case, typing | ### Describe the use case In multiple cases it may be required to assign to a mapped class an attribute after the class definition, to for example break circular imports or similar, that is usually done by assigning the attribute to the class `ModelCls.attribute_lazy = ...` This is currently a bit awkward to impleme... |
| Issue #9233: Expression index does not list all the columns | stale/low urgency | 2 | none | bug, schema | ### Describe the bug Only the first column in an expression is considered ### To Reproduce ```python import sqlalchemy as sa def go(idx): sa.Table( "x", sa.MetaData(), sa.Column("x", sa.Integer), sa.Column("y", sa.Integer), idx, ) print([str(c) for c in idx.columns]) go(sa.Index("x", sa.func.div(sa.column("x"), sa.c... |
| Issue #9213: document `@classmethod` add for all `@declared_attr` to work w/ typing | stale/low urgency | 2 | none | documentation, typing | ### Describe the typing issue Next issue, it seems I get an error when using a `Mapped` class attribute in `Index`. ### To Reproduce Stripped down version of what I'm running: ```python @sa.orm.declarative_mixin class _Rhyme: __tablename__: str ph1: Mapped[int] ph2: Mapped[Optional[int]] @sa.orm.declared_attr def __... |
| Issue #9212: add additional type migration section to whatsnew detailing declared_attr format changes, others | good volunteer slice | 20 | none | documentation, orm, PRs (with tests!) welcome, typing | ### Describe the typing issue I'm going through a small project with strict type checking, so will probably end up opening a few nitpick issues. It still seems difficult to me at the moment, to figure out what types should be used for certain annotations. Maybe a new page in the docs could be added to list these typ... |
| Issue #9197: Support for mapping frozen dataclasses | stale/low urgency | 2 | none | orm, use case, dataclasses | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/9192 Using frozen dataclasses may be useful in some cases, but implementing it will be non trivial. See mike [reply in the discussion](https://github.com/sqlalchemy/sqlalchemy/discussions/9192#discussioncomment-4820606) |
| Issue #9154: 11 test failures with PyPy3.9 7.3.11 in 2.0.0 (and git main) | needs maintainer decision | 28 | none | tests, pypy | ### Describe the bug When running the test suite (as of 6779fa861d11668f67d780d77e4ae76965cee6f7) under PyPy3.9 7.3.11, I get the following test failures: ``` FAILED test/ext/test_associationproxy.py::DictOfTupleUpdateTest::test_update_multi_elem_varg - AssertionError: 'update expected at most 1 arguments?, got 2' !... |
| Issue #9147: declarative builds permanent strong ref to classes that use declare_first or declare_last | stale/low urgency | 2 | none | bug, orm, declarative | the event hook here: https://github.com/sqlalchemy/sqlalchemy/blob/689ebc30dcd6b9cedf01d729f748b31826720b5c/lib/sqlalchemy/orm/decl_base.py#L567-L582 that's making a global event against Mapper. Declarative should make at most just *one* event hook against Mapper, then use its own collections to locate classes for w... |
| Issue #9082: eager_defaults shouldn't be needed for pk returning even if cols are not actual pks | stale/low urgency | 2 | none | bug, orm, eager_defaults | ### Discussed in https://github.com/sqlalchemy/sqlalchemy/discussions/9080 simple case can be reproduced on sqlite w/ new returning support ```py from sqlalchemy import Column from sqlalchemy import create_engine from sqlalchemy import DateTime from sqlalchemy import func from sqlalchemy import String from sqlalchem... |
| Issue #9078: [2.0] Classes which are generics should document their type parameters | good volunteer slice | 20 | none | task, documentation, PRs (with tests!) welcome, typing | ### Describe the use case I'm working on a test branch for sqlalchemy 2.0 in a codebase which uses `mypy --strict`. This means that custom subclasses of generic types must provide type parameters (`--disallow-any-generics`). But it isn't clear what the type parameters are or mean in the 2.0 documentation branch. ###... |
| Issue #8992: tuple expanding params do not render bind_expression() for elements | has linked PR | 94 | PR #13323 | bug, high priority, sql | discovered during #8989, this is simply not implemented at all and the bind expression is ignored when it's an element of a tuple. Also, the impl of a TupleType() is not getting the internal types propagated along, which is part of what would be needed for this to work ```py from sqlalchemy import Column from sqlalc... |
| Issue #8936: Make the new PG Range aware of the its bounds data type | stale/low urgency | 2 | none | postgresql, datatypes, use case | ### Describe the use case The SA Range does not have an exact notion of its "type", i.e. there is no way to determine the data type of an empty or infinite range. ### Databases / Backends / Drivers targeted The `Range` class is specific to PostgreSQL, but is driver-agnostic. ### Example Use For example, my app shows... |