summaryrefslogtreecommitdiff
path: root/test/sql/test_metadata.py
Commit message (Collapse)AuthorAgeFilesLines
* - The :paramref:`.Column.nullable` flag is implicitly set to ``False``Mike Bayer2014-06-201-0/+18
| | | | | | | | | when that :class:`.Column` is referred to in an explicit :class:`.PrimaryKeyConstraint` for that table. This behavior now matches that of when the :class:`.Column` itself has the :paramref:`.Column.primary_key` flag set to ``True``, which is intended to be an exactly equivalent case. fixes #3023
* Fix many typos throughout the codebasepr/85Alex Gaynor2014-04-261-1/+1
| | | | Found using: https://github.com/intgr/topy
* - Liberalized the contract for :class:`.Index` a bit in that you canMike Bayer2014-04-191-2/+69
| | | | | | | 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
* - Fixed bug in new :meth:`.DialectKWArgs.argument_for` method whereMike Bayer2014-04-151-0/+11
| | | | | adding an argument for a construct not previously included for any special arguments would fail. fixes #3024
* :paramref:`.MetaData.naming_convention` feature will now alsoMike Bayer2014-03-121-0/+17
| | | | | | apply to :class:`.CheckConstraint` objects that are associated directly with a :class:`.Column` instead of just on the :class:`.Table`.
* - Fixed bug in new :paramref:`.MetaData.naming_convention` featureMike Bayer2014-03-121-1/+37
| | | | | | | | | where the name of a check constraint making use of the `"%(constraint_name)s"` token would get doubled up for the constraint generated by a boolean or enum type, and overall duplicate events would cause the `"%(constraint_name)s"` token to keep compounding itself. fixes #2991
* - Support has been added for pytest to run tests. This runnerMike Bayer2014-03-031-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | is currently being supported in addition to nose, and will likely be preferred to nose going forward. The nose plugin system used by SQLAlchemy has been split out so that it works under pytest as well. There are no plans to drop support for nose at the moment and we hope that the test suite itself can continue to remain as agnostic of testing platform as possible. See the file README.unittests.rst for updated information on running tests with pytest. The test plugin system has also been enhanced to support running tests against mutiple database URLs at once, by specifying the ``--db`` and/or ``--dburi`` flags multiple times. This does not run the entire test suite for each database, but instead allows test cases that are specific to certain backends make use of that backend as the test is run. When using pytest as the test runner, the system will also run specific test suites multiple times, once for each database, particularly those tests within the "dialect suite". The plan is that the enhanced system will also be used by Alembic, and allow Alembic to run migration operation tests against multiple backends in one run, including third-party backends not included within Alembic itself. Third party dialects and extensions are also encouraged to standardize on SQLAlchemy's test suite as a basis; see the file README.dialects.rst for background on building out from SQLAlchemy's test platform.
* - The new dialect-level keyword argument system for schema-levelMike Bayer2014-02-251-0/+133
| | | | | | | | | constructs has been enhanced in order to assist with existing schemes that rely upon addition of ad-hoc keyword arguments to constructs. - To suit the use case of allowing custom arguments at construction time, the :meth:`.DialectKWArgs.argument_for` method now allows this registration. fixes #2962
* - Fixed regression in new "naming convention" feature where conventionsMike Bayer2014-02-051-2/+20
| | | | | would fail if the referred table in a foreign key contained a schema name. Pull request courtesy Thomas Farvour. pullreq github:67
* - The behavior of :meth:`.Table.tometadata` has been adjusted such thatMike Bayer2014-02-021-168/+308
| | | | | | | | | | | | | | | | | | | | | | | | the schema target of a :class:`.ForeignKey` will not be changed unless that schema matches that of the parent table. That is, if a table "schema_a.user" has a foreign key to "schema_b.order.id", the "schema_b" target will be maintained whether or not the "schema" argument is passed to :meth:`.Table.tometadata`. However if a table "schema_a.user" refers to "schema_a.order.id", the presence of "schema_a" will be updated on both the parent and referred tables. This is a behavioral change hence isn't likely to be backported to 0.8; it is assumed that the previous behavior is pretty buggy however and that it's unlikely anyone was relying upon it. Additionally, a new parameter has been added :paramref:`.Table.tometadata.referred_schema_fn`. This refers to a callable function which will be used to determine the new referred schema for any :class:`.ForeignKeyConstraint` encountered in the tometadata operation. This callable can be used to revert to the previous behavior or to customize how referred schemas are treated on a per-constraint basis. [ticket:2913] - rework the tests in test.sql.test_metadata, all the "tometadata" tests now under new class ToMetaDataTest
* - Added a new feature which allows automated naming conventions to beMike Bayer2014-02-011-8/+74
| | | | | | | | | | | | | | | | applied to :class:`.Constraint` and :class:`.Index` objects. Based on a recipe in the wiki, the new feature uses schema-events to set up names as various schema objects are associated with each other. The events then expose a configuration system through a new argument :paramref:`.MetaData.naming_convention`. This system allows production of both simple and custom naming schemes for constraints and indexes on a per-:class:`.MetaData` basis. [ticket:2923] commit 7e65e52c086652de3dd3303c723f98f09af54db8 Author: Mike Bayer <mike_mp@zzzcomputing.com> Date: Sat Feb 1 15:09:04 2014 -0500 - first pass at new naming approach
* - simplify the mechanics of PrimaryKeyConstraint with regards to reflection;Mike Bayer2014-01-201-1/+72
| | | | | | | | | | | | reflection now updates the PKC in place. - support the use case of the empty PrimaryKeyConstraint in order to specify constraint options; the columns marked as primary_key=True will now be gathered into the columns collection, rather than being ignored. [ticket:2910] - add validation such that column specification should only take place in the PrimaryKeyConstraint directly, or by using primary_key=True flags; if both are present, they have to match exactly, otherwise the condition is assumed to be ambiguous, and a warning is emitted; the old behavior of using the PKC columns only is maintained.
* - alter behavior such that dialect_kwargs is still immutable, butMike Bayer2014-01-191-18/+48
| | | | | | now represents exactly the kwargs that were passed, and not the defaults. the defaults are still in dialect_options. This allows repr() schemes such as that of alembic to not need to look through and compare for defaults.
* - some test fixesMike Bayer2014-01-191-12/+5
| | | | - clean up some shenanigans in reflection
* - implement kwarg validation and type system for dialect-specificMike Bayer2014-01-181-1/+245
| | | | | arguments; [ticket:2866] - add dialect specific kwarg functionality to ForeignKeyConstraint, ForeignKey
* - The :class:`.ForeignKey` class more aggressively checks the givenMike Bayer2013-12-111-1/+40
| | | | | | | | | column argument. If not a string, it checks that the object is at least a :class:`.ColumnClause`, or an object that resolves to one, and that the ``.table`` attribute, if present, refers to a :class:`.TableClause` or subclass, and not something like an :class:`.Alias`. Otherwise, a :class:`.ArgumentError` is raised. [ticket:2883]
* - The :meth:`.Table.tometadata` method now produces copies ofMike Bayer2013-10-181-1/+41
| | | | | | | | | | all :attr:`.SchemaItem.info` dictionaries from all :class:`.SchemaItem` objects within the structure including columns, constraints, foreign keys, etc. As these dictionaries are copies, they are independent of the original dictionary. Previously, only the ``.info`` dictionary of :class:`.Column` was transferred within this operation, and it was only linked in place, not copied. [ticket:2716]
* The ``.unique`` flag on :class:`.Index` could be produced as ``None``Mike Bayer2013-10-141-0/+22
| | | | | | if it was generated from a :class:`.Column` that didn't specify ``unique`` (where it defaults to ``None``). The flag will now always be ``True`` or ``False``. [ticket:2825]
* The "name" attribute is set on :class:`.Index` before the "attach"Mike Bayer2013-10-111-4/+9
| | | | | | events are called, so that attachment events can be used to dynamically generate a name for the index based on the parent table and/or columns. [ticket:2835]
* - these tests now fail on a normalize name DB, as they should! because we're ↵Mike Bayer2013-08-281-0/+6
| | | | quoting the lowercase name.
* - A rework to the way that "quoted" identifiers are handled, in thatMike Bayer2013-08-271-12/+20
| | | | | | | | | | | | | | | | instead of relying upon various ``quote=True`` flags being passed around, these flags are converted into rich string objects with quoting information included at the point at which they are passed to common schema constructs like :class:`.Table`, :class:`.Column`, etc. This solves the issue of various methods that don't correctly honor the "quote" flag such as :meth:`.Engine.has_table` and related methods. The :class:`.quoted_name` object is a string subclass that can also be used explicitly if needed; the object will hold onto the quoting preferences passed and will also bypass the "name normalization" performed by dialects that standardize on uppercase symbols, such as Oracle, Firebird and DB2. The upshot is that the "uppercase" backends can now work with force-quoted names, such as lowercase-quoted names and new reserved words. [ticket:2812]
* tweak this for now, would need a testMike Bayer2013-06-231-11/+0
|
* The resolution of :class:`.ForeignKey` objects to theirMike Bayer2013-06-231-33/+317
| | | | | | | | | | | | | | | | | | target :class:`.Column` has been reworked to be as immediate as possible, based on the moment that the target :class:`.Column` is associated with the same :class:`.MetaData` as this :class:`.ForeignKey`, rather than waiting for the first time a join is constructed, or similar. This along with other improvements allows earlier detection of some foreign key configuration issues. Also included here is a rework of the type-propagation system, so that it should be reliable now to set the type as ``None`` on any :class:`.Column` that refers to another via :class:`.ForeignKey` - the type will be copied from the target column as soon as that other column is associated, and now works for composite foreign keys as well. [ticket:1765]
* Fixed bug whereby joining a select() of a table "A" with multipleMike Bayer2013-06-031-0/+24
| | | | | | | | foreign key paths to a table "B", to that table "B", would fail to produce the "ambiguous join condition" error that would be reported if you join table "A" directly to "B"; it would instead produce a join condition with multiple criteria. [ticket:2738]
* - the raw 2to3 runMike Bayer2013-04-271-2/+2
| | | | - went through examples/ and cleaned out excess list() calls
* - :meth:`.MetaData.create_all` and :meth:`.MetaData.drop_all` willMike Bayer2013-03-021-0/+1
| | | | | | | | | | now accommodate an empty list as an instruction to not create/drop any items, rather than ignoring the collection. [ticket:2664]. This is a behavioral change and extra notes to the changelog and migration document have been added. - create a new test suite for exercising codepaths in engine/ddl.py
* - some linter cleanup, though have disabled the newer linter rules which are ↵Mike Bayer2013-03-021-40/+45
| | | | | | just too much for now
* Added a new argument to :class:`.Enum` and its baseMike Bayer2013-02-011-1/+98
| | | | | | | | | | | | :class:`.SchemaType` ``inherit_schema``. When set to ``True``, the type will set its ``schema`` attribute of that of the :class:`.Table` to which it is associated. This also occurs during a :meth:`.Table.tometadata` operation; the :class:`.SchemaType` is now copied in all cases when :meth:`.Table.tometadata` happens, and if ``inherit_schema=True``, the type will take on the new schema name passed to the method. The ``schema`` is important when used with the Postgresql backend, as the type results in a ``CREATE TYPE`` statement. [ticket:2657]
* Fixed bug where :meth:`.Table.tometadata` would fail if aMike Bayer2013-01-271-0/+12
| | | | | | :class:`.Column` had both a foreign key as well as an alternate ".key" name for the column. Also in 0.7.10. [ticket:2643]
* Fixed bug where using server_onupdate=<FetchedValue|DefaultClause>Mike Bayer2012-12-081-0/+31
| | | | | | | | | | without passing the "for_update=True" flag would apply the default object to the server_default, blowing away whatever was there. The explicit for_update=True argument shouldn't be needed with this usage (especially since the documentation shows an example without it being used) so it is now arranged internally using a copy of the given default object, if the flag isn't set to what corresponds to that argument. Also in 0.7.10. [ticket:2631]
* trying different approaches to test layout. in this one, the testing modulesMike Bayer2012-09-271-8/+8
| | | | | | | 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] When the primary key column of a TableMike Bayer2012-09-231-1/+16
| | | | | | | | is replaced, such as via extend_existing, the "auto increment" column used by insert() constructs is reset. Previously it would remain referring to the previous primary key column. [ticket:2525]
* - [feature] An explicit error is raised whenMike Bayer2012-09-231-0/+28
| | | | | | a ForeignKeyConstraint() that was constructed to refer to multiple remote tables is first used. [ticket:2455]
* - clean pyflakesMike Bayer2012-09-231-50/+48
|
* finished fixes for mxodbc; need to use at least version 3.2.1Mike Bayer2012-09-211-0/+1
|
* - [feature] Added a hook to the system of renderingMike Bayer2012-09-091-0/+42
| | | | | | | CREATE TABLE that provides access to the render for each Column individually, by constructing a @compiles function against the new schema.CreateColumn construct. [ticket:2463]
* fixes to prevent the new MyISAM engine from breaking other testsMike Bayer2012-08-291-0/+1
|
* - adjustments for py3.3 unit tests, [ticket:2542]Mike Bayer2012-08-111-1/+1
|
* -whitespace bonanza, contdMike Bayer2012-07-281-52/+52
|
* - [bug] Index will raise when arguments passedMike Bayer2012-02-121-1/+1
| | | | | | cannot be interpreted as columns or expressions. Will warn when Index is created with no columns at all. [ticket:2380]
* - [feature] New reflection feature "autoload_replace";Mike Bayer2012-01-281-0/+11
| | | | | | | | | | | | | | | when set to False on Table, the Table can be autoloaded without existing columns being replaced. Allows more flexible chains of Table construction/reflection to be constructed, including that it helps with combining Declarative with table reflection. See the new example on the wiki. [ticket:2356] - [bug] Improved the API for add_column() such that if the same column is added to its own table, an error is not raised and the constraints don't get doubled up. Also helps with some reflection/declarative patterns. [ticket:2356]
* - [feature] Added new support for remote "schemas":Mike Bayer2011-10-231-28/+164
| | | | | | | | | | | | | | | | | | | | | | | | - MetaData() accepts "schema" and "quote_schema" arguments, which will be applied to the same-named arguments of a Table or Sequence which leaves these at their default of ``None``. - Sequence accepts "quote_schema" argument - tometadata() for Table will use the "schema" of the incoming MetaData for the new Table if the schema argument is explicitly "None" - Added CreateSchema and DropSchema DDL constructs - these accept just the string name of a schema and a "quote" flag. - When using default "schema" with MetaData, ForeignKey will also assume the "default" schema when locating remote table. This allows the "schema" argument on MetaData to be applied to any set of Table objects that otherwise don't have a "schema". - a "has_schema" method has been implemented on dialect, but only works on Postgresql so far. Courtesy Manlio Perillo, [ticket:1679]
* - Modified Column.copy() to use _constructor(),Mike Bayer2011-09-231-0/+15
| | | | | | which defaults to self.__class__, in order to create the new object. This allows easier support of subclassing Column. [ticket:2284]
* - Added a slightly nicer __repr__() to SchemaItemMike Bayer2011-08-141-17/+39
| | | | | | | | classes. Note the repr here can't fully support the "repr is the constructor" idea since schema items can be very deeply nested/cyclical, have late initialization of some things, etc. [ticket:2223]
* - Added an informative error message whenMike Bayer2011-07-211-0/+33
| | | | | | | | | ForeignKeyConstraint refers to a column name in the parent that is not found. Also in 0.6.9. - add tests for [ticket:2226], as if we hit each @declared_attr directly with obj.__get__(obj, name) instead of using getattr(cls, name). Basic inheritance mechanics are improperly used in this case, so 2226 is invalid.
* - Fixed bug whereby if FetchedValue was passedMike Bayer2011-04-231-0/+78
| | | | | | | to column server_onupdate, it would not have its parent "column" assigned, added test coverage for all column default assignment patterns. [ticket:2147] also in 0.6.8
* - Added explicit check for when Column .nameMike Bayer2011-04-201-3/+25
| | | | is assigned as blank string [ticket:2140]
* - Before/after attach events for PrimaryKeyConstraintMike Bayer2011-04-171-4/+48
| | | | | now function, tests added for before/after events on all constraint types. [ticket:2105]
* - The 'useexisting' flag on Table has been supercededMike Bayer2011-04-051-6/+222
| | | | | | | | | | | by a new pair of flags 'keep_existing' and 'extend_existing'. 'extend_existing' is equivalent to 'useexisting' - the existing Table is returned, and additional constructor elements are added. With 'keep_existing', the existing Table is returned, but additional constructor elements are not added - these elements are only applied when the Table is newly created. [ticket:2109]
* - remove test.sql._base, test.engine._base, test.orm._base, move those ↵Mike Bayer2011-03-271-8/+10
| | | | | | | classes to a new test.lib.fixtures module - move testing.TestBase to test.lib.fixtures - massive search and replace