summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/schema.py
Commit message (Collapse)AuthorAgeFilesLines
* add CYCLE support to Sequence() and docstrings for NO MINVALUE and NO MAXVALUEpr/186jakeogh2015-06-271-2/+27
|
* add NO MINVALUE and NO MAXVALUE support to Sequence()jakeogh2015-06-271-2/+2
|
* add MAXVALUE support to Sequence()jakeogh2015-06-271-3/+10
|
* add MINVALUE support to Sequence()jakeogh2015-06-271-2/+8
|
* - Repaired the :class:`.ExcludeConstraint` construct to support commonMike Bayer2015-06-161-8/+20
| | | | | | | features that other objects like :class:`.Index` now do, that the column expression may be specified as an arbitrary SQL expression such as :obj:`.cast` or :obj:`.text`. fixes #3454
* - Fixed bug in enhanced constraint-attachment logic introduced inMike Bayer2015-05-021-8/+16
| | | | | | | | | | | :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
* - Fixed issue where a :class:`.MetaData` object that used a namingMike Bayer2015-04-101-1/+4
| | | | | | | | convention would not properly work with pickle. The attribute was skipped leading to inconsistencies and failures if the unpickled :class:`.MetaData` object were used to base additional tables from. fixes #3362
* Merge branch 'bb_issue_3084' of https://bitbucket.org/xflr6/sqlalchemy into pr47Mike Bayer2015-04-031-1/+1
|\
| * make sort_tables order deterministicSebastian Bank2015-03-071-1/+1
| |
* | - The "auto-attach" feature of constraints such as :class:`.UniqueConstraint`Mike Bayer2015-03-241-17/+37
| | | | | | | | | | | | | | | | | | | | 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
* | - try to document how to get columns from constraints.Mike Bayer2015-03-121-0/+8
| | | | | | | | | | unfortunately Sphinx refuses to work correctly for the columns attribute so we just add a lame message to contains_column().
* | - copyright 2015Mike Bayer2015-03-101-1/+1
|/
* - The :class:`.CheckConstraint` construct now supports namingMike Bayer2015-01-301-24/+37
| | | | | | | | | | 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
* - Fixed bug in 0.9's foreign key setup system, such thatMike Bayer2015-01-281-9/+17
| | | | | | | | | | | | | | the logic used to link a :class:`.ForeignKey` to its parent could fail when the foreign key used "link_to_name=True" in conjunction with a target :class:`.Table` that would not receive its parent column until later, such as within a reflection + "useexisting" scenario, if the target column in fact had a key value different from its name, as would occur in reflection if column reflect events were used to alter the .key of reflected :class:`.Column` objects so that the link_to_name becomes significant. Also repaired support for column type via FK transmission in a similar way when target columns had a different key and were referenced using link_to_name. fixes #3298
* - restate sort_tables in terms of a more fine grainedMike Bayer2015-01-011-18/+44
| | | | | | | | | | | | | 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
* - Added a new accessor :attr:`.Table.foreign_key_constraints`Mike Bayer2015-01-011-0/+27
| | | | | to complement the :attr:`.Table.foreign_keys` collection, as well as :attr:`.ForeignKeyConstraint.referred_table`.
* - correctionsMike Bayer2014-12-271-0/+8
| | | | - attempt to add a script to semi-automate the fixing of links
* - Fixed bug in :meth:`.Table.tometadata` method where theMike Bayer2014-11-291-6/+10
| | | | | | | | :class:`.CheckConstraint` associated with a :class:`.Boolean` or :class:`.Enum` type object would be doubled in the target table. The copy process now tracks the production of this constraint object as local to a type object. fixes #3260
* - use self.parent, not table here as there's an attributeerrorMike Bayer2014-11-251-1/+1
| | | | trap for self.table that behaves differently in py3k
* - The behavioral contract of the :attr:`.ForeignKeyConstraint.columns`Mike Bayer2014-11-251-40/+60
| | | | | | | | collection has been made consistent; this attribute is now a :class:`.ColumnCollection` like that of all other constraints and is initialized at the point when the constraint is associated with a :class:`.Table`. fixes #3243
* - changelog for pullreq github:139Mike Bayer2014-10-211-4/+22
| | | | | - add support for self-referential foreign keys to move over as well when the table name is changed.
* Merge remote-tracking branch 'origin/pr/139' into pr139Mike Bayer2014-10-211-4/+7
|\
| * allow Table.tometadata changing the table namendparker2014-09-231-4/+7
| |
* | Fixed typopr/142mozillazg2014-10-151-2/+2
| |
* | Merge remote-tracking branch 'origin/pr/140' into pr140Mike Bayer2014-10-111-2/+2
|\ \
| * | improve exception vs. exit handlingndparker2014-09-231-2/+2
| |/
* | - refactor of declarative, break up into indiviudal methodsMike Bayer2014-09-251-2/+4
|/ | | | | | | | | | | | | | | | | | | | | | | that are now affixed to _MapperConfig - declarative now creates column copies ahead of time so that they are ready to go for a declared_attr - overhaul of declared_attr; memoization, cascading modifier - A relationship set up with :class:`.declared_attr` on a :class:`.AbstractConcreteBase` base class will now be configured on the abstract base mapping automatically, in addition to being set up on descendant concrete classes as usual. fixes #2670 - The :class:`.declared_attr` construct has newly improved behaviors and features in conjunction with declarative. The decorated function will now have access to the final column copies present on the local mixin when invoked, and will also be invoked exactly once for each mapped class, the returned result being memoized. A new modifier :attr:`.declared_attr.cascading` is added as well. fixes #3150 - the original plan for #3150 has been scaled back; by copying mixin columns up front and memoizing, we don't actually need the "map properties later" thing. - full docs + migration notes
* - The :func:`~.expression.column` and :func:`~.expression.table`Mike Bayer2014-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | constructs are now importable from the "from sqlalchemy" namespace, just like every other Core construct. - The implicit conversion of strings to :func:`.text` constructs when passed to most builder methods of :func:`.select` as well as :class:`.Query` now emits a warning with just the plain string sent. The textual conversion still proceeds normally, however. The only method that accepts a string without a warning are the "label reference" methods like order_by(), group_by(); these functions will now at compile time attempt to resolve a single string argument to a column or label expression present in the selectable; if none is located, the expression still renders, but you get the warning again. The rationale here is that the implicit conversion from string to text is more unexpected than not these days, and it is better that the user send more direction to the Core / ORM when passing a raw string as to what direction should be taken. Core/ORM tutorials have been updated to go more in depth as to how text is handled. fixes #2992
* - A new style of warning can be emitted which will "filter" up toMike Bayer2014-08-311-2/+6
| | | | | | | | | N occurrences of a parameterized string. This allows parameterized warnings that can refer to their arguments to be delivered a fixed number of times until allowing Python warning filters to squelch them, and prevents memory from growing unbounded within Python's warning registries. fixes #3178
* - don't add the parent attach event within _on_table_attachMike Bayer2014-08-151-1/+2
| | | | | if we already have a table; this prevents reentrant calls and we aren't supporting columns/etc being moved around between different parents
* - The ``info`` parameter has been added to the constructor forMike Bayer2014-08-131-7/+47
| | | | | | | | | | | :class:`.SynonymProperty` and :class:`.ComparableProperty`. - The ``info`` parameter has been added as a constructor argument to all schema constructs including :class:`.MetaData`, :class:`.Index`, :class:`.ForeignKey`, :class:`.ForeignKeyConstraint`, :class:`.UniqueConstraint`, :class:`.PrimaryKeyConstraint`, :class:`.CheckConstraint`. fixes #2963
* - rework documentation for reflection flags; also includeMike Bayer2014-08-091-42/+99
| | | | information regarding #3027.
* Providing an autoload_with info automatically sets autoload to TrueMalik Diarra2014-08-091-2/+2
|
* - apply pep8 formatting to sqlalchemy/sql, sqlalchemy/util, sqlalchemy/dialects,Brian Jarrett2014-07-201-305/+326
| | | | sqlalchemy/orm, sqlalchemy/event, sqlalchemy/testing
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* - add link to dialect docs for SQLite autoincrement from column autoincrement,Mike Bayer2014-07-031-2/+5
| | | | fixes #3110
* - write some really complete docs on MSSQL autoincrement, fixes #3094Mike Bayer2014-06-241-3/+10
|
* - The :paramref:`.Column.nullable` flag is implicitly set to ``False``Mike Bayer2014-06-201-0/+1
| | | | | | | | | 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
* Documentation fix-up: "its" vs. "it's"pr/91Matthias Urlichs2014-05-111-1/+1
| | | | | | | | | Removed ungrammatical apostrophes from documentation, replacing "it's" with "its" where appropriate (but in a few cases with "it is" when that read better). While doing that, I also fixed a couple of minor typos etc. as I noticed them.
* Fix many typos throughout the codebasepr/85Alex Gaynor2014-04-261-4/+4
| | | | Found using: https://github.com/intgr/topy
* - Liberalized the contract for :class:`.Index` a bit in that you canMike Bayer2014-04-191-7/+32
| | | | | | | 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
* Remove tables from metadata when autoload failspr/78Roman Podoliaka2014-03-121-1/+1
| | | | | | | | If autoloading of a table fails, don't register it in a metadata instance. It seems that the original behaviour was accidentally changed in f6198d9abf453182f4b111e0579a7a4ef1614e79, restore it. Closes issue #2988
* - Support has been added for pytest to run tests. This runnerMike Bayer2014-03-031-1/+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.
* - get util.get_callable_argspec() to be completely bulletproof for 2.6-3.4,Mike Bayer2014-03-021-27/+3
| | | | | methods, classes, builtins, functools.partial(), everything known so far - use get_callable_argspec() within ColumnDefault._maybe_wrap_callable, re: #2979
* - Fixed some test/feature failures occurring in Python 3.4,Mike Bayer2014-03-021-1/+8
| | | | | | in particular the logic used to wrap "column default" callables wouldn't work properly for Python built-ins. fixes #2979
* - Added :paramref:`.MetaData.reflect.**dialect_kwargs`Mike Bayer2014-02-021-1/+12
| | | | | | | | | | | | | | | | | | to support dialect-level reflection options for all :class:`.Table` objects reflected. - Added a new dialect-level argument ``postgresql_ignore_search_path``; this argument is accepted by both the :class:`.Table` constructor as well as by the :meth:`.MetaData.reflect` method. When in use against Postgresql, a foreign-key referenced table which specifies a remote schema name will retain that schema name even if the name is present in the ``search_path``; the default behavior since 0.7.3 has been that schemas present in ``search_path`` would not be copied to reflected :class:`.ForeignKey` objects. The documentation has been updated to describe in detail the behavior of the ``pg_get_constraintdef()`` function and how the ``postgresql_ignore_search_path`` feature essentially determines if we will honor the schema qualification reported by this function or not. [ticket:2922]
* - The behavior of :meth:`.Table.tometadata` has been adjusted such thatMike Bayer2014-02-021-18/+67
| | | | | | | | | | | | | | | | | | | | | | | | 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-7/+77
| | | | | | | | | | | | | | | | 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
* - further refine this so that the ordering of columns is maintained asMike Bayer2014-01-201-8/+17
| | | | | sent to the primary key constraint; existing tests in the PG dialect confirm this.
* - simplify the mechanics of PrimaryKeyConstraint with regards to reflection;Mike Bayer2014-01-201-13/+105
| | | | | | | | | | | | 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.