summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Add async tests to the github workflowworkflow_test_aiosqliteFederico Caselli2021-09-063-0/+8
| | | | | Fixes: #6967 Change-Id: I222cb5bdedf572e734c827d72bcbced202cdd62f
* add asyncio.gather() example; add connection optsMike Bayer2021-09-024-2/+141
| | | | | | | | | | | | while I dont like this approach very much, people will likely be asking for it a lot, so represent the most correct and efficient form we can handle right now. Added missing ``**kw`` arguments to the :meth:`_asyncio.AsyncSession.connection` method. Change-Id: Idadae2a02a4d96ecb96a5723ce64d017ab4c6217 References: https://github.com/sqlalchemy/sqlalchemy/discussions/6965
* Fix and test sequences w/ executemany in pre-exec scenariosMike Bayer2021-09-023-2/+86
| | | | | | | | | | | | | | Fixed issue where an engine that had ``implicit_returning`` set to False would fail to function when PostgreSQL's "fast insertmany" feature were used in conjunction with a ``Sequence``, as well as if any kind of "executemany" with "return_defaults()" were used in conjunction with a ``Sequence``. Note that PostgreSQL "fast insertmany" uses "RETURNING" by definition, when the SQL statement is passed to the driver; overall, the ``implicit_returning`` flag is legacy and has no real use in modern SQLAlchemy, and will be deprecated in a separate change. Fixes: #6963 Change-Id: Id8e3dd50a21b9124f338067b0fdb57b8f608dca8
* remove async session slotsMike Bayer2021-09-011-8/+0
| | | | | | | | | | 1798c3cf1c added __slots__ to the base which then caused af0824fd79 to fail. as we can't use an assignable class variable with slots, remove slots from AsyncSession which is how this class was working anyway. Fixes: #6967 Change-Id: I4e0adab923db8e77cf748a8728e253258838e8f1
* Merge "Allow custom sync session class in ``AsyncSession``."mike bayer2021-08-304-7/+107
|\
| * Allow custom sync session class in ``AsyncSession``.Federico Caselli2021-08-304-7/+107
| | | | | | | | | | | | | | | | | | | | | | The :class:`_asyncio.AsyncSession` now supports overriding which :class:`_orm.Session` it uses as the proxied instance. A custom ``Session`` class can be passed using the :paramref:`.AsyncSession.sync_session_class` parameter or by subclassing the ``AsyncSession`` and specifying a custom :attr:`.AsyncSession.sync_session_class`. Fixes: #6689 Change-Id: Idf9c24eae6c9f4e2fff292ed748feaa449a8deaa
* | Merge "Improve error message when inspecting async proxies"mike bayer2021-08-306-5/+96
|\ \
| * | Improve error message when inspecting async proxiesFederico Caselli2021-08-306-5/+96
| |/ | | | | | | | | | | | | Provide better error message when trying to insepct and async engine or asnyc connection. Change-Id: I907f3a22c6b76fe43df9d40cb0e69c57f74a7982
* | ensure pysqlite dialect enumerates correct isolation levelsMike Bayer2021-08-305-2/+41
|/ | | | | | | | | Fixed bug where the error message for SQLite invalid isolation level on the pysqlite driver would fail to indicate that "AUTOCOMMIT" is one of the valid isolation levels. Change-Id: Icbceab9a28af6a560859761fa92320b5473269a9 References: #6959
* exclude typing_extensions 3.10.0.1 for aiosqlite installMike Bayer2021-08-301-0/+1
| | | | | Change-Id: I7b35bc86a7b78f96d8006515341f7cc7a6b49dcc References: https://github.com/python/typing/issues/865
* Merge "dont assume argument lists for column property"mike bayer2021-08-284-7/+65
|\
| * dont assume argument lists for column propertyMike Bayer2021-08-274-7/+65
| | | | | | | | | | | | | | | | Fixed issue where mypy plugin would crash when interpreting a ``query_expression()`` construct. Fixes: #6950 Change-Id: Ic1f28d135bf6eb05c92061430c0d5a3663b804ef
* | Handle mappings passed to ``execution_options``.Federico Caselli2021-08-265-8/+35
|/ | | | | | | | | | Fixed a bug in :meth:`_asyncio.AsyncSession.execute` and :meth:`_asyncio.AsyncSession.stream` that required ``execution_options`` to be an instance of ``immutabledict`` when defined. It now correctly accepts any mapping. Fixes: #6943 Change-Id: Ic09de480dc2da1b0bdce25acb60b8f01371971f9
* Merge "ensure "sqlalchemy" info set for all considered classes"mike bayer2021-08-254-0/+41
|\
| * ensure "sqlalchemy" info set for all considered classesMike Bayer2021-08-254-0/+41
| | | | | | | | | | | | | | | | | | Fixed issue in mypy plugin where columns on a mixin would not be correctly interpreted if the mapped class relied upon a ``__tablename__`` routine that came from a superclass. Fixes: #6937 Change-Id: I74aed4862d0545008ee67f781aaa794ab6866926
* | Merge "standardizing docs #6821 (redo of ↵mike bayer2021-08-2526-199/+199
|\ \ | | | | | | | | | 2999/I5609025feee8cfdecc09b55bfbf1bd13fa2e6602)"
| * | standardizing docs #6821jonathan vanasco2021-08-2326-199/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (redo of 2999/I5609025feee8cfdecc09b55bfbf1bd13fa2e6602) This PR is designed to bring more clarity within the docs by renaming object instances that may be consfusingly similar to class, method, and attribute names. For example, instances of the class `MetaData` are available on some objects as `.metadata` property, and had appeared within the docs as both `meta` and `metadata` which has confused some users in the past. By this PR, the docs now utilize the following naming convention: * MetaData - SQLAlchemy class * .metadata - SQLAlchemy API attributes * metadata_obj - developer instantiated metadata objects or references Detailed Changes: * standardized `meta` and `metadata` instances to `metadata_obj`. note: the docs were evenly split between 'meta' and 'metadata'. * standardized 'cursor' to 'cursor_obj' to avoid confusion with the method. * standardized a 'scalar_subquery = ' to 'scalar_subq' to avoid confusion with the method. * standardized a 'cte = ' to 'cte_obj' to avoid confusion with the method Change-Id: I79c98aee16c5fc6649289b2dd7d6dfc368222fb4
* | | Merge "Qualify server version call in PostgreSQL"mike bayer2021-08-253-1/+55
|\ \ \
| * | | Qualify server version call in PostgreSQLarredond2021-08-243-1/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes: #6912 Closes: #6920 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6920 Pull-request-sha: 79af75dfddef25435afd9623698354d280d7c879 Change-Id: Ib6b472452f978378d9f511d17a26988323a89459
* | | | Merge "Avoid mutable object as default values"mike bayer2021-08-253-2/+5
|\ \ \ \
| * | | | Avoid mutable object as default valuestsimafeip2021-08-243-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes: #6915 Closes: #6916 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6916 Pull-request-sha: 6ec484d3d14b7dd7053d10a5d550bd74eb524c8b Change-Id: I2c87fbed44870110e35a69ee9a9e678671eeb8f0
* | | | | Update PyPI URLs (#6699)David Gilman2021-08-241-1/+1
| |_|_|/ |/| | | | | | | Change-Id: I67d593caf9d35371f49cfcb5472cb9c72d4b4bbd
* | | | add example for ORM enabled ON CONFLICTMike Bayer2021-08-243-68/+159
|/ / / | | | | | | | | | Change-Id: If7db5206ab4fdb04ceec9875c641c8c9eadc7849
* | | fix spelling (#6926)William Maio2021-08-242-2/+2
| |/ |/|
* | Fix has_table() to exclude other sessions' local temp tablesGord Thompson2021-08-232-3/+26
| | | | | | | | | | Fixes: #6910 Change-Id: I9986566e1195d42ad7e9a01f0f84ef2074576257
* | Merge "Deprecate scoped_session usage with async sessions"mike bayer2021-08-236-2/+54
|\ \
| * | Deprecate scoped_session usage with async sessionsFederico Caselli2021-07-286-2/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | Deprecate usage of :class:`_orm.scoped_session` with asyncio drivers. When using Asyncio the :class:`_asyncio.async_scoped_session` should be used instead. Fixes: #6746 Change-Id: I540d57a406f59efc37fc61f0e9dfe03f32fe2904
* | | Merge "restore statement substitution to before_execute()"mike bayer2021-08-234-1/+77
|\ \ \
| * | | restore statement substitution to before_execute()Mike Bayer2021-08-204-1/+77
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where the ability of the :meth:`_engine.ConnectionEvents.before_execute` method to alter the SQL statement object passed, returning the new object to be invoked, was inadvertently removed. This behavior has been restored. The refactor in a1939719a652774a437f69f8d4788b3f08650089 removed this feature for some reason and there were no tests in place to detect it. I don't see any indication this was planned. Fixes: #6913 Change-Id: Ia77ca08aa91ab9403f19a8eb61e2a0e41aad138a
* | | Merge "qualify compile_state updates for non-current entities"mike bayer2021-08-233-11/+94
|\ \ \
| * | | qualify compile_state updates for non-current entitiesMike Bayer2021-08-233-11/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue in recently repaired ``Query.with_entities()`` method where the flag that determines automatic uniquing for legacy ORM ``Query`` objects only would be set to ``True`` inappropriately in cases where the ``with_entities()`` call would be setting the ``Query`` to return column-only rows, which are not uniqued. Fixes: #6924 Change-Id: I81120823914c989bb7a4d13ef2ec08809d8e5a4d
* | | | fix typoMike Bayer2021-08-231-1/+1
|/ / / | | | | | | | | | Change-Id: I670d779a2103b3060c7eacb79cb4a803e3ecaadd
* | | update enable_baked_queries flag docMike Bayer2021-08-221-11/+7
| | | | | | | | | | | | | | | | | | | | | this flag is not relevant for ORM internals anymore and is overall legacy. Change-Id: I58ef7870881ff00b88d552af5eae6af11be6026c
* | | heads up that execute(query).first() can't apply LIMIT 1Mike Bayer2021-08-202-4/+42
|/ / | | | | | | | | Fixes: #6914 Change-Id: I5de9843dd3723c017b94b705fc009b883737ede1
* | Merge remote-tracking branch 'origin/pr/6902'Mike Bayer2021-08-191-1/+1
|\ \ | | | | | | | | | Change-Id: I73287795fdf0caafc8b29b1d837419e88ba15fe4
| * | mysql://user:pass@host/dbname instead of pass:hostJiayang2021-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Reading [1 sqlalchemy.future.Engine](https://docs.sqlalchemy.org/en/14/core/future.html#sqlalchemy.future.Engine) and [2 sqlalchemy.create_engine](https://docs.sqlalchemy.org/en/14/core/engines.html#sqlalchemy.create_engine). I fond @ should be used between pass & host. Test Plan: I checked with sqlalchemy 1.4.22 locally and I think @ should be used.
* | | Merge "CAST Oracle table_name, owner, others to VARCHAR(128)"mike bayer2021-08-193-12/+30
|\ \ \ | |/ / |/| |
| * | CAST Oracle table_name, owner, others to VARCHAR(128)Mike Bayer2021-08-183-12/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a CAST(VARCHAR2(128)) to the "table name", "owner", and other DDL-name parameters as used in reflection queries against Oracle system views such as ALL_TABLES, ALL_TAB_CONSTRAINTS, etc to better enable indexing to take place against these columns, as they previously would be implicitly handled as NVARCHAR2 due to Python's use of Unicode for strings; these columns are documented in all Oracle versions as being VARCHAR2 with lengths varying from 30 to 128 characters depending on server version. Additionally, test support has been enabled for Unicode-named DDL structures against Oracle databases. Fixes: #4486 Change-Id: I2787e3f8de1f656318692bd535d6a7f1cef1a841
* | | Version 1.4.24 placeholderMike Bayer2021-08-182-1/+5
| | |
* | | - 1.4.23rel_1_4_23Mike Bayer2021-08-1818-212/+228
| | |
* | | changelog updatesMike Bayer2021-08-182-7/+11
|/ / | | | | | | Change-Id: I7c9a6abb85206c56423cfe70d807fc81ae89117e
* | bump profiles a bitMike Bayer2021-08-181-110/+114
| | | | | | | | | | | | | | | | the change from lambdas in loader strategies as well as the repair to caching for the Bundle construct has caused a slight callcount bump. Change-Id: I0b160c4a71efdb716f15ac3c128a8addbe10850d
* | Merge "send user defined options from the current query"mike bayer2021-08-185-16/+142
|\ \
| * | send user defined options from the current queryMike Bayer2021-08-175-16/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revised the means by which the :attr:`_orm.ORMExecuteState.user_defined_options` accessor receives :class:`_orm.UserDefinedOption` and related option objects from the context, with particular emphasis on the "selectinload" on the loader strategy where this previously was not working; other strategies did not have this problem. The objects that are associated with the current query being executed, and not that of a query being cached, are now propagated unconditionally. This essentially separates them out from the "loader strategy" options which are explicitly associated with the compiled state of a query and need to be used in relation to the cached query. The effect of this fix is that a user-defined option, such as those used by the dogpile.caching example as well as for other recipes such as defining a "shard id" for the horizontal sharing extension, will be correctly propagated to eager and lazy loaders regardless of whether a cached query was ultimately invoked. Fixes: #6887 Change-Id: Ieaae5b01c85de26ea732ebd625e6e5823a470492
* | | Merge "rewrite _extra_criteria in selectinload; propagate correctly to Load"mike bayer2021-08-187-31/+268
|\ \ \ | |/ /
| * | rewrite _extra_criteria in selectinload; propagate correctly to LoadMike Bayer2021-08-177-31/+268
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue in :func:`_orm.selectinload` where use of the new :meth:`_orm.PropComparator.and_` feature within options that were nested more than one level deep would fail to update bound parameter values that were in the nested criteria, as a side effect of SQL statement caching. Implementation adds a new step that rewrites the parameters inside of all _extra_criteria when invoking selectinload as well as subqueryload. Additionally, changed how Load() gets "extra_criteria", in that it pulls it from UnboundLoad._extra_criteria instead of re-fetching it from the path elements, which are not updated by this new step. This patch also builds upon the removal of lambda queries for use in loader strategies in #6889. lambdas made this issue much more difficult to diagnose. An attempt to reintroduce lambdas here after finally identifying the "extra_criteria" issue above showed that lambdas still impact the assertsql fixture, meaning we have a statement structure that upon calling .compile() still delivers stale data due to lambdas, even if caching is turned off, and the non-cached test was still failing due to stale data within the lambdas. This is basically the complexity that #6889 fixes and as there's no real performance gain to using lambdas in these strategies on top of the existing statement caching that does most of the work, it should be much less likely going forward to have as many deeply confusing issues as we've had within selectinload/lazyload in the 1.4 series. Fixes: #6881 Change-Id: I919c079d2ed06125def5f8d6d81f3f305e158c04
* | | Merge "honor NO_CACHE in lambdas"mike bayer2021-08-183-29/+134
|\ \ \ | |/ / |/| |
| * | honor NO_CACHE in lambdasMike Bayer2021-08-173-29/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue in lambda caching system where an element of a query that produces no cache key, like a custom option or clause element, would still populate the expression in the "lambda cache" inappropriately. This was discovered as part of :ticket:`6887` but is a separate issue. References: #6887 Change-Id: I1665f4320254ddc63a0abf3088e9daeaffbd1840
* | | remove lambda caching from loader strategiesMike Bayer2021-08-1710-253/+226
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adjusted ORM loader internals to no longer use the "lambda caching" system that was added in 1.4, as well as repaired one location that was still using the previous "baked query" system for a query. The lambda caching system remains an effective way to reduce the overhead of building up queries that have relatively fixed usage patterns. In the case of loader strategies, the queries used are responsible for moving through lots of arbitrary options and criteria, which is both generated and sometimes consumed by end-user code, that make the lambda cache concept not any more efficient than not using it, at the cost of more complexity. In particular the problems noted by :ticket:`6881` and :ticket:`6887` are made considerably less complicated by removing this feature internally. Fixed an issue where the :class:`_orm.Bundle` construct would not create proper cache keys, leading to inefficient use of the query cache. This had some impact on the "selectinload" strategy and was identified as part of :ticket:`6889`. Added a Select._create_raw_select() method which essentially performs ``__new__`` and then populates ``__dict__`` directly, with no coercions. This saves most of the overhead time that the lambda caching system otherwise seeks to avoid. Includes removal of bakedquery from mapper->_subclass_load_via_in() which was overlooked from the 1.4 refactor. Fixes: #6079 Fixes: #6889 Change-Id: Ieac2d9d709b71ec4270e5c121fbac6ac870e2bb1
* | Merge "fix linter JOIN logic; fix PostgreSQL ARRAY op comparison"mike bayer2021-08-166-8/+75
|\ \