SqlAlchemy 2.0 中文文档(五十九)(3)

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS SQL Server Serverless,2-4RCU 50GB 3个月
推荐场景:
简介: SqlAlchemy 2.0 中文文档(五十九)

SqlAlchemy 2.0 中文文档(五十九)(2)https://developer.aliyun.com/article/1563148


1.4.29

Released: December 22, 2021

orm

  • [orm] [usecase]
    Added Session.get.execution_options parameter which was previously missing from the Session.get() method.
    References: #7410
  • [orm] [bug]
    Fixed issue in new “loader criteria” method PropComparator.and_() where usage with a loader strategy like selectinload() against a column that was a member of the .c. collection of a subquery object, where the subquery would be  dynamically added to the FROM clause of the statement, would be subject  to stale parameter values within the subquery in the SQL statement  cache, as the process used by the loader strategy to replace the  parameters at execution time would fail to accommodate the subquery when  received in this form.
    References: #7489
  • [orm] [bug]
    Fixed recursion overflow which could occur within ORM statement compilation when using either the with_loader_criteria() feature or the the PropComparator.and_() method within a loader strategy in conjunction with a subquery which  referred to the same entity being altered by the criteria option, or  loaded by the loader strategy. A check for coming across the same loader  criteria option in a recursive fashion has been added to accommodate  for this scenario.
    References: #7491
  • [orm] [bug] [mypy]
    Fixed issue where the __class_getitem__() method of the generated declarative base class by as_declarative() would lead to inaccessible class attributes such as __table__, for cases where a Generic[T] style typing declaration were used in the class hierarchy. This is in continuation from the basic addition of __class_getitem__() in #7368. Pull request courtesy Kai Mueller.
    References: #7368, #7462
  • [orm] [bug] [regression]
    Fixed caching-related issue where the use of a loader option of the form lazyload(aliased(A).bs).joinedload(B.cs) would fail to result in the joinedload being invoked for runs  subsequent to the query being cached, due to a mismatch for the options /  object path applied to the objects loaded for a query with a lead  entity that used aliased().
    References: #7447

engine

  • [engine] [bug]
    Corrected the error message for the AttributeError that’s raised when attempting to write to an attribute on the Row class, which is immutable. The previous message claimed the column didn’t exist which is misleading.
    References: #7432
  • [engine] [bug] [regression]
    Fixed regression in the make_url() function used to parse URL strings where the query string parsing would go into a recursion overflow if a Python 2 u'' string were used.
    References: #7446

mypy

  • [mypy] [bug]
    Fixed mypy regression  where the release of mypy 0.930 added additional internal checks to the  format of “named types”, requiring that they be fully qualified and  locatable. This broke the mypy plugin for SQLAlchemy, raising an  assertion error, as there was use of symbols such as __builtins__ and other un-locatable or unqualified names that previously had not raised any assertions.
    References: #7496

asyncio

  • [asyncio] [usecase]
    Added async_engine_config() function to create an async engine from a configuration dict. This otherwise behaves the same as engine_from_config().
    References: #7301

mariadb

  • [mariadb] [bug]
    Corrected the error classes inspected for the “is_disconnect” check for the mariadbconnector dialect, which was failing for disconnects that occurred due to common  MySQL/MariaDB error codes such as 2006; the DBAPI appears to currently  use the mariadb.InterfaceError exception class for disconnect errors such as error code 2006, which has been added to the list of classes checked.
    References: #7457

tests

  • [tests] [bug] [regression]
    Fixed a regression in the test suite where the test called CompareAndCopyTest::test_all_present would fail on some platforms due to additional testing artifacts being detected. Pull request courtesy Nils Philippsen.
    References: #7450

1.4.28

Released: December 9, 2021

platform

  • [platform] [bug]
    Python 3.10 has deprecated “distutils” in favor of explicit use of “setuptools” in PEP 632;  SQLAlchemy’s setup.py has replaced imports accordingly. However, since  setuptools itself only recently added the replacement symbols mentioned  in pep-632 as of November of 2021 in version 59.0.1, setup.py still has fallback imports to distutils, as SQLAlchemy 1.4 does not  have a hard setuptools versioning requirement at this time. SQLAlchemy  2.0 is expected to use a full PEP 517 installation layout which will indicate appropriate setuptools versioning up front.
    References: #7311

