summaryrefslogtreecommitdiff
path: root/test/sql/test_constraints.py
Commit message (Collapse)AuthorAgeFilesLines
* Apply SQL compilation to sqltext for column-level CHECK constraintMike Bayer2017-04-041-0/+13
| | | | | | | | | | | | | Fixed bug where a column-level :class:`.CheckConstraint` would fail to compile the SQL expression using the underlying dialect compiler as well as apply proper flags to generate literal values as inline, in the case that the sqltext is a Core expression and not just a plain string. This was long-ago fixed for table-level check constraints in 0.9 as part of :ticket:`2742`, which more commonly feature Core SQL expressions as opposed to plain string expressions. Change-Id: I1301ba4b40063e91bc47726aecc5f4990ffcaeda Fixes: #3957
* Make all tests to be PEP8 compliantKhairi Hafsham2017-02-071-15/+11
| | | | | | | | tested using pycodestyle version 2.2.0 Fixes: #3885 Change-Id: I5df43adc3aefe318f9eeab72a078247a548ec566 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/343
* - Consoliate test/sql/test_constraint ConstraintAPITestMike Bayer2016-07-301-342/+0
| | | | | | | and test/sql/test_metadata IndexTest into test/sql/test_metadata ConstraintTest Change-Id: I7aeee9a1edbbd889200afc393695f73d5fbac3f3
* - Fixed bug in enhanced constraint-attachment logic introduced inMike Bayer2015-05-021-0/+59
| | | | | | | | | | | :ticket:`3341` where in the unusual case of a constraint that refers to a mixture of :class:`.Column` objects and string column names at the same time, the auto-attach-on-column-attach logic will be skipped; for the constraint to be auto-attached in this case, all columns must be assembled on the target table up front. Added a new section to the migration document regarding the original feature as well as this change. fixes #3411
* - repair a regression caused by #3282, where we no longer wereMike Bayer2015-04-221-78/+276
| | | | | | | | | | applying any topological sort to tables on SQLite. See the changelog for details, but we now continue to sort tables for SQLite on DROP, prohibit the sort from considering alter, and only warn if we encounter an unresolvable cycle, in which case, then we forego the ordering. use_alter as always is used to break such a cycle. fixes #3378
* - The "auto-attach" feature of constraints such as :class:`.UniqueConstraint`Mike Bayer2015-03-241-0/+97
| | | | | | | | | | and :class:`.CheckConstraint` has been further enhanced such that when the constraint is associated with non-table-bound :class:`.Column` objects, the constraint will set up event listeners with the columns themselves such that the constraint auto attaches at the same time the columns are associated with the table. This in particular helps in some edge cases in declarative but is also of general use. fixes #3341
* - The :class:`.CheckConstraint` construct now supports namingMike Bayer2015-01-301-1/+1
| | | | | | | | | | conventions that include the token ``%(column_0_name)s``; the constraint expression is scanned for columns. Additionally, naming conventions for check constraints that don't include the ``%(constraint_name)s`` token will now work for :class:`.SchemaType`- generated constraints, such as those of :class:`.Boolean` and :class:`.Enum`; this stopped working in 0.9.7 due to :ticket:`3067`. fixes #3299
* - rework assertsql system, fixes #3293Mike Bayer2015-01-181-6/+6
|
* - restate sort_tables in terms of a more fine grainedMike Bayer2015-01-011-26/+181
| | | | | | | | | | | | | sort_tables_and_constraints function. - The DDL generation system of :meth:`.MetaData.create_all` and :meth:`.Metadata.drop_all` has been enhanced to in most cases automatically handle the case of mutually dependent foreign key constraints; the need for the :paramref:`.ForeignKeyConstraint.use_alter` flag is greatly reduced. The system also works for constraints which aren't given a name up front; only in the case of DROP is a name required for at least one of the constraints involved in the cycle. fixes #3282
* require check constraints for testsScott Dugas2014-10-231-0/+1
|
* - update the flake8 rules againMike Bayer2014-07-181-208/+208
| | | | - apply autopep8 + manual fixes to most of test/sql/
* - fix test failuresMike Bayer2014-06-211-3/+3
|
* - Liberalized the contract for :class:`.Index` a bit in that you canMike Bayer2014-04-191-10/+33
| | | | | | | specify a :func:`.text` expression as the target; the index no longer needs to have a table-bound column present if the index is to be manually added to the table, either via inline declaration or via :meth:`.Table.append_constraint`. fixes #3028
* - rename __multiple__ to __backend__, and apply __backend__ to a large ↵Mike Bayer2014-03-241-0/+2
| | | | | | number of tests. - move out logging tests from test_execute to test_logging
* Bug Fix: Stop generating bad sql if an empty UniqueConstraint() is givendonkopotamus2014-01-171-0/+22
|
* - Fixed bug in default compiler plus those of postgresql, mysql, andMike Bayer2013-10-121-0/+21
| | | | | | | | mssql to ensure that any literal SQL expression values are rendered directly as literals, instead of as bound parameters, within a CREATE INDEX statement. [ticket:2742] - don't need expression_as_ddl(); literal_binds and include_table take care of this functionality.
* genericize tests hereMike Bayer2013-06-041-5/+10
|
* - auto-append for CheckConstraint should skip table if the expression is againstMike Bayer2013-03-091-0/+13
| | | | a lower-case-t table
* :class:`.Index` now supports arbitrary SQL expressions and/orMike Bayer2013-01-161-1/+65
| | | | | | | | functions, in addition to straight columns. Common modifiers include using ``somecolumn.desc()`` for a descending index and ``func.lower(somecolumn)`` for a case-insensitive index, depending on the capabilities of the target backend. [ticket:695]
* - preparing for #695, modernize constraint/index testsMike Bayer2013-01-161-192/+371
|
* Fixed a regression caused by :ticket:`2410` whereby aMike Bayer2012-12-111-0/+39
| | | | | | | | | :class:`.CheckConstraint` would apply itself back to the original table during a :meth:`.Table.tometadata` operation, as it would parse the SQL expression for a parent table. The operation now copies the given expression to correspond to the new table. [ticket:2633]
* trying different approaches to test layout. in this one, the testing modulesMike Bayer2012-09-271-5/+6
| | | | | | | become an externally usable package but still remains within the main sqlalchemy parent package. in this system, we use kind of an ugly hack to get the noseplugin imported outside of the "sqlalchemy" package, while still making it available within sqlalchemy for usage by third party libraries.
* - [bug] Fixed the DropIndex construct to supportMike Bayer2012-09-241-0/+39
| | | | | an Index associated with a Table in a remote schema. [ticket:2571]
* -whitespace bonanza, contdMike Bayer2012-07-281-13/+13
|
* - [feature] Added "MATCH" clause to ForeignKey,Mike Bayer2012-06-211-1/+20
| | | | | ForeignKeyConstraint, courtesy Ryan Kelly. [ticket:2502]
* - [bug] All of UniqueConstraint, ForeignKeyConstraint,Mike Bayer2012-04-241-1/+42
| | | | | | | | | | | CheckConstraint, and PrimaryKeyConstraint will attach themselves to their parent table automatically when they refer to a Table-bound Column object directly (i.e. not just string column name), and refer to one and only one Table. Prior to 0.8 this behavior occurred for UniqueConstraint and PrimaryKeyConstraint, but not ForeignKeyConstraint or CheckConstraint. [ticket:2410]
* - sqlMike Bayer2012-04-011-6/+2
| | | | | | | | | | | | | | | - [bug] Removed warning when Index is created with no columns; while this might not be what the user intended, it is a valid use case as an Index could be a placeholder for just an index of a certain name. - mssql - [feature] Added interim create_engine flag supports_unicode_binds to PyODBC dialect, to force whether or not the dialect passes Python unicode literals to PyODBC or not.
* - [bug] Index will raise when arguments passedMike Bayer2012-02-121-0/+33
| | | | | | cannot be interpreted as columns or expressions. Will warn when Index is created with no columns at all. [ticket:2380]
* - [bug] the "name" of a column-level CHECK constraint,Mike Bayer2011-12-041-1/+12
| | | | | | if present, is now rendered in the CREATE TABLE statement using "CONSTRAINT <name> CHECK <expression>". [ticket:2305]
* - move all the comments that got shoved below the fixture grabs back upMike Bayer2011-03-271-0/+1
|
* - remove test.sql._base, test.engine._base, test.orm._base, move those ↵Mike Bayer2011-03-271-2/+2
| | | | | | | classes to a new test.lib.fixtures module - move testing.TestBase to test.lib.fixtures - massive search and replace
* - establish an "insert" option for events to control ordering if needed (not ↵Mike Bayer2011-02-251-0/+22
| | | | | | needed yet tho) - render foreign key constraints in the order in which they were cerated
* make it more explicit in tests which dialect we want to use for thingsMike Bayer2011-02-111-0/+1
|
* - Non-DBAPI errors which occur in the scope of an `execute()`Mike Bayer2011-02-091-4/+4
| | | | | | | | call are now wrapped in sqlalchemy.exc.StatementError, and the text of the SQL statement and repr() of params is included. This makes it easier to identify statement executions which fail before the DBAPI becomes involved. [ticket:2015]
* - The Index() construct can be created inline with a TableMike Bayer2011-01-041-0/+37
| | | | | definition, using strings as column names, as an alternative to the creation of the index outside of the Table.
* - whitespace removal bonanzaMike Bayer2011-01-021-22/+22
|
* - move sqlalchemy.test to test.libMike Bayer2010-11-151-5/+5
|
* - The generated index name also is based onMike Bayer2010-08-021-15/+21
| | | | | | | | a "max index name length" attribute which is separate from the "max identifier length" - this to appease MySQL who has a max length of 64 for index names, separate from their overall max length of 255. [ticket:1412]
* - Changed the scheme used to generate truncatedMike Bayer2010-07-211-10/+23
| | | | | | | | | | | | "auto" index names when using the "index=True" flag on Column. The truncation only takes place with the auto-generated name, not one that is user-defined (an error would be raised instead), and the truncation scheme itself is now based on a fragment of an md5 hash of the identifier name, so that multiple indexes on columns with similar names still have unique names. [ticket:1855]
* - Fixed concatenation of constraints when "PRIMARY KEY"Mike Bayer2010-05-271-1/+1
| | | | | | | constraint gets moved to column level due to SQLite AUTOINCREMENT keyword being rendered. [ticket:1812] - remove some extra space in between constraint DDL - added alias() to binary comparison test, fixing pg + mysql failures
* - Fixed errant space character when generating ADD CONSTRAINTMike Bayer2010-04-261-2/+2
| | | | for a named UNIQUE constraint.
* - added util.portable_instancemethod to provide a quick way to make an ↵Mike Bayer2010-02-221-2/+28
| | | | | | | | | | instancemethod "serializable" - SchemaType and subclasses Boolean, Enum are now serializable, including their ddl listener and other event callables. [ticket:1694] [ticket:1698] - AddConstraint/DropConstraint use the wrapper for _create_rule - added test coverage for AddConstraint override of _create_rule
* - reworked the DDL generation of ENUM and similar to be more platform agnostic.Mike Bayer2009-12-061-1/+1
| | | | | | | Uses a straight CheckConstraint with a generic expression. Preparing for boolean constraint in [ticket:1589] - CheckConstraint now accepts SQL expressions, though support for quoting of values will be very limited. we don't want to get into formatting dates and such.
* merge 0.6 series to trunk.Mike Bayer2009-08-061-126/+161
|
* - unit tests have been migrated from unittest to nose.Mike Bayer2009-06-101-0/+335
See README.unittests for information on how to run the tests. [ticket:970]