summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge "Add "empty in" strategies; default to "static""mike bayer2017-03-143-32/+108
|\
| * Add "empty in" strategies; default to "static"Mike Bayer2017-03-143-32/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The longstanding behavior of the :meth:`.Operators.in_` and :meth:`.Operators.not_in_` operators emitting a warning when the right-hand condition is an empty sequence has been revised; a new flag :paramref:`.create_engine.empty_in_strategy` allows an empty "IN" expression to generate a simple boolean expression, or to invoke the previous behavior of dis-equating the expression to itself, with or without a warning. The default behavior is now to emit the simple boolean expression, allowing an empty IN to be evaulated without any performance penalty. Change-Id: I65cc37f2d7cf65a59bf217136c42fee446929352 Fixes: #3907
* | Improve serializer behaviorMike Bayer2017-03-141-16/+32
| | | | | | | | | | | | | | | | | | | | Fix an issue where the Annotated system needs to have a __reduce__ method, also see why we can't default to HIGHEST_PROTOCOL. This latter part might not be a good idea until 1.2 for compatibility reasons. Change-Id: I0239e38259fc768c9e3b6c448c29161e271a969c Fixes: #3918
* | Emit after_rollback() event before snapshot removalMike Bayer2017-03-142-14/+66
|/ | | | | | | | | | | | The state of the :class:`.Session` is now present when the :meth:`.SessionEvents.after_rollback` event is emitted, that is, the attribute state of objects prior to their being expired. This is now consistent with the behavior of the :meth:`.SessionEvents.after_commit` event which also emits before the attribute state of objects is expired. Change-Id: I9c572656ec5a9bfaeab817e9c95107c75aca1b51 Fixes: #3934
* Enable sane_multi_rowcount for cx_OracleMike Bayer2017-03-141-3/+31
| | | | | | | Also add some tests to test_rowcount. Change-Id: Idaa18fdc4fcfeb615725531c37de77decf76a783 Fixes: #3932
* add autoescape option to startswith, endswith, and containsDiana Clarke2017-03-141-13/+111
| | | | | | Fixes: #2694 Change-Id: I34c0bdcb01c2b76b9ab6cd315dae13e3dd8a502b Pull-request: https://github.com/zzzeek/sqlalchemy/pull/207
* - add ad_hoc_engines to remove RealReconnectTest from oracleMike Bayer2017-03-141-1/+1
| | | | Change-Id: Ie40aeba87dcfe9e8216abb8be050e7c2cc5b5ec9
* Normalize Oracle reflected FK constraint nameMike Bayer2017-03-131-0/+6
| | | | | | | | | | | | | Oracle reflection now "normalizes" the name given to a foreign key constraint, that is, returns it as all lower case for a case insensitive name. This was already the behavior for indexes and primary key constraints as well as all table and column names. This will allow Alembic autogenerate scripts to compare and render foreign key constraint names correctly when initially specified as case insensitive. Change-Id: Ibb34ec6ce7cb244d1c4ae9d44ce2d37d37227e69 Fixes: #3276
* - re-set no ad-hoc-engines for oracle, previously low-connectionsMike Bayer2017-03-131-0/+4
| | | | | | disabled this Change-Id: I3ceceaea7a3969248121ff4dc97c11296831fc99
* Add tests for empty association set comparisonMike Bayer2017-03-131-1/+25
| | | | | | | | This seems to only occur in python 2.6, adding tests to ensure it stays Change-Id: Id714680970bf1f70e2fe06b0c8688b7c5a6b6b0c Fixes: #3265
* Repair _execute_scalar for WITH_UNICODE modeMike Bayer2017-03-131-2/+2
| | | | | | | | | | | | | | | | | cx_Oracle 5.3 seems to code this flag ON now, so remove the warning and ensure WITH_UNICODE handling works. Additionally, the XE setup on jenkins is having more problems here, in particular low-connections mode is causing cx_Oracle to fail more frequently now. Turning off low-connections fixes those but then we get the TNS errors, so adding an emergency "retry" flag that is not yet a feature available to users. Real world applications are not dropping/creating thousands of tables the way our test suite is. Change-Id: Ie95b0e697276c404d3264c2e624e870463d966d6 Fixes: #3937
* Allow SchemaType and Variant to work togetherMike Bayer2017-03-074-10/+176
| | | | | | | | | | | | | | Added support for the :class:`.Variant` and the :class:`.SchemaType` objects to be compatible with each other. That is, a variant can be created against a type like :class:`.Enum`, and the instructions to create constraints and/or database-specific type objects will propagate correctly as per the variant's dialect mapping. Also added testing for some potential double-event scenarios on TypeDecorator but it seems usually this doesn't occur. Change-Id: I4a7e7c26b4133cd14e870f5bc34a1b2f0f19a14a Fixes: #2892
* Repair missing "checkfirst" for test suiteMike Bayer2017-03-071-0/+1
| | | | | | | | the test_metadata tests trigger the before_create dispatch without the checkfirst flag. Postgresql backend should be able to tolerate this. Change-Id: Ife497cc3a4eb2812462116f94aad732864225f3f
* Don't cache savepoint identifiersMike Bayer2017-03-061-4/+46
| | | | | | | | | | | | | | | | | | | | | | | | Fixed bug in compiler where the string identifier of a savepoint would be cached in the identifier quoting dictionary; as these identifiers are arbitrary, a small memory leak could occur if a single :class:`.Connection` had an unbounded number of savepoints used, as well as if the savepoint clause constructs were used directly with an unbounded umber of savepoint names. The memory leak does **not** impact the vast majority of cases as normally the :class:`.Connection`, which renders savepoint names with a simple counter starting at "1", is used on a per-transaction or per-fixed-number-of-transactions basis before being discarded. The savepoint name in virtually all cases does not require quoting at all, however to support potential third party use cases the "check for quotes needed" logic is retained, at a small performance cost. Uncondtionally quoting the name is another option, but this would turn the name into a case sensitive name which runs the risk of poor interactions with existing deployments that may be looking at these names in other contexts. Change-Id: I6b53c96abf7fdf1840592bbca5da81347911844c Fixes: #3931
* Update profiles for psycopg2 2.7Mike Bayer2017-03-061-72/+72
| | | | | | | psycopg2 has updated their unicode / string handling, greatly reducing callcounts on Python 2.x. Change-Id: Idffd242b303ffea9c7733068a4be290da4dbe679
* Only use schema_translate_map on SchemaItem subclassesMike Bayer2017-02-281-1/+45
| | | | | | | | | | | | | Fixed bug in new "schema translate" feature where the translated schema name would be invoked in terms of an alias name when rendered along with a column expression; occurred only when the source translate name was "None". The "schema translate" feature now only takes effect for :class:`.SchemaItem` and :class:`.SchemaType` subclasses, that is, objects that correspond to a DDL-creatable structure in a database. Change-Id: Ie8cb35aeaba2c67efec8c8c57c219e4dd346e44a Fixes: #3924
* Performance within instances()Mike Bayer2017-02-232-82/+117
| | | | | | | | | | | | | | | | Continuing from Ie43beecf37945b2bb7fff0aaa597a597293daa18, also observed is the overhead of PathRegsitry memoized token functions, as these paths are not cached in the case of long joinedloader chains. The memoizations here were made with short paths in mind, and have been replaced with an inlined straight create of these paths up front, producing callcounts very similar to 0.8. Combined with the previous optimizations, 1.1 now runs the "joined eager load of one row" worst case test in about 40% fewer calls than 0.8 and 60% fewer than 1.1.5. Change-Id: Ib5e1c1345a1dd8edfbdb3fed06eb717d4e164d31 Fixes: #3915
* Merge "Memoize AliasedClass, ClauseAdapter objects in joined eager load"mike bayer2017-02-222-325/+487
|\
| * Memoize AliasedClass, ClauseAdapter objects in joined eager loadMike Bayer2017-02-162-325/+487
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Addressed some long unattended performance concerns within the joined eager loader query construction system. The use of ad-hoc :class:`.AliasedClass` objects per query, which produces lots of column lookup overhead each time, has been replaced with a cached approach that makes use of a small pool of :class:`.AliasedClass` objects that are reused between invocations of joined eager loading. Callcount reduction of SQL query generation for worst-case joined loader scenarios (lots of joins, lots of columns) is reduced by approximately 270%. Change-Id: Ie43beecf37945b2bb7fff0aaa597a597293daa18 Fixes: #3915
* | - add test for inserting PG array w/ NULL, references #3916Mike Bayer2017-02-161-0/+9
|/ | | | Change-Id: I87be274c1ba019b41744a5a76c1b5e9334564ec8
* Add new DDL autocommit expressions for PostgresqlMike Bayer2017-02-131-0/+11
| | | | | | | | | | | | | | Added regular expressions for the "IMPORT FOREIGN SCHEMA", "REFRESH MATERIALIZED VIEW" Postgresql statements so that they autocommit when invoked via a connection or engine without an explicit transaction. Pull requests courtesy Frazer McLean and Paweł Stiasny. Fixes: #3840 Co-authored-by: Frazer McLean Co-authored-by: Paweł Stiasny Change-Id: I92b2b61683d29d57fa23a66a3559120cb1241c2f Pull-request: https://github.com/zzzeek/sqlalchemy/pull/323
* - limit to MySQL dialectMike Bayer2017-02-131-0/+2
| | | | Change-Id: I2781e1e2221d89c75dd65ff49490d9c409967930
* - pull autocommit suite into the mysql suite as wellMike Bayer2017-02-131-0/+9
| | | | Change-Id: If1106f7f125739e69ad2482f65b8f37672a76c9e
* - add a test suite that ensures textual autocommit worksMike Bayer2017-02-131-0/+56
| | | | | | for correct expressions Change-Id: I17d35169be914924828487abba05658dff380f2a
* Check for columns not part of mapping, correct mapping for eager_defaultsMike Bayer2017-02-091-1/+73
| | | | | | | | | | | | | Fixed two closely related bugs involving the mapper eager_defaults flag in conjunction with single-table inheritance; one where the eager defaults logic would inadvertently try to access a column that's part of the mapper's "exclude_properties" list (used by Declarative with single table inheritance) during the eager defaults fetch, and the other where the full load of the row in order to fetch the defaults would fail to use the correct inheriting mapper. Fixes: #3908 Change-Id: Ie745174c917d512e2c46d9e3cc14512cde53cc9a
* Don't post-SELECT columns w/o a server default/onupdate for eager_defaultsMike Bayer2017-02-081-0/+40
| | | | | | | | | | | | | | Fixed a major inefficiency in the "eager_defaults" feature whereby an unnecessary SELECT would be emitted for column values where the ORM had explicitly inserted NULL, corresponding to attributes that were unset on the object but did not have any server default specified, as well as expired attributes on update that nevertheless had no server onupdate set up. As these columns are not part of the RETURNING that eager_defaults tries to use, they should not be post-SELECTed either. Change-Id: I0d4f1e9d3d9717d68dcc0592f69456a1f1c36df8 Fixes: #3909
* Make all tests to be PEP8 compliantKhairi Hafsham2017-02-07150-10399/+11589
| | | | | | | | tested using pycodestyle version 2.2.0 Fixes: #3885 Change-Id: I5df43adc3aefe318f9eeab72a078247a548ec566 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/343
* Accept FetchedValue, text() for column "default" valueMike Bayer2017-02-011-3/+50
| | | | | | | | | | | | | Fixed bug whereby the :meth:`.DDLEvents.column_reflect` event would not allow a non-textual expression to be passed as the value of the "default" for the new column, such as a :class:`.FetchedValue` object to indicate a generic triggered default or a :func:`.sql.expression.text` construct. Clarified the documentation in this regard as well. Fixes: #3905 Change-Id: I829796c3e9f87f375149bebee7eef133a6876d4d
* Union the exclude_properties of the inheriting mapper in declarativeMike Bayer2017-01-301-1/+38
| | | | | | | | | | Fixed bug where the "automatic exclude" feature of declarative that ensures a column local to a single table inheritance subclass does not appear as an attribute on other derivations of the base would not take effect for multiple levels of subclassing from the base. Change-Id: Ibf67b631b4870dd1bd159f7d6085549d299fffe0 Fixes: #3895
* Merge "Add count(), scalar() to baked query"mike bayer2017-01-301-1/+38
|\
| * Add count(), scalar() to baked queryMike Bayer2017-01-301-1/+38
| | | | | | | | | | Change-Id: I8af0d7b41ae2df384ce5d0ef274732352d81f376 Fixes: #3897
* | Fix nested index_property setter when there is no container valueJeong YunWon2017-01-301-0/+14
|/ | | | | | | | | Fixed bug in new :mod:`sqlalchemy.ext.indexable` extension where setting of a property that itself refers to another property would fail. Fixes: #3901 Change-Id: I203a66117e2399afee11a34f43f0e93adfc6d571
* Copy whereclause / using in ExcludeConstraintMike Bayer2017-01-301-0/+24
| | | | | | | | | Fixed bug in Postgresql :class:`.ExcludeConstraint` where the "whereclause" and "using" parameters would not be copied during an operation like :meth:`.Table.tometadata`. Change-Id: I2f704981d4d4862f9c82a50272006fab8becebb6 Fixes: #3900
* Dont set _set_select_from() for alias objectMike Bayer2017-01-191-0/+79
| | | | | | | | | | | Fixed bug first introduced in 0.9.7 as a result of :ticket:`3106` which would cause an incorrect query in some forms of multi-level subqueryload against aliased entities, with an unnecessary extra FROM entity in the innermost subquery. Fixes: #3893 Change-Id: Ic4003c2c1c0206bd22a098fd497a7375c2758305
* - this test is too brittle under load, not worth it, remove itMike Bayer2017-01-171-59/+0
| | | | Change-Id: I3f294b4d153979c308532360d03ab7be3c5d994a
* Merge "Parse (but don't record) COMMENT portion of MySQL table key"mike bayer2017-01-171-0/+12
|\
| * Parse (but don't record) COMMENT portion of MySQL table keyLele Long2017-01-171-0/+12
| | | | | | | | | | | | | | | | | | | | | | The MySQL dialect now will not warn when a reflected column has a "COMMENT" keyword on it, but note however the comment is not yet reflected; this is on the roadmap for a future release. Pull request courtesy Lele Long. Fixes: #3867 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/324 Change-Id: I869e29aba6766d0eda1e59af09a3e8e3748a3942
* | Add support for prefixes on CREATE INDEX statements in MySQLJoseph Schorr2017-01-171-0/+8
|/ | | | | | | | | Added a new parameter ``mysql_prefix`` supported by the :class:`.Index` construct, allows specification of MySQL-specific prefixes such as "FULLTEXT". Pull request courtesy Joseph Schorr. Change-Id: I5a21fa466fdfd4d9e39e1fb4ecec1eab93b92c36 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/339
* Merge "Better hide engine password"mike bayer2017-01-161-5/+7
|\
| * Better hide engine passwordValery Yundin2017-01-161-5/+7
| | | | | | | | | | | | | | | | | | | | Avoid putting engine password in the exception message in `MetaData.reflect` (since exception messages often appear in logs). Use the same redacted `__repr__` implementation in `TLEngine` as in its base class `Engine` Change-Id: Ic0a7baea917a9c8d87dffdd82ef566673ab08e02 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/327
* | Add "existing" populators for subqueryloadMike Bayer2017-01-161-1/+120
|/ | | | | | | | | | | | Fixed bug in subquery loading where an object encountered as an "existing" row, e.g. already loaded from a different path in the same query, would not invoke subquery loaders for unloaded attributes that specified this loading. This issue is in the same area as that of :ticket:`3431`, :ticket:`3811` which involved similar issues with joined loading. Change-Id: If111a76b0812010905b0ac811276a816779d297f Fixes: #3854
* Merge "Use full column->type processing for ON CONFLICT SET clause"mike bayer2017-01-132-4/+84
|\
| * Use full column->type processing for ON CONFLICT SET clauseMike Bayer2017-01-132-4/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug in new "ON CONFLICT DO UPDATE" feature where the "set" values for the UPDATE clause would not be subject to type-level processing, as normally takes effect to handle both user-defined type level conversions as well as dialect-required conversions, such as those required for JSON datatypes. Additionally, clarified that the keys in the set_ dictionary should match the "key" of the column, if distinct from the column name. A warning is emitted for remaining column names that don't match column keys; for compatibility reasons, these are emitted as they were previously. Fixes: #3888 Change-Id: I67a04c67aa5f65e6d29f27bf3ef2f8257088d073
* | Merge "Support python3.6"mike bayer2017-01-1323-82/+84
|\ \ | |/ |/|
| * Support python3.6Mike Bayer2017-01-1323-82/+84
| | | | | | | | | | | | | | | | | | | | | | Corrects some warnings and adds tox config. Adds DeprecationWarning to the error category. Large sweep for string literals w/ backslashes as this is common in docstrings Co-authored-by: Andrii Soldatenko Fixes: #3886 Change-Id: Ia7c838dfbbe70b262622ed0803d581edc736e085 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/337
* | Merge "Pass **kw to bound params in multi values"mike bayer2017-01-121-0/+12
|\ \ | |/ |/|
| * Pass **kw to bound params in multi valuesMike Bayer2017-01-091-0/+12
| | | | | | | | | | | | | | | | | | Fixed bug where literal_binds compiler flag was not honored by the :class:`.Insert` construct for the "multiple values" feature; the subsequent values are now rendered as literals. Change-Id: I81ac358fd59995885d482e7571620090210865d2 Fixes: #3880
* | Merge "Adapt from "localparent" in joinedloader"mike bayer2017-01-091-1/+71
|\ \ | |/ |/|
| * Adapt from "localparent" in joinedloaderMike Bayer2017-01-091-1/+71
| | | | | | | | | | | | | | | | | | | | Fixed bug involving joined eager loading against multiple entities when polymorphic inheritance is also in use which would throw "'NoneType' object has no attribute 'isa'". The issue was introduced by the fix for :ticket:`3611`. Change-Id: I296ecda38c01ec8f69dcd843beaebed6949cecfa Fixes: #3884
* | Tighten rules for order_by(Label) resolutionMike Bayer2017-01-061-0/+50
|/ | | | | | | | | | | | | | | | - Fixed bug originally introduced in 0.9 via :ticket:`1068` where order_by(<some Label()>) would order by the label name based on name alone, that is, even if the labeled expression were not at all the same expression otherwise present, implicitly or explicitly, in the selectable. The logic that orders by label now ensures that the labeled expression is related to the one that resolves to that name before ordering by the label name; additionally, the name has to resolve to an actual label explicit in the expression elsewhere, not just a column name. This logic is carefully kept separate from the order by(textual name) feature that has a slightly different purpose. Change-Id: I44fc36dab34380cc238c1e79ecbe23f1628d588a Fixes: #3882