orm

  • [orm] [bug] [ext]
    Fixed issue where the internal cloning used by the PropComparator.any() method on a relationship() in the case where the related class also makes use of ORM polymorphic  loading, would fail if a hybrid property on the related, polymorphic  class were used within the criteria for the any() operation.
    References: #7425
  • [orm] [bug] [mypy]
    Fixed issue where the as_declarative() decorator and similar functions used to generate the declarative base class would not copy the __class_getitem__() method from a given superclass, which prevented the use of pep-484 generics in conjunction with the Base class. Pull request courtesy Kai Mueller.
    References: #7368
  • [orm] [bug] [regression]
    Fixed ORM regression where the new behavior of “eager loaders run on unexpire” added in #1763 would lead to loader option errors being raised inappropriately for the case where a single Query or Select were used to load multiple kinds of entities, along with loader options that apply to just one of those kinds of entity like a joinedload(),  and later the objects would be refreshed from expiration, where the  loader options would attempt to be applied to the mismatched object type  and then raise an exception. The check for this mismatch now bypasses  raising an error for this case.
    References: #7318
  • [orm] [bug]
    User defined ORM options, such as those illustrated in the dogpile.caching example which subclass UserDefinedOption,  by definition are handled on every statement execution and do not need  to be considered as part of the cache key for the statement. Caching of  the base ExecutableOption class has been modified so that it is no longer a HasCacheKey subclass directly, so that the presence of user defined option objects  will not have the unwanted side effect of disabling statement caching.  Only ORM specific loader and criteria options, which are all internal to  SQLAlchemy, now participate within the caching system.
    References: #7394
  • [orm] [bug]
    Fixed issue where mappings that made use of synonym() and potentially other kinds of “proxy” attributes would not in all  cases successfully generate a cache key for their SQL statements,  leading to degraded performance for those statements.
    References: #7394
  • [orm] [bug]
    Fixed issue where a list mapped with relationship() would go into an endless loop if in-place added to itself, i.e. the += operator were used, as well as if .extend() were given the same list.
    References: #7389
  • [orm] [bug]
    Fixed issue where if an exception occurred when the Session were to close the connection within the Session.commit() method, when using a context manager for Session.begin() , it would attempt a rollback which would not be possible as the Session was in between where the transaction is committed and the connection is  then to be returned to the pool, raising the exception “this  sessiontransaction is in the committed state”. This exception can occur  mostly in an asyncio context where CancelledError can be raised.
    References: #7388
  • [orm] [deprecated]
    Deprecated an undocumented loader option syntax ".*",  which appears to be no different than passing a single asterisk, and  will emit a deprecation warning if used. This syntax may have been  intended for something but there is currently no need for it.
    References: #4390

engine

  • [engine] [usecase]
    Added support for copy() and deepcopy() to the URL class. Pull request courtesy Tom Ritchford.
    References: #7400

sql

  • [sql] [usecase]
    ”Compound select” methods like Select.union(), Select.intersect_all() etc. now accept *other as an argument rather than other to allow for multiple additional SELECTs to be compounded with the  parent statement at once. In particular, the change as applied to CTE.union() and CTE.union_all() now allow for a so-called “non-linear CTE” to be created with the CTE construct, whereas previously there was no way to have more than two  CTE sub-elements in a UNION together while still correctly calling upon  the CTE in recursive fashion. Pull request courtesy Eric Masseran.
    References: #7259
  • [sql] [usecase]
    Support multiple clause elements in the Exists.where() method, unifying the api with the one presented by a normal select() construct.
    References: #7386
  • [sql] [bug] [regression]
    Extended the TypeDecorator.cache_ok attribute and corresponding warning message if this flag is not defined, a behavior first established for TypeDecorator as part of #6436, to also take place for UserDefinedType, by generalizing the flag and associated caching logic to a new common base for these two types, ExternalType to create UserDefinedType.cache_ok.
    The change means any current UserDefinedType will now cause SQL statement caching to no longer take place for  statements which make use of the datatype, along with a warning being  emitted, unless the class defines the UserDefinedType.cache_ok flag as True. If the datatype cannot form a deterministic, hashable  cache key derived from its arguments, the attribute may be set to False  which will continue to keep caching disabled but will suppress the  warning. In particular, custom datatypes currently used in packages such  as SQLAlchemy-utils will need to implement this flag. The issue was  observed as a result of a SQLAlchemy-utils datatype that is not  currently cacheable.
    See also
    ExternalType.cache_ok
    References: #7319
  • [sql] [bug]
    Custom  SQL elements, third party dialects, custom or third party datatypes  will all generate consistent warnings when they do not clearly opt in or  out of SQL statement caching, which is achieved by setting the  appropriate attributes on each type of class. The warning links to  documentation sections which indicate the appropriate approach for each  type of object in order for caching to be enabled.
    References: #7394
  • [sql] [bug]
    Fixed missing caching directives for a few lesser used classes in SQL Core which would cause [no key] to be logged for elements which made use of these.
    References: #7394

