summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
Commit message (Collapse)AuthorAgeFilesLines
* update quoted_name docMike Bayer2022-08-041-1/+2
| | | | | | Fixes: #8339 Change-Id: If78bc9babfdc6a4dde4e65d72858ac7a402cbb4d (cherry picked from commit dc5a1c482ee1a8faf15fd81db866e5f72c1c719f)
* update Numeric/Float docstringsMike Bayer2022-04-141-41/+22
| | | | | | | | | | | | | | These docs were very out of date re: cdecimal. Additionally, as pointed out in #5252, the Numeric documentation is misleading; SQLAlchemy's Numeric hierarchy resembles more of the Oracle approach where precision and scale solely determine the kind of datatype being worked with. Float is essentially Numeric with different defaults. Fixes: #5252 Change-Id: I661109fabf04ba7831c7ddafba15321dd445ea5d (cherry picked from commit 3d300066e8b20a89e0b82bf09dd0c4016f5f8e51) (cherry picked from commit 0c0bcd95ce843d8541ae952ec5262851d109ab0a)
* replace "e.g.::" with more context regarding attribute events exampleMike Bayer2022-01-251-2/+4
| | | | | | Fixes: #7613 Change-Id: I28a9577587399c41afd53fbd026003667654c3fc (cherry picked from commit 5e3357c70e419c244156ac3885b2cf784b5b3fc0)
* support utf8mb3 char encoding fully for mysqlclient, othersMike Bayer2021-10-021-0/+1
| | | | | | | | | | | | | | | | | Fixes to accommodate for the MariaDB 10.6 series, including backwards incompatible changes in both the mariadb-connector Python driver as well as the native 10.6 client libraries that are used automatically by the mysqlclient DBAPI. 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. Fixes: #7136 Fixes: #7115 Change-Id: I655d9d9868aef76037023d0c602b8a7c881780b0 (cherry picked from commit f43e65f9b557b2d110141137a0216c661ba038b4)
* add attribute sphinx is breaking onMike Bayer2021-09-171-1/+2
| | | | | | | | | the hybridmethod internal seems to be confusing a recent version of sphinx autodoc, add attribute it's searching for. Change-Id: I27f671a51f857b62337cc2374bbc87383ae9710d (cherry picked from commit c50183274728544e40e7da4fd35cf240da5df656)
* Add note regarding encryption-related pragmasFederico Caselli2021-06-071-13/+8
| | | | | | | | passed in the url in pysqlcipher. Fixes: #6589 Change-Id: I86f93f84ef2bd374c4832a70e26e4901d024ed4b (cherry picked from commit 170b97fa45342622b476df3a89bcd3154056ce65)
* fix mapper._primary_key_propkeysMike Bayer2021-04-291-2/+2
| | | | | | | | | | Fixed issue in :meth:`_orm.Session.bulk_save` when used with persistent objects which would fail to track the primary key of mappings where the column name of the primary key were different than the attribute name. Fixes: #6392 Change-Id: I9b89bf00f900b7d2287517249e4f9356f20f0bdb (cherry picked from commit 7892cc30ad60ae450471b62f351b3beb66911892)
* apply **kw to SchemaEventTarget._set_parentMike Bayer2021-04-151-1/+1
| | | | | | | | | | | Fixed issue in the ``SchemaEventTarget._set_parent`` method that was missing ``**kw`` in its argument signature which was added to this private method as part of :ticket:`6152`. The method is not invoked internally, but could potentially be used by a third party system, as well as that the lack of a proper signature could be misleading in debugging other issues. Change-Id: I00dce3e533183969b09946f3e918cb30e1154623 References: #6282
* Fix error in documentation of DDLElementFederico Caselli2021-04-111-2/+2
| | | | | Change-Id: I9d850458c274d245057ea676d6730d4bd93c261f (cherry picked from commit c77274a45092352e8dd62b29e9aea8d0953a1313)
* update .Unicode documentationMike Bayer2021-04-101-44/+42
| | | | | | | | | to reflect the modernization that was already done in String. Fixes: #6238 Change-Id: I92c667b45f040c6dad431c53d89d01fdcc2a2a2a (cherry picked from commit 78b66780092768b2bdd5299accdcef1f2e5d3a52)
* Table arguments name and metadata are positional onlyFederico Caselli2021-04-061-2/+5
| | | | | | | | | | | | The :class:`_sql.Table` object now raises an informative error message if it is instantiated without passing at least the :paramref:`_sql.Table.name` and :paramref:`_sql.Table.metadata` arguments positionally. Previously, if these were passed as keyword arguments, the object would silently fail to initialize correctly. Fixes: #6135 Change-Id: I54d0c89fd549fc504289a87ea0bb37369f982b06 (cherry picked from commit 3de954bc027ebf655e7ed26c83cfb3fd4b7b5edf)
* Correct for Variant + ARRAY cases in psycopg2Mike Bayer2021-04-014-15/+28
| | | | | | | | | | | | | | | Fixed regression caused by :ticket:`6023` where the PostgreSQL cast operator applied to elements within an :class:`_types.ARRAY` when using psycopg2 would fail to use the correct type in the case that the datatype were also embedded within an instance of the :class:`_types.Variant` adapter. Additionally, repairs support for the correct CREATE TYPE to be emitted when using a ``Variant(ARRAY(some_schema_type))``. Fixes: #6182 Change-Id: I1b9ba7c876980d4650715a0b0801b46bdc72860d (cherry picked from commit 43e98c75bde96ef27daeaf7fbfbea30b7eb7c295)
* dont import typing on Python 3.4Mike Bayer2021-03-311-1/+4
| | | | | | | | Repaired an import for "typing" that is not supported in Python 3.4, which is the bottom version supported by SQLAlchemy 1.3. Fixes: #6168 Change-Id: I282c04be0dd40e2b6d5dc3c7f7dad65746d60008
* Version 1.3.25 placeholderMike Bayer2021-03-301-1/+1
|
* Refine domain nullable rules for PostgreSQL reflectionMike Bayer2021-03-301-2/+3
| | | | | | | | | | Fixed issue in PostgreSQL reflection where a column expressing "NOT NULL" will supersede the nullability of a corresponding domain. Fixes #6161 Change-Id: I1a3de49afcdb952f71bd7a7cc7b264513c93eff5 (cherry picked from commit ab61d66dee9b3c3639907557852908858daacb6f)
* TypeDecorator passes "outer" flag to itself for set_parent accountingMike Bayer2021-03-293-13/+15
| | | | | | | | | | | | | | | Fixed bug first introduced in as some combination of :ticket:`2892`, :ticket:`2919` nnd :ticket:`3832` where the attachment events for a :class:`_types.TypeDecorator` would be doubled up against the "impl" class, if the "impl" were also a :class:`_types.SchemaType`. The real-world case is any :class:`_types.TypeDecorator` against :class:`_types.Enum` or :class:`_types.Boolean` would get a doubled :class:`_schema.CheckConstraint` when the ``create_constraint=True`` flag is set. Fixes: #6152 Change-Id: I3218b7081297270c132421f6765b5c3673d10a5c (cherry picked from commit 3b18c9db3a81dfeec6de33e7e2ffbd8d265d1d79)
* Allow dropping a schema with a sequence shared by more than one table.Federico Caselli2021-03-201-5/+17
| | | | | | Fixes: #6071 Change-Id: I5c4483abf075622cccb73cb4c4f8c873174b4e32 (cherry picked from commit 158346a98bcaa28d44f34b194aac75cadd76f1ad)
* CAST the elements in ARRAYs when using psycopg2Federico Caselli2021-03-168-12/+74
| | | | | | | | | | | | | Adjusted the psycopg2 dialect to emit an explicit PostgreSQL-style cast for bound parameters that contain ARRAY elements. This allows the full range of datatypes to function correctly within arrays. The asyncpg dialect already generated these internal casts in the final statement. This also includes support for array slice updates as well as the PostgreSQL-specific :meth:`_postgresql.ARRAY.contains` method. Fixes: #6023 Change-Id: Ia7519ac4371a635f05ac69a3a4d0f4e6d2f04cad (cherry picked from commit dfa1d3b28f1a0abf1e11c76a94f7a65bf98d29af)
* Fix named CHECK constraint name omitted on repeated createsGord Thompson2021-03-064-40/+12
| | | | | | | | | | | | | | Fixed issue where the CHECK constraint generated by :class:`_types.Boolean` or :class:`_types.Enum` would fail to render the naming convention correctly after the first compilation, due to an unintended change of state within the name given to the constraint. This issue was first introduced in 0.9 in the fix for issue #3067, and the fix revises the approach taken at that time which appears to have been more involved than what was needed. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Fixes: #6007 Change-Id: I7ecff0a9d86191520f6841b3922a5af5a6971fba (cherry picked from commit 506b88de5e428fd4ad2feff663ba53e2dbb28891)
* ensure composite refresh handler synced w/ mutable compositeMike Bayer2021-03-041-7/+27
| | | | | | | | | | | | Fixed issue where the :class:`_mutable.MutableComposite` construct could be placed into an invalid state when the parent object was already loaded, and then covered by a subsequent query, due to the composite properties' refresh handler replacing the object with a new one not handled by the mutable extension. Fixes: #6001 Change-Id: Ieebd8e6afe6b65f8902cc12dec1efb968f5438ef (cherry picked from commit 2f7623b6b265cd5f25f2a6022e21bc3286d397a3)
* Fix aggregate_order_by issueGord Thompson2021-03-041-0/+1
| | | | | | | | | | | Fixes: #5989 Using array_agg() with aggregate_order_by() in postgresql would sometimes return ARRAY(NullType) instead of ARRAY(actual_type). Change-Id: I05a0b2b7ea59291e3c04575578adcc337296e5a8 (cherry picked from commit 780213bfefac7046ac889ffbc1c51e0d244dd678)
* Remove passive_deletes warning for many-to-oneMike Bayer2021-03-031-7/+0
| | | | | | | | | | | | Removed very old warning that states that passive_deletes is not intended for many-to-one relationships. While it is likely that in many cases placing this parameter on a many-to-one relationship is not what was intended, there are use cases where delete cascade may want to be disallowed following from such a relationship. Change-Id: I07adb726633f73f26296add4ec70376d5dcf8817 References: #5983 (cherry picked from commit a63b23392fc31766e32b8650127d9006ee189a0f)
* document TypeDecorator schemes for MONEYMike Bayer2021-02-221-1/+35
| | | | | | | | | this type apparently returns strings so document cast/processing options. Change-Id: Idc19527dcf76e1c2d966425716c0fcf60cbba5dc References: #5965 (cherry picked from commit fcf539d090a95fb179ca03beffd10122e97aa002)
* Extract table names when comparing to nrte errorMike Bayer2021-02-181-3/+6
| | | | | | | | | | | | | Fixed issue where the process of joining two tables could fail if one of the tables had an unrelated, unresolvable foreign key constraint which would raise :class:`_exc.NoReferenceError` within the join process, which nonetheless could be bypassed to allow the join to complete. The logic which tested the exception for signficance within the process would make assumptions about the construct which would fail. Fixes: #5952 Change-Id: I492dacd082ddcf8abb1310ed447a6ed734595bb7 (cherry picked from commit 498db831718cb5df213b1afdd2027878e0e72fd4)
* Add emphasis to URL documentation re: URL encodingMike Bayer2021-02-141-2/+7
| | | | | | Fixes: #5715 Change-Id: I2ac16541d34f49b25070e00c43596bcd71aff72d (cherry picked from commit f6188d31998321a857078d6a61672aae1f98e312)
* Add identifier_preparer per-execution context for schema translatesMike Bayer2021-02-088-9/+94
| | | | | | | | | | | | Fixed bug where the "schema_translate_map" feature failed to be taken into account for the use case of direct execution of :class:`_schema.DefaultGenerator` objects such as sequences, which included the case where they were "pre-executed" in order to generate primary key values when implicit_returning was disabled. Fixes: #5929 Change-Id: I3fed1d0af28be5ce9c9bb572524dcc8411633f60 (cherry picked from commit 2385ebb19366efeb35415298166ac18668864c51)
* Precede sp_columns with EXECMike Bayer2021-02-051-2/+2
| | | | | | | | | | Fixed issue regarding SQL Server reflection for older SQL Server 2005 version, a call to sp_columns would not proceed correctly without being prefixed with the EXEC keyword. This method is not used in current 1.4 series. Fixes: #5921 Change-Id: I2ffcda97d570879719ec5c1ea9fb7507dc87756f
* Fix broken link to cx_Oracle documentationPaul Lettich2021-02-051-1/+1
| | | | (cherry picked from commit 2c7e78be96a33902927f911429849a2ccfbcfc9b)
* Accommodate column-based naming conventions for pk constraintMike Bayer2021-02-044-12/+54
| | | | | | | | | | | | | | | Repaired / implemented support for primary key constraint naming conventions that use column names/keys/etc as part of the convention. In particular, this includes that the :class:`.PrimaryKeyConstraint` object that's automatically associated with a :class:`.schema.Table` will update its name as new primary key :class:`_schema.Column` objects are added to the table and then to the constraint. Internal failure modes related to this constraint construction process including no columns present, no name present or blank name present are now accommodated. Fixes: #5919 Change-Id: Ic2800b50f4a4cd5978bec48cefea0a2e198e0123 (cherry picked from commit 9660e94e35be438b0d51cd87e6ccb4047a332c15)
* Version 1.3.24 placeholderMike Bayer2021-02-011-1/+1
|
* set identifier length for MySQL constraints to 64Mike Bayer2021-01-306-8/+233
| | | | | | | | | | | | | | | | | | | | | | | | | The rule to limit index names to 64 also applies to all DDL names, such as those coming from naming conventions. Add another limiting variable for constraint names and create test cases against all constraint types. Additionally, codified in the test suite MySQL's lack of support for naming of a FOREIGN KEY constraint after the name was given, which apparently assigns the name to an associated KEY but not the constraint itself, until MySQL 8 and MariaDB 10.5 which appear to have resolved the behavior. However it's not clear how Alembic hasn't had issues reported with this so far. Fixed long-lived bug in MySQL dialect where the maximum identifier length of 255 was too long for names of all types of constraints, not just indexes, all of which have a size limit of 64. As metadata naming conventions can create too-long names in this area, apply the limit to the identifier generator within the DDL compiler. Fixes: #5898 Change-Id: I79549474845dc29922275cf13321c07598dcea08 (cherry picked from commit fc1e419d139711117b0d2451d6b6e11045afeeb3)
* Use schema._copy_expression() fully in column collection constraintsGord Thompson2021-01-293-11/+31
| | | | | | | | | | | Fixed issue where using :meth:`_schema.Table.to_metadata` (called :meth:`_schema.Table.tometadata` in 1.3) in conjunction with a PostgreSQL :class:`_postgresql.ExcludeConstraint` that made use of ad-hoc column expressions would fail to copy correctly. Fixes: #5850 Change-Id: I062480afb23f6f60962b7b55bc93f5e4e6ff05e4 (cherry picked from commit 81896c31ffc4db081f1f2bba199a52328398a236)
* Clarify Column.index / Column.unique parametersMike Bayer2021-01-291-12/+113
| | | | | | | | | | | These parameters need to be more clear that they cause a constraint / index object to be generated. Clarify the rules by which this occurs and include contextual information about naming conventions as well. Change-Id: I8dc96ead4457215abed391fd1b9f732a1eef6e09 References: #5887 (cherry picked from commit aff54c0bd8f75d324f1a4a8601a3d6f28739439e)
* Allow Oracle CLOB/NCLOB/BLOB in returningMike Bayer2021-01-282-3/+74
| | | | | | | | | | | | | | | | | | | Fixed bug in Oracle dialect where retriving a CLOB/BLOB column via :meth:`_dml.Insert.returning` would fail as the LOB value would need to be read when returned; additionally, repaired support for retrieval of Unicode values via RETURNING under Python 2. As of yet, we still don't know how to reproduce the ORA-24813 error indicated in the issue. Also backporting the statement cache clear added to master in f1e96cb087 , as we are testing in CI against two oracle versions now there are sporadic failures that appear to be memory related. Fixes: #5812 Change-Id: I666f893e762dfa4d34dd2e324480565b226fb3a4 (cherry picked from commit 03179a96bfb9dd7ce17274fed44908c25229dedf)
* Merge "remove __allowlist__" into rel_1_3mike bayer2021-01-231-4/+0
|\
| * remove __allowlist__Mike Bayer2021-01-231-4/+0
| | | | | | | | | | | | | | this testing element is not used Change-Id: I484c9a9f070122545fcdabe5a7f13b0bfca17023 (cherry picked from commit 20a15345a3f1e4755613d908a3d3cfe1bfe35c6c)
* | Merge "include negation symbol in numeric default match" into rel_1_3mike bayer2021-01-231-2/+2
|\ \ | |/ |/|
| * include negation symbol in numeric default matchMike Bayer2021-01-231-2/+2
| | | | | | | | | | | | | | | | | | Fixed bug where MySQL server default reflection would fail for numeric values with a negation symbol present. Fixes: #5860 Change-Id: I02cacdb4f9ec7d9113c27bf0d9214c4e14f4d4f9 (cherry picked from commit 33886b8692fc9a9cf862386a541d15114a659f43)
* | Removed some legacy terms in favor of modern equivalents. (D&I)jonathan vanasco2021-01-231-1/+1
|/ | | | | | | | | | | | | | Migrated testing fixture: `TestBase.__whitelist__` -> `TestBase.__allowlist__` Migrated tox commands from deprecated to current: `whitelist_externals` > `allowlist_externals` Migrated test_session: `blacklist` -> `blocklist` Change-Id: I395d5ee977ff22fa703276b9b873cc96c59b9a35 (cherry picked from commit f6fca84a7ffc71d743bea22e688ef3c944ba545b)
* Merge "Add mssql+turbodbc to external dialect list" into rel_1_3mike bayer2021-01-151-0/+10
|\
| * Add mssql+turbodbc to external dialect listGord Thompson2021-01-131-0/+10
| | | | | | | | | | | | Fixes: #5834 Change-Id: I1f207b84751e7e3425aa9e8e393787eeb9b595b7 (cherry picked from commit 3c53cfaaf5cd7d224896db07744095f199723315)
* | Use UnsupportedCompilationError for no default compilerMike Bayer2021-01-142-9/+13
|/ | | | | | | | | | | | | | | | Fixed issue where the stringification that is sometimes called when attempting to generate the "key" for the ``.c`` collection on a selectable would fail if the column were an unlabeled custom SQL construct using the ``sqlalchemy.ext.compiler`` extension, and did not provide a default compilation form; while this seems like an unusual case, it can get invoked for some ORM scenarios such as when the expression is used in an "order by" in combination with joined eager loading. The issue is that the lack of a default compiler function was raising :class:`.CompileError` and not :class:`.UnsupportedCompilationError`. Fixes: #5836 Change-Id: I5af243b2c70c7dcca4b212a3869c3017a50c132b (cherry picked from commit b4c6cfc2fde6c652e79ca157f8023a3f8941bc3c)
* Merge "Remove special rule for TypeDecorator of TypeDecorator" into rel_1_3mike bayer2021-01-071-4/+1
|\
| * Remove special rule for TypeDecorator of TypeDecoratorMike Bayer2021-01-051-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removing this check for "TypeDecorator" in impl seems to not break anything and allows TypeDecorator.with_variant() to work correctly. The line has been traced back to 2007 and does not appear to have relevance today. Fixed bug where making use of the :meth:`.TypeEngine.with_variant` method on a :class:`.TypeDecorator` type would fail to take into account the dialect-specific mappings in use, due to a rule in :class:`.TypeDecorator` that was instead attempting to check for chains of :class:`.TypeDecorator` instances. Fixes: #5816 Change-Id: Ic86d9d985810e3050f15972b4841108acca2fa3e (cherry picked from commit 458f83c6d213a80c2f0353b96421de36aee705f3)
* | Update connect args for pymysql 1.0.0; aiomysql fixesMike Bayer2021-01-072-4/+14
|/ | | | | | | | | | | | | | Fixed deprecation warnings that arose as a result of the release of PyMySQL 1.0, including deprecation warnings for the "db" and "passwd" parameters now replaced with "database" and "password". For the 1.4 version of this patch, we are also changing tox.ini to refer to a local branch of aiomysql that fixes pymysql compatibility issues. Fixes: #5821 Change-Id: I93876b52b2d96b52308f22aeb4f244ac5766a82f (cherry picked from commit 489301137a4d76e5a46d754ae9c91aad2b3d2c1f)
* Check for column expr in Oracle RETURNING checkMike Bayer2021-01-041-0/+1
| | | | | | | | | | | Fixed regression in Oracle dialect introduced by :ticket:`4894` in SQLAlchemy 1.3.11 where use of a SQL expression in RETURNING for an UPDATE would fail to compile, due to a check for "server_default" when an arbitrary SQL expression is not a column. Fixes: #5813 Change-Id: I1977bb49bc971399195015ae45e761f774f4008d (cherry picked from commit ea467fccbe4337929b91e0daec12b8672fa7907c)
* happy new yearMike Bayer2021-01-04178-178/+178
| | | | Change-Id: Ie6171eedea1d409bd0c570b55f94a82ba19ea58c
* Support casting to ``FLOAT`` in MySQL and MariaDb.Federico Caselli2020-12-301-1/+17
| | | | | | Fixes: #5808 Change-Id: I8106ddcf681eec3cb3a67d853586702f6e844b9d (cherry picked from commit 0da7225ac16b966c1cc5f1b2afde4eb6856183aa)
* narrow the check for double-paren exprs in mysql create_indexMike Bayer2020-12-261-4/+6
| | | | | | | | | | | | | | | Fixed regression from SQLAlchemy 1.3.20 caused by the fix for :ticket:`5462` which adds double-parenthesis for MySQL functional expressions in indexes, as is required by the backend, this inadvertently extended to include arbitrary :func:`_sql.text` expressions as well as Alembic's internal textual component, which are required by Alembic for arbitrary index expressions which don't imply double parenthesis. The check has been narrowed to include only binary/ unary/functional expressions directly. Fixes: #5800 Change-Id: I40f83c6f9dd04b984d0c86eba632a588570709a1 (cherry picked from commit e81bc1f098ea40cf38ec4e4007c11c7f3ffc9712)
* test fixes for oracle 18c, for rel_1_3Mike Bayer2020-12-265-5/+35
| | | | Change-Id: I4968aa3bde3c4d11d7fe84f18b4a846ba357d16a