summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/schema.py
Commit message (Collapse)AuthorAgeFilesLines
...
* update for 2017 copyrightMike Bayer2017-01-041-1/+1
| | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* Add _extend_on deduplicating set for metadata.reflect()Mike Bayer2016-11-231-6/+18
| | | | | | | | | | | | | The "extend_existing" option of :class:`.Table` reflection would cause indexes and constraints to be doubled up in the case that the parameter were used with :meth:`.MetaData.reflect` (as the automap extension does) due to tables being reflected both within the foreign key path as well as directly. A new de-duplicating set is passed through within the :meth:`.MetaData.reflect` sequence to prevent double reflection in this way. Change-Id: Ibf6650c1e76a44ccbe15765fd79df2fa53d6bac7 Fixes: #3861
* Update the Column.nullable docstring for the primary_key=True caseMatt Riedemann2016-10-101-4/+8
| | | | | | | | | | | | | | | | | While reviewing a change that created a new table, the primary_key column value was set to True but nullable was not explicitly set, which led to some confusion over the default behavior for the nullable column value when setting a primary_key. Looking at the docs it's not clear, but the code shows that if nullable is not specified, then nullable = not primary_key, so nullable defaults to False when primary_key is True. This patch adds a simple clarification to the docs so people don't have to check the code. Change-Id: I8553339d56fbae11370c7c6af6d8d4723163be1c Pull-request: https://github.com/zzzeek/sqlalchemy/pull/312
* spelling: Postgresql -> PostgreSQLVille Skyttä2016-10-081-3/+3
|
* - some documentation hitsMike Bayer2016-10-011-5/+15
| | | | Change-Id: I468fe70168804b08cf0d5e8b57e235bca904b1ff
* Check for supports_execution at ClauseElement baseMike Bayer2016-08-311-3/+3
| | | | | | | | | | Raise a more descriptive exception / message when ClauseElement or non-SQLAlchemy objects that are not "executable" are erroneously passed to ``.execute()``; a new exception ObjectNotExecutableError is raised consistently in all cases. Change-Id: I2dd393121e2c7e5b6b9e40286a2f25670876e8e4 Fixes: #3786
* Spelling fixespr/299Ville Skyttä2016-08-081-1/+1
|
* Ensure post-__clause_element__() expression are used in IndexMike Bayer2016-07-311-1/+3
| | | | | | | | | | | The change in Index for 1.1 combined with the fix for ref #3763 still fails to deliver the correct object resolved by __clause_element__() to the list of expressions for compilation. Make sure we use the expression that's been unwrapped from __clause_element__(). Change-Id: Ie1df8db5090de665048331786f0024d52851923f Fixes: #3763
* Index should extract __clause_element__() earlyMike Bayer2016-07-301-1/+4
| | | | | | | | | | | | Fixed bug where :class:`.Index` would fail to extract columns from compound SQL expressions if those SQL expressions were wrapped inside of an ORM-style ``__clause_element__()`` construct. This bug exists in 1.0.x as well, however in 1.1 is more noticeable as hybrid_property @expression now returns a wrapped element. Fixes: #3763 Change-Id: I992536386503a1fb3f2305790abe008d72c44c4a
* Allow Table._reset_exported to silently passMike Bayer2016-07-241-0/+3
| | | | | | | | | | | Fixed bug in :class:`.Table` where the internal method ``_reset_exported()`` would corrupt the state of the object. This method is intended for selectable objects and is called by the ORM in some cases; an erroneous mapper configuration would could lead the ORM to call this on on a :class:`.Table` object. Change-Id: I63fa34ee0cdf16358bb125c556390df79758bcbc Fixes: #3755
* Don't reorder PrimaryKeyConstraint columns if explicitMike Bayer2016-06-201-1/+6
| | | | | | | | | | | Dialed back the "order the primary key columns per auto-increment" described in :ref:`change_mysql_3216` a bit, so that if the :class:`.PrimaryKeyConstraint` is explicitly defined, the order of columns is maintained exactly, allowing control of this behavior when necessary. Change-Id: I9e7902c57a96c15968a6abf53e319acf15680da0 Fixes: #3726
* Skip UniqueConstraint marked by unique=True in tometadataMike Bayer2016-06-021-1/+7
| | | | | | | | | | | | | Fixes an issue where a Column would be copied with unique=True and at the same time the UniqueConstraint would also be copied, leading to duplicate UniqueConstraints in the target table, when tometadata() is used. Imitates the same logic used by index=True/Index to avoid duplicates. For some reason a fix was implemented for Index long ago but never for UniqueConstraint. Change-Id: Ie622ee912a6fb8bf0ea900a8b09d78c7ebc79fc0 Fixes: #3721
* Support "blank" schema when MetaData.schema is setMike Bayer2016-05-181-4/+48
| | | | | | | | | | | | | Previously, it was impossible to have a Table that has None for a schema name when the "schema" parameter on MetaData was set. A new symbol sqlalchemy.schema.BLANK_SCHEMA is added which indicates that the schema name should unconditionally be set to None. In particular, this value must be passed within cross-schema foreign key reflection, so that a Table which is in the "default" schema can be represented properly. Fixes: #3716 Change-Id: I3d24f99c22cded206c5379fd32a225e74edb7a8e
* - happy new yearMike Bayer2016-01-291-1/+1
|
* - convert keys to str for None not sortable against str on py3kMike Bayer2016-01-121-1/+1
|
* - reorganize schema_translate_map to be succinct and gain the performanceMike Bayer2016-01-111-4/+52
| | | | back by using an attrgetter for the default case
* - Fixed an assertion that would raise somewhat inappropriatelyMike Bayer2015-12-231-3/+7
| | | | | | | | if a :class:`.Index` were associated with a :class:`.Column` that is associated with a lower-case-t :class:`.TableClause`; the association should be ignored for the purposes of associating the index with a :class:`.Table`. fixes #3616
* - a few tweaks to allow "server_defaults" to be a little more linkable;Mike Bayer2015-12-141-2/+10
| | | | | | | remove "undoc members" that was putting some random server_default atributes from ColumnClause (cherry picked from commit 270301890ae87ec32a46bb17889d9776b7de1468)
* Merge branch 'pr204'Mike Bayer2015-10-291-2/+3
|\
| * - convert wrap_callable() to a general purpose update_wrapper-likeMike Bayer2015-10-291-2/+2
| | | | | | | | | | | | function; the caller still passes in the "wrapper" - move tests for wrap_callable() to be generic util tests - changelog for pullreq github:204
| * - wrap ColumnDefault empty arg callables like functools.wraps, setting ↵pr/204Martin J. Hsu2015-10-151-2/+3
| | | | | | | | __name__, __doc__, and __module__
* | - open up autoincrement for columns that have a default; autoinc is usuallyMike Bayer2015-10-081-37/+25
| | | | | | | | "auto" now so True can indicate the dialect would support this
* | - The system by which a :class:`.Column` considers itself to be anMike Bayer2015-10-071-32/+116
|/ | | | | | | | | | | | | | | | | "auto increment" column has been changed, such that autoincrement is no longer implicitly enabled for a :class:`.Table` that has a composite primary key. In order to accommodate being able to enable autoincrement for a composite PK member column while at the same time maintaining SQLAlchemy's long standing behavior of enabling implicit autoincrement for a single integer primary key, a third state has been added to the :paramref:`.Column.autoincrement` parameter ``"auto"``, which is now the default. fixes #3216 - The MySQL dialect no longer generates an extra "KEY" directive when generating CREATE TABLE DDL for a table using InnoDB with a composite primary key with AUTO_INCREMENT on a column that isn't the first column; to overcome InnoDB's limitation here, the PRIMARY KEY constraint is now generated with the AUTO_INCREMENT column placed first in the list of columns.
* - version specs for new Sequence argumentsMike Bayer2015-07-171-0/+15
| | | | - changelog for pullreq github:186
* 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
| |/