mypy

  • [mypy] [bug]
    Fixed Mypy crash which would occur when using Mypy plugin against code which made use of declared_attr methods for non-mapped names like __mapper_args__, __table_args__,  or other dunder names, as the plugin would try to interpret these as  mapped attributes which would then be later mis-handled. As part of this  change, the decorated function is still converted by the plugin into a  generic assignment statement (e.g. __mapper_args__: Any) so that the argument signature can continue to be annotated in the same way one would for any other @classmethod without Mypy complaining about the wrong argument type for a method that isn’t explicitly @classmethod.
    References: #7321

postgresql

  • [postgresql] [bug]
    Fixed missing caching directives for hstore and array constructs which would cause [no key] to be logged for these elements.
    References: #7394

tests

  • [tests] [bug]
    Implemented support  for the test suite to run correctly under Pytest 7. Previously, only  Pytest 6.x was supported for Python 3, however the version was not  pinned on the upper bound in tox.ini. Pytest is not pinned in tox.ini to  be lower than version 8 so that SQLAlchemy versions released with the  current codebase will be able to be tested under tox without changes to  the environment. Much thanks to the Pytest developers for their help  with this issue.

1.4.27

Released: November 11, 2021

orm

  • [orm] [bug]
    Fixed bug in  “relationship to aliased class” feature introduced at Relationship to  Aliased Class where it was not possible to create a loader strategy  option targeting an attribute on the target using the aliased() construct directly in a second loader option, such as selectinload(A.aliased_bs).joinedload(aliased_b.cs), without explicitly qualifying using PropComparator.of_type() on the preceding element of the path. Additionally, targeting the  non-aliased class directly would be accepted (inappropriately), but  would silently fail, such as selectinload(A.aliased_bs).joinedload(B.cs); this now raises an error referring to the typing mismatch.
    References: #7224
  • [orm] [bug]
    All Result objects will now consistently raise ResourceClosedError if they are used after a hard close, which includes the “hard close”  that occurs after calling “single row or value” methods like Result.first() and Result.scalar().  This was already the behavior of the most common class of result  objects returned for Core statement executions, i.e. those based on CursorResult,  so this behavior is not new. However, the change has been extended to  properly accommodate for the ORM “filtering” result objects returned  when using 2.0 style ORM queries, which would previously behave in “soft  closed” style of returning empty results, or wouldn’t actually “soft  close” at all and would continue yielding from the underlying cursor.
    As part of this change, also added Result.close() to the base Result class and implemented it for the filtered result implementations that are used by the ORM, so that it is possible to call the CursorResult.close() method on the underlying CursorResult when the yield_per execution option is in use to close a server side cursor before  remaining ORM results have been fetched. This was again already  available for Core result sets but the change makes it available for 2.0  style ORM results as well.
    References: #7274
  • [orm] [bug] [regression]
    Fixed 1.4 regression where Query.filter_by() would not function correctly on a Query that was produced from Query.union(), Query.from_self() or similar.
    References: #7239
  • [orm] [bug]
    Fixed  issue where deferred polymorphic loading of attributes from a  joined-table inheritance subclass would fail to populate the attribute  correctly if the load_only() option were used to originally  exclude that attribute, in the case where the load_only were descending  from a relationship loader option. The fix allows that other valid  options such as defer(..., raiseload=True) etc. still function as expected.
    References: #7304
  • [orm] [bug] [regression]
    Fixed 1.4 regression where Query.filter_by() would not function correctly when Query.join() were joined to an entity which made use of PropComparator.of_type() to specify an aliased version of the target entity. The issue also applies to future style ORM queries constructed with select().
    References: #7244

