summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
| * | Ensure all nested exception throws have a causeMike Bayer2020-03-0241-401/+703
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Applied an explicit "cause" to most if not all internally raised exceptions that are raised from within an internal exception catch, to avoid misleading stacktraces that suggest an error within the handling of an exception. While it would be preferable to suppress the internally caught exception in the way that the ``__suppress_context__`` attribute would, there does not as yet seem to be a way to do this without suppressing an enclosing user constructed context, so for now it exposes the internally caught exception as the cause so that full information about the context of the error is maintained. Fixes: #4849 Change-Id: I55a86b29023675d9e5e49bc7edc5a2dc0bcd4751
* | | Merge "Remove obsolete util.compat.nested"mike bayer2020-03-022-36/+0
|\ \ \
| * | | Remove obsolete util.compat.nestedGord Thompson2020-03-022-36/+0
| | | | | | | | | | | | | | | | | | | | Fixes: #5177 Change-Id: Ie02b0c065e3833f43e056ad9c31f414871d9e8ee
* | | | Merge "Deprecate the databases packages"mike bayer2020-03-022-3/+9
|\ \ \ \ | |_|/ / |/| | |
| * | | Deprecate the databases packagesFederico Caselli2020-02-282-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The databases package is an old alias to the dialect package, and its usage is now deprecated Change-Id: I5343a2d270ed5a8c654b9fe13dff40cdf54649ed
* | | | Update dialect API documentationMike Bayer2020-03-022-60/+128
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | The docstrings for connect() and on_connect() were incorrect between Dialect vs. DefaultDialect. Redocumented related methods, clean up formatting, and remove unicode-related attribute descriptions from the top level Dialect document as these don't apply to Python 3. Change-Id: I45baab757f8e20627eba42c30b9e8dbe26356275
* | | Merge "Discontinue dynamic __visit_name__"mike bayer2020-03-023-42/+31
|\ \ \
| * | | Discontinue dynamic __visit_name__Mike Bayer2020-03-013-42/+31
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | Removed very antiquated logic that checks if __visit_name__ is a property. There's no need for this as the compiler can handle switching between implementations. Convert _compile_dispatch() to be fully inlined. Change-Id: Ic0c7247c2d7dfed93a27f09250a8ed6352370764
* | | Merge "While parsing for check constraints, ignore newline characters in the ↵mike bayer2020-03-011-2/+8
|\ \ \ | | | | | | | | | | | | check condition"
| * | | While parsing for check constraints, ignore newline characters in the check ↵Eric Borczuk2020-02-291-2/+8
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | condition Fixed bug where PostgreSQL reflection of CHECK constraints would fail to parse the constraint if the SQL text contained newline characters. The regular expression has been adjusted to accommodate for this case. Pull request courtesy Eric Borczuk. Fixes: #5170 Closes: #5172 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5172 Pull-request-sha: 5701b7f09f723b727bbee95d19d107d6cc1d7717 Change-Id: If727e9140b645e8b685c3476fb0fa4417c1e6526
* | | Merge "Open up check for relationships that write to the same column"mike bayer2020-02-292-10/+46
|\ \ \ | |/ / |/| |
| * | Open up check for relationships that write to the same columnMike Bayer2020-02-272-10/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enhanced logic that tracks if relationships will be conflicting with each other when they write to the same column to include simple cases of two relationships that should have a "backref" between them. This means that if two relationships are not viewonly, are not linked with back_populates and are not otherwise in an inheriting sibling/overriding arrangement, and will populate the same foreign key column, a warning is emitted at mapper configuration time warning that a conflict may arise. A new parameter :paramref:`.relationship.overlaps` is added to suit those very rare cases where such an overlapping persistence arrangement may be unavoidable. Fixes: #5171 Change-Id: Ifae5998fc1c7e49ce059aec8a67c80cabee768ad
* | | Merge "Remove print statement in favor of print() function in docs and examples"mike bayer2020-02-2811-45/+45
|\ \ \ | |/ / |/| |
| * | Remove print statement in favor of print() function in docs and examplesAlbert Tugushev2020-02-2611-45/+45
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <!-- Provide a general summary of your proposed changes in the Title field above --> ### Description <!-- Describe your changes in detail --> Remove print statements ### Checklist <!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once) --> This pull request is: - [X] A documentation / typographical error fix - Good to go, no issue or tests are needed - [ ] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [ ] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. **Have a nice day!** Closes: #5166 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5166 Pull-request-sha: 04a7394f71298322188f0861b4dfe93e5485839d Change-Id: Ib90a59fac929661a18748c6e44966fb87e3978c6
* | Don't call pre_ping for fresh connectionMike Bayer2020-02-261-11/+21
|/ | | | | | | | | | The pool "pre-ping" feature has been refined to not invoke for a DBAPI connection that was just opened in the same checkout operation. pre ping only applies to a DBAPI connection that's been checked into the pool and is being checked out again. Fixes: #4524 Change-Id: Ibe3dfb709dbdc24aa94e96513cfbea456c33b895
* Merge "Clean up test_types.py in test suite"mike bayer2020-02-241-65/+71
|\
| * Clean up test_types.py in test suiteGord Thompson2020-02-231-65/+71
| | | | | | | | | | | | | | Convert connectionless execution calls to use preferred methods Change-Id: I64c49cb9b495007d43fc6c83e677a19cc2c6c9b9
* | Remove needless clauseelement check for batchMike Bayer2020-02-241-3/+2
| | | | | | | | | | | | | | | | Also document more detail as to why SQL expression support is not turned on for batch. Fixes: #5165 Change-Id: Ia93bbf75f22b8781400086c45b86a60ef9cec360
* | Deprecate row.keys() for 2.0, not 1.xMike Bayer2020-02-241-4/+3
| | | | | | | | | | | | | | | | | | | | | | row.keys() is used by any use case that applies dict() to a row. Access of elements by string key is also a 2.0 deprecation not 1.4 so for rudimental dict(row) support make sure that is all a 2.0 thing. Fixes current Alembic test suite. Change-Id: I895496324133d615676cd76bc5f2c5f4a83e9131
* | Merge "Ensure schema-level table includes annotations in caching"mike bayer2020-02-241-1/+1
|\ \ | |/ |/|
| * Ensure schema-level table includes annotations in cachingMike Bayer2020-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | In 29330ec159 we ensured that annotations are part of cache keys. However we failed to do so for the schema-level Table which will definitely need to distinguish between ORM and non-ORM annotated tables when caching, so ensure this is part of the cache key. Change-Id: I8d996873f2d7fa63230ef837db7e69a0101973b2
* | Ensure descendants of mixins don't become cacheableMike Bayer2020-02-222-10/+14
|/ | | | | | | | | | HasPrefix / HasSuffixes / SupportsCloneAnnotations exported a _traverse_internals attribute that does not represent a complete traversal, meaning non-traversible subclasses would seem traversible. rename these attributes so that this does not occur. DML is currently not traversible (will be soon). Change-Id: I2605e61c8c3d49965335e66e09f4aeedc5e73bd3
* Merge "Repair inline flag"mike bayer2020-02-223-7/+9
|\
| * Repair inline flagMike Bayer2020-02-223-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 9fca5d827d we attempted to deprecate the "inline=True" flag and add a generative inline() method, however failed to include any tests and the method was implemented incorrectly such that it would get overwritten with the boolean flag immediately. Rename the internal "inline" flag to "_inline" and add test support both for the method as well as deprecated support for the flag, including a fixture addition to assert the expected value of the flag as it generally does not affect the actual compiled SQL string. Change-Id: I0450049f17f1f0d91e22d27f1a973a2b6c0e59f7
* | Merge remote-tracking branch 'origin/pr/5141'Mike Bayer2020-02-222-4/+4
|\ \ | | | | | | | | | Change-Id: If7e15115de22b0aa562a93f09d2287966914d96c
| * | fix documentation typosFederico Caselli2020-02-082-4/+4
| | | | | | | | | | | | Change-Id: I4376910ae1cf6bf27226f049d4cf2d0e6ba2a83b
* | | Update test_unicode and move to test suiteGord Thompson2020-02-222-0/+207
| |/ |/| | | | | | | | | | | | | External dialects will definitely want to be able to test their handling of Unicode table/column names. Change-Id: If1b67cf170dc9e4a42e3f51760ced8ddb7a34fcf
* | Result initial introductionMike Bayer2020-02-2128-1028/+1836
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This builds on cc718cccc0bf8a01abdf4068c7ea4f3 which moved RowProxy to Row, allowing Row to be more like a named tuple. - KeyedTuple in ORM is replaced with Row - ResultSetMetaData broken out into "simple" and "cursor" versions for ORM and Core, as well as LegacyCursor version. - Row now has _mapping attribute that supplies full mapping behavior. Row and SimpleRow both have named tuple behavior otherwise. LegacyRow has some mapping features on the tuple which emit deprecation warnings (e.g. keys(), values(), etc). the biggest change for mapping->tuple is the behavior of __contains__ which moves from testing of "key in row" to "value in row". - ResultProxy breaks into ResultProxy and FutureResult (interim), the latter has the newer APIs. Made available to dialects using execution options. - internal reflection methods and most tests move off of implicit Row mapping behavior and move to row._mapping, result.mappings() method using future result - a new strategy system for cursor handling replaces the various subclasses of RowProxy - some execution context adjustments. We will leave EC in but refined things like get_result_proxy() and out parameter handling. Dialects for 1.4 will need to adjust from get_result_proxy() to get_result_cursor_strategy(), if they are using this method - out parameter handling now accommodated by get_out_parameter_values() EC method. Oracle changes for this. external dialect for DB2 for example will also need to adjust for this. - deprecate case_insensitive flag for engine / result, this feature is not used mapping-methods on Row are deprecated, and replaced with Row._mapping.<meth>, including: row.keys() -> use row._mapping.keys() row.items() -> use row._mapping.items() row.values() -> use row._mapping.values() key in row -> use key in row._mapping int in row -> use int < len(row) Fixes: #4710 Fixes: #4878 Change-Id: Ieb9085e9bcff564359095b754da9ae0af55679f0
* | Deprecate connection branchingMike Bayer2020-02-2111-146/+303
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The :meth:`.Connection.connect` method is deprecated as is the concept of "connection branching", which copies a :class:`.Connection` into a new one that has a no-op ".close()" method. This pattern is oriented around the "connectionless execution" concept which is also being removed in 2.0. As part of this change we begin to move the internals away from "connectionless execution" overall. Remove the "connectionless execution" concept from the reflection internals and replace with explicit patterns at the Inspector level. Fixes: #5131 Change-Id: Id23d28a9889212ac5ae7329b85136157815d3e6f
* | Merge "Remove unnecessary tuple; prepare for "iterator" verbiage"mike bayer2020-02-201-16/+16
|\ \
| * | Remove unnecessary tuple; prepare for "iterator" verbiageMike Bayer2020-02-201-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove a tuple surrounding a generator expression that is immediately iterated in any case. Additionally note that the bulk methods can likely accept non-list objects such as arbitrary iterables, however without test coverage this is not yet guaranteed; use the term "sequence" for now. Also added a warmup to a cache key profiling test to get consistent results. Fixes: #5163 Change-Id: If838fe214da574763115855c1a65171533c96e64
* | | Modernize test_rowcount and move to dialect suiteMike Bayer2020-02-192-0/+156
|/ / | | | | | | | | | | | | Amazingly there are no "rowcount" tests in suite, so these tests should definitely be there. Change-Id: Ib4c595fe6e16b457680ce4ee01180ccc8ddb6a40
* | Merge "Replace engine.execute w/ context manager (step1)"mike bayer2020-02-195-109/+115
|\ \
| * | Replace engine.execute w/ context manager (step1)Gord Thompson2020-02-175-109/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | First (baby) step at replacing engine.execute calls in test code with the new preferred way of executing. MSSQL was targeted because it was the easiest for me to test locally. Change-Id: Id2e02f0e39007cbfd28ca6a535115f53c6407015
* | | Merge "Pass DDLCompiler IdentifierPreparer to visit_ENUM"mike bayer2020-02-171-3/+8
|\ \ \
| * | | Pass DDLCompiler IdentifierPreparer to visit_ENUMMike Bayer2020-02-171-3/+8
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where the "schema_translate_map" feature would not work with a PostgreSQL native enumeration type (i.e. :class:`.Enum`, :class:`.postgresql.ENUM`) in that while the "CREATE TYPE" statement would be emitted with the correct schema, the schema would not be rendered in the CREATE TABLE statement at the point at which the enumeration was referenced. Fixes: #5158 Change-Id: I41529785de2e736c70a142c2ae5705060bfed73e
* | | Merge "Create initial future package, RemovedIn20Warning"mike bayer2020-02-1712-100/+351
|\ \ \
| * | | Create initial future package, RemovedIn20WarningMike Bayer2020-02-1212-100/+351
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reorganization of Select() is the first major element of the 2.0 restructuring. In order to start this we need to first create the new Select constructor and apply legacy elements to the old one. This in turn necessitates starting up the RemovedIn20Warning concept which itself need to refer to "sqlalchemy.future", so begin to establish this basic framework. Additionally, update the DML constructors with the newer no-keyword style. Remove the use of the "pending deprecation" and fix Query.add_column() deprecation which was not acting as deprecated. Fixes: #4845 Fixes: #4648 Change-Id: I0c7a22b2841a985e1c379a0bb6c94089aae6264c
* | | | Merge "Begin to disallow back_populates with viewonly=True"mike bayer2020-02-171-0/+21
|\ \ \ \
| * | | | Begin to disallow back_populates with viewonly=TrueMike Bayer2020-02-111-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A viewonly=True relationship should not be mutated and ideally mutation itself would raise an error, but we're not there yet. Warn when a viewonly is to be the target of a back_populates as this only means that it should be locally mutated, which by definition will not work as expected because post-flush it will deliver doubled results, due to its state not being reset. Setting a relationship to viewonly=True which is also the target of a back_populates or backref configuration will now emit a warning and eventually be disallowed. back_populates refers specifically to mutation of an attribute or collection, which is disallowed when the attribute is subject to viewonly=True. The viewonly attribute is not subject to persistence behaviors which means it will not reflect correct results when it is locally mutated. Fixes: #5149 Change-Id: Ie51382a82e1a0ff5f3cf2cdbded780e77ace7f5f
* | | | | Limit non-backend critical profiling tests to SQLiteMike Bayer2020-02-171-1/+4
| |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | issues with backend-specific profiling should be limited to tests that are explcitly against resultset, compiler, etc. MySQL in particular has an often varying callcount that isn't worth running these tests against nor is it worth profiling them for other backends like Oracle and SQL Server. Also add the REQUIRE_SQLALCHEMY_CEXT flag to the regen_callcounts.tox.ini script, which is part of some review somewhere but is needed here to generate callcounts correctly. Add a "warmup" phase for some of the ORM tests for join conditions that have varying profile counts based on whether mappings have been used already or not; profiling should always be against the "warmed up" version of a function. Change-Id: If483820235fa4cc4360cbd067a9b68d83512d587
* | | | Merge "Document new LIMIT/OFFSET support; support subquery ORDER BY"mike bayer2020-02-131-8/+21
|\ \ \ \
| * | | | Document new LIMIT/OFFSET support; support subquery ORDER BYMike Bayer2020-02-131-8/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An adjustment to the original commit for the fix to #5084 in ab1799a2a1951fe8f188b6395fde04a233a3ac0d, correctly rendering ORDER BY for subqueries with the new syntax. Fixes: #5084 Change-Id: I5ab5c1887c5a10f0a5eed1e9aae1f5994c28d88e
* | | | | Fractional seconds starts at Python 3.7Mike Bayer2020-02-131-0/+7
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | CI didn't notice that the fractional seconds in the new SQL Server DATETIMEOFFSET test are not available on Python 3.6. It was inadvertently assumed this was a Python 2 incompatibility. Change-Id: I9839eafbf7c37512eef1ecf666846983f9651c02
* | | | Improve ResultProxy/Row documentation before the API changeMike Bayer2020-02-131-38/+75
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We'd like to merge Ieb9085e9bcff564359095b754da9ae0af55679f0, however the documentation in that change should be based off of more comprehensive documentation than what we have already. Add the notion of "row" to the tutorial and document all methods. This will also be backported at least to 1.3 in terms of RowProxy. Change-Id: I2173aecc86cf15c5a7c473b8f471639ee9082f84
* | | Fix handling of None as parameter for a datetimeoffset columnGord Thompson2020-02-101-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where the :class:`.mssql.DATETIMEOFFSET` type would not accommodate for the ``None`` value, introduced as part of the series of fixes for this type first introduced in :ticket:`4983`, :ticket:`5045`. Additionally, added support for passing a backend-specific date formatted string through this type, as is typically allowed for date/time types on most other DBAPIs. Fixes: #5132 Change-Id: Iab05d67382e0f550474d50e0c3c1c888521b678a
* | | Merge "Rework combination exclusions"mike bayer2020-02-102-77/+132
|\ \ \
| * | | Rework combination exclusionsMike Bayer2020-02-102-77/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The technique arrived at for doing exclusions inside of combinations relies upon comparing all the arguments in a particular combination to some set of combinations that were gathered as having "exclusions". This logic is actually broken for the case where the @testing.combinations has an "id", but if we fix that, we still have the issue of all the arguments being compared, which is complicated and also doesn't work for the case of a py2/py3 incompatibility like a timezone that has fractional minutes or seconds in it. It's also not clear if a @testing.combinations that uses lambdas will work either (maybe it does though because lambdax == lambdax compares...). anyway, this patch reworks it so that we hit this on the decorator side instead, where we add our own decorator and go through the extra effort to create a decorator that accepts an extra argument of "exclusions" which we can then check in a way that is local to the whole pytest @combinations thing in the first place. The only difficulty is that pytest is very sneaky about looking at the test function so we need to make sure __wrapped__ isn't set when doing this. Change-Id: Ic57aae15b378e0f4ed009e4e82ae7ba73fb6dfc5
* | | | Fixes for public_factory and mysql/pg dml functionsMike Bayer2020-02-087-73/+118
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ensure that the location indicated by public_factory is importable * adjust all of sqlalchemy.sql.expression locations to be correct * support the case where a public_factory is against a function that has another public_factory already, and already replaced the __init__ on the target class * Use mysql.insert(), postgresql.insert(), don't include .dml in the class path. Change-Id: Iac285289455d8d7102349df3814f7cedc758e639
* | | Vendor inspect.formatannotationMike Bayer2020-02-071-2/+13
| |/ |/| | | | | | | | | | | | | | | | | Vendored the ``inspect.formatannotation`` function inside of ``sqlalchemy.util.compat``, which is needed for the vendored version of ``inspect.formatargspec``. The function is not documented in cPython and is not guaranteed to be available in future Python versions. Fixes: #5138 Change-Id: I76bdddc28507fb1b4403f1b718d6f9cc2fb6d93c