engine

  • [engine] [bug]
    Fixed issue in future Connection object where the Connection.execute() method would not accept a non-dict mapping object, such as SQLAlchemy’s own RowMapping or other abc.collections.Mapping object as a parameter dictionary.
    References: #7291
  • [engine] [bug] [regression]
    Fixed regression where the CursorResult.fetchmany() method would fail to autoclose a server-side cursor (i.e. when stream_results or yield_per is in use, either Core or ORM oriented results) when the results were fully exhausted.
    References: #7274
  • [engine] [bug]
    Fixed issue in future Engine where calling upon Engine.begin() and entering the context manager would not close the connection if the  actual BEGIN operation failed for some reason, such as an event handler  raising an exception; this use case failed to be tested for the future  version of the engine. Note that the “future” context managers which  handle begin() blocks in Core and ORM don’t actually run  the “BEGIN” operation until the context managers are actually entered.  This is different from the legacy version which runs the “BEGIN”  operation up front.
    References: #7272

sql

  • [sql] [usecase]
    Added TupleType to the top level sqlalchemy import namespace.
  • [sql] [bug] [regression]
    Fixed regression where the row objects returned for ORM queries, which are now the normal Row objects, would not be interpreted by the ColumnOperators.in_() operator as tuple values to be broken out into individual bound  parameters, and would instead pass them as single values to the driver  leading to failures. The change to the “expanding IN” system now  accommodates for the expression already being of type TupleType and treats values accordingly if so. In the uncommon case of using  “tuple-in” with an untyped statement such as a textual statement with no  typing information, a tuple value is detected for values that implement  collections.abc.Sequence, but that are not str or bytes, as always when testing for Sequence.
    References: #7292
  • [sql] [bug]
    Fixed  issue where using the feature of using a string label for ordering or  grouping described at Ordering or Grouping by a Label would fail to  function correctly if used on a CTE construct, when the CTE were embedded inside of an enclosing Select statement that itself was set up as a scalar subquery.
    References: #7269
  • [sql] [bug] [regression]
    Fixed regression where the text() construct would no longer be accepted as a target case in the “whens” list within a case() construct. The regression appears related to an attempt to guard  against some forms of literal values that were considered to be  ambiguous when passed here; however, there’s no reason the target cases  shouldn’t be interpreted as open-ended SQL expressions just like  anywhere else, and a literal string or tuple will be converted to a  bound parameter as would be the case elsewhere.
    References: #7287

schema

  • [schema] [bug]
    Fixed issue in Table where the Table.implicit_returning parameter would not be accommodated correctly when passed along with Table.extend_existing to augment an existing Table.
    References: #7295

postgresql

  • [postgresql] [usecase] [asyncpg]
    Added overridable methods PGDialect_asyncpg.setup_asyncpg_json_codec and PGDialect_asyncpg.setup_asyncpg_jsonb_codec codec, which handle the required task of registering JSON/JSONB codecs  for these datatypes when using asyncpg. The change is that methods are  broken out as individual, overridable methods to support third party  dialects that need to alter or disable how these particular codecs are  set up.
    References: #7284
  • [postgresql] [bug] [asyncpg]
    Changed the asyncpg dialect to bind the Float type to the “float” PostgreSQL type instead of “numeric” so that the value float(inf) can be accommodated. Added test suite support for persistence of the “inf” value.
    References: #7283
  • [postgresql] [pg8000]
    Improve array handling when using PostgreSQL with the pg8000 dialect.
    References: #7167

mysql

  • [mysql] [bug] [mariadb]
    Reorganized  the list of reserved words into two separate lists, one for MySQL and  one for MariaDB, so that these diverging sets of words can be managed  more accurately; adjusted the MySQL/MariaDB dialect to switch among  these lists based on either explicitly configured or  server-version-detected “MySQL” or “MariaDB” backend. Added all current  reserved words through MySQL 8 and current MariaDB versions including  recently added keywords like “lead” . Pull request courtesy Kevin  Kirsche.
    References: #7167
  • [mysql] [bug]
    Fixed issue in MySQL Insert.on_duplicate_key_update() which would render the wrong column name when an expression were used  in a VALUES expression. Pull request courtesy Cristian Sabaila.
    References: #7281

mssql

  • [mssql] [bug]
    Adjusted the  compiler’s generation of “post compile” symbols including those used for  “expanding IN” as well as for the “schema translate map” to not be  based directly on plain bracketed strings with underscores, as this  conflicts directly with SQL Server’s quoting format of also using  brackets, which produces false matches when the compiler replaces “post  compile” and “schema translate” symbols. The issue created easy to  reproduce examples both with the Inspector.get_schema_names() method when used in conjunction with the Connection.execution_options.schema_translate_map feature, as well in the unlikely case that a symbol overlapping with  the internal name “POSTCOMPILE” would be used with a feature like  “expanding in”.
    References: #7300

1.4.26

Released: October 19, 2021

orm

  • [orm] [bug]
    Improved the exception  message generated when configuring a mapping with joined table  inheritance where the two tables either have no foreign key  relationships set up, or where they have multiple foreign key  relationships set up. The message is now ORM specific and includes  context that the Mapper.inherit_condition parameter may be needed particularly for the ambiguous foreign keys case.
  • [orm] [bug]
    Fixed issue with with_loader_criteria() feature where ON criteria would not be added to a JOIN for a query of the form select(A).join(B), stating a target while making use of an implicit ON clause.
    References: #7189
  • [orm] [bug]
    Fixed bug where the ORM “plugin”, necessary for features such as with_loader_criteria() to work correctly, would not be applied to a select() which queried from an ORM column expression if it made use of the ColumnElement.label() modifier.
    References: #7205
  • [orm] [bug]
    Add missing methods added in #6991 to scoped_session and async_scoped_session().
    References: #7103
  • [orm] [bug]
    An extra layer of warning messages has been added to the functionality of Query.join() and the ORM version of Select.join(),  where a few places where “automatic aliasing” continues to occur will  now be called out as a pattern to avoid, mostly specific to the area of  joined table inheritance where classes that share common base tables are  being joined together without using explicit aliases. One case emits a  legacy warning for a pattern that’s not recommended, the other case is  fully deprecated.
    The automatic aliasing within ORM join() which  occurs for overlapping mapped tables does not work consistently with all  APIs such as contains_eager(), and rather than continue to  try to make these use cases work everywhere, replacing with a more  user-explicit pattern is clearer, less prone to bugs and simplifies  SQLAlchemy’s internals further.
    The warnings include links to the errors.rst page where each pattern is demonstrated along with the recommended pattern to fix.
    See also
    An alias is being generated automatically for raw clauseelement
    An alias is being generated automatically due to overlapping tables
    References: #6972, #6974
  • [orm] [bug]
    Fixed bug where iterating a Result from a Session after that Session were closed would partially attach objects to that session in an  essentially invalid state. It now raises an exception with a link to new  documentation if an un-buffered result is iterated from a Session that was closed or otherwise had the Session.expunge_all() method called after that Result was generated. The prebuffer_rows execution option, as is used automatically by the asyncio extension for client-side result sets, may be used to produce a Result where the ORM objects are prebuffered, and in this case iterating the result will produce a series of detached objects.
    See also
    Object cannot be converted to ‘persistent’ state, as this identity map is no longer valid.
    References: #7128
  • [orm] [bug]
    Related to #7153,  fixed an issue where result column lookups would fail for “adapted”  SELECT statements that selected for “constant” value expressions most  typically the NULL expression, as would occur in such places as joined  eager loading in conjunction with limit/offset. This was overall a  regression due to issue #6259 which removed all “adaption” for constants like NULL, “true”, and  “false” when rewriting expressions in a SQL statement, but this broke  the case where the same adaption logic were used to resolve the constant  to a labeled expression for the purposes of result set targeting.
    References: #7154
  • [orm] [bug] [regression]
    Fixed regression where ORM loaded objects could not be pickled in cases where loader options making use of "*" were used in certain combinations, such as combining the joinedload() loader strategy with raiseload('*') of sub-elements.
    References: #7134
  • [orm] [bug] [regression]
    Fixed regression where the use of a hybrid_property attribute or a mapped composite() attribute as a key passed to the Update.values() method for an ORM-enabled Update statement, as well as when using it via the legacy Query.update() method, would be processed for incoming ORM/hybrid/composite values  within the compilation stage of the UPDATE statement, which meant that  in those cases where caching occurred, subsequent invocations of the  same statement would no longer receive the correct values. This would  include not only hybrids that use the hybrid_property.update_expression() method, but any use of a plain hybrid attribute as well. For  composites, the issue instead caused a non-repeatable cache key to be  generated, which would break caching and could fill up the statement  cache with repeated statements.
    The Update construct now handles the processing of key/value pairs passed to Update.values() and Update.ordered_values() up front when the construct is first generated, before the cache key  has been generated so that the key/value pairs are processed each time,  and so that the cache key is generated against the individual  column/value pairs that will ultimately be used in the statement.
    References: #7209
  • [orm]
    Passing a Query object to Session.execute() is not the intended use of this object, and will now raise a deprecation warning.
    References: #6284

examples

  • [examples] [bug]
    Repaired the  examples in examples/versioned_rows to use SQLAlchemy 1.4 APIs  correctly; these examples had been missed when API changes like removing  “passive” from Session.is_modified() were made as well as the SessionEvents.do_orm_execute() event hook were added.
    References: #7169

engine

  • [engine] [bug]
    Fixed issue where the deprecation warning for the URL constructor which indicates that the URL.create() method should be used would not emit if a full positional argument list  of seven arguments were passed; additionally, validation of URL  arguments will now occur if the constructor is called in this way, which  was being skipped previously.
    References: #7130
  • [engine] [bug] [postgresql]
    The Inspector.reflect_table() method now supports reflecting tables that do not have user defined columns. This allows MetaData.reflect() to properly complete reflection on databases that contain such tables.  Currently, only PostgreSQL is known to support such a construct among  the common database backends.
    References: #3247
  • [engine] [bug]
    Implemented proper __reduce__() methods for all SQLAlchemy exception objects to ensure they all support  clean round trips when pickling, as exception objects are often  serialized for the purposes of various debugging tools.
    References: #7077

sql

  • [sql] [bug]
    Fixed issue where SQL queries using the FunctionElement.within_group() construct could not be pickled, typically when using the sqlalchemy.ext.serializer extension but also for general generic pickling.
    References: #6520
  • [sql] [bug]
    Repaired issue in new HasCTE.cte.nesting parameter introduced with #4123 where a recursive CTE using HasCTE.cte.recursive in typical conjunction with UNION would not compile correctly. Additionally makes some adjustments so that the CTE construct creates a correct cache key. Pull request courtesy Eric Masseran.
    References: #4123
  • [sql] [bug]
    Account for the table.schema parameter passed to the table() construct, such that it is taken into account when accessing the TableClause.fullname attribute.
    References: #7061
  • [sql] [bug]
    Fixed an inconsistency in the ColumnOperators.any_() / ColumnOperators.all_() functions / methods where the special behavior these functions have of  “flipping” the expression such that the “ANY” / “ALL” expression is  always on the right side would not function if the comparison were  against the None value, that is, “column.any_() == None” should produce  the same SQL expression as “null() == column.any_()”. Added more docs to  clarify this as well, plus mentions that any_() / all_() generally  supersede the ARRAY version “any()” / “all()”.
    References: #7140
  • [sql] [bug] [regression]
    Fixed issue where “expanding IN” would fail to function correctly with datatypes that use the TypeEngine.bind_expression() method, where the method would need to be applied to each element of  the IN expression rather than the overall IN expression itself.
    References: #7177
  • [sql] [bug]
    Adjusted  the “column disambiguation” logic that’s new in 1.4, where the same  expression repeated gets an “extra anonymous” label, so that the logic  more aggressively deduplicates those labels when the repeated element is  the same Python expression object each time, as occurs in cases like  when using “singleton” values like null(). This is based on  the observation that at least some databases (e.g. MySQL, but not  SQLite) will raise an error if the same label is repeated inside of a  subquery.
    References: #7153

mypy

  • [mypy] [bug]
    Fixed issue in mypy plugin to improve upon some issues detecting Enum() SQL types containing custom Python enumeration classes. Pull request courtesy Hiroshi Ogawa.
    References: #6435

postgresql

  • [postgresql] [bug]
    Added a  “disconnect” condition for the “SSL SYSCALL error: Bad address” error  message as reported by psycopg2. Pull request courtesy Zeke Brechtel.
    References: #5387
  • [postgresql] [bug] [regression]
    Fixed  issue where IN expressions against a series of array elements, as can  be done with PostgreSQL, would fail to function correctly due to  multiple issues within the “expanding IN” feature of SQLAlchemy Core  that was standardized in version 1.4. The psycopg2 dialect now makes use  of the TypeEngine.bind_expression() method with ARRAY to portably apply the correct casts to elements. The asyncpg dialect  was not affected by this issue as it applies bind-level casts at the  driver level rather than at the compiler level.
    References: #7177

mysql

  • [mysql] [bug] [mariadb]
    Fixes to  accommodate for the MariaDB 10.6 series, including backwards  incompatible changes in both the mariadb-connector Python driver  (supported on SQLAlchemy 1.4 only) as well as the native 10.6 client  libraries that are used automatically by the mysqlclient DBAPI (applies  to both 1.3 and 1.4). The “utf8mb3” encoding symbol is now reported by  these client libraries when the encoding is stated as “utf8”, leading to  lookup and encoding errors within the MySQL dialect that does not  expect this symbol. Updates to both the MySQL base library to  accommodate for this utf8mb3 symbol being reported as well as to the  test suite. Thanks to Georg Richter for support.
    This change is also backported to: 1.3.25
    References: #7115, #7136
  • [mysql] [bug]
    Fixed issue in MySQL match() construct where passing a clause expression such as bindparam() or other SQL expression for the “against” parameter would fail. Pull request courtesy Anton Kovalevich.
    References: #7144
  • [mysql] [bug]
    Fixed installation issue where the sqlalchemy.dialects.mysql module would not be importable if “greenlet” were not installed.
    References: #7204

mssql

  • [mssql] [usecase]
    Added reflection  support for SQL Server foreign key options, including “ON UPDATE” and  “ON DELETE” values of “CASCADE” and “SET NULL”.
  • [mssql] [bug]
    Fixed issue with Inspector.get_foreign_keys() where foreign keys were omitted if they were established against a unique index instead of a unique constraint.
    References: #7160
  • [mssql] [bug]
    Fixed issue with Inspector.has_table() where it would return False if a local temp table with the same name  from a different session happened to be returned first when querying  tempdb. This is a continuation of #6910 which accounted for the temp table existing only in the alternate session and not the current one.
    References: #7168
  • [mssql] [bug] [regression]
    Fixed bug in SQL Server DATETIMEOFFSET datatype where the ODBC implementation would not generate the correct DDL, for cases where the type were converted using the dialect.type_descriptor() method, the usage of which is illustrated in some documented examples for TypeDecorator, though not necessary for most datatypes. Regression was introduced by #6366.  As part of this change, the full list of SQL Server date types have  been amended to return a “dialect impl” that generates the same DDL name  as the supertype.
    References: #7129

1.4.25

Released: September 22, 2021

platform

  • [platform] [bug] [regression]
    Fixed regression due to #7024 where the reorganization of the “platform machine” names used by the greenlet dependency mis-spelled “aarch64” and additionally omitted uppercase  “AMD64” as is needed for Windows machines. Pull request courtesy James  Dow.
    References: #7024


SqlAlchemy 2.0 中文文档(五十九)(4)https://developer.aliyun.com/article/1563150

相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
3月前
|
SQL 关系型数据库 API
SqlAlchemy 2.0 中文文档(五十四)(5)
SqlAlchemy 2.0 中文文档(五十四)
36 1
|
3月前
|
SQL 缓存 关系型数据库
SqlAlchemy 2.0 中文文档(五十四)(3)
SqlAlchemy 2.0 中文文档(五十四)
23 1
|
3月前
|
SQL 关系型数据库 测试技术
SqlAlchemy 2.0 中文文档(五十四)(4)
SqlAlchemy 2.0 中文文档(五十四)
29 1
|
3月前
|
SQL 缓存 关系型数据库
SqlAlchemy 2.0 中文文档(五十四)(2)
SqlAlchemy 2.0 中文文档(五十四)
76 1
|
3月前
|
SQL 缓存 Oracle
SqlAlchemy 2.0 中文文档(五十九)(1)
SqlAlchemy 2.0 中文文档(五十九)
155 0
|
3月前
|
SQL 关系型数据库 PostgreSQL
SqlAlchemy 2.0 中文文档(五十九)(5)
SqlAlchemy 2.0 中文文档(五十九)
22 0
|
3月前
|
SQL Oracle 关系型数据库
SqlAlchemy 2.0 中文文档(五十九)(6)
SqlAlchemy 2.0 中文文档(五十九)
19 0
|
3月前
|
SQL 关系型数据库 MySQL
SqlAlchemy 2.0 中文文档(五十九)(4)
SqlAlchemy 2.0 中文文档(五十九)
19 0
|
3月前
|
SQL 关系型数据库 PostgreSQL
SqlAlchemy 2.0 中文文档(五十九)(7)
SqlAlchemy 2.0 中文文档(五十九)
16 0
|
3月前
|
SQL 关系型数据库 MySQL
SqlAlchemy 2.0 中文文档(五十九)(2)
SqlAlchemy 2.0 中文文档(五十九)
22 0