summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/schema.py
Commit message (Collapse)AuthorAgeFilesLines
* Implement comments for tables, columnsFrazer McLean2017-03-171-1/+5
| | | | | | | | | | | | | | Added support for SQL comments on :class:`.Table` and :class:`.Column` objects, via the new :paramref:`.Table.comment` and :paramref:`.Column.comment` arguments. The comments are included as part of DDL on table creation, either inline or via an appropriate ALTER statement, and are also reflected back within table reflection, as well as via the :class:`.Inspector`. Supported backends currently include MySQL, Postgresql, and Oracle. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Fixes: #1546 Change-Id: Ib90683850805a2b4ee198e420dc294f32f15d35d
* update for 2017 copyrightMike Bayer2017-01-041-1/+1
| | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* Support "blank" schema when MetaData.schema is setMike Bayer2016-05-181-0/+1
| | | | | | | | | | | | | 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
|
* - copyright 2015Mike Bayer2015-03-101-1/+1
|
* - restate sort_tables in terms of a more fine grainedMike Bayer2015-01-011-1/+3
| | | | | | | | | | | | | 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
* correctionsMike Bayer2014-12-271-0/+1
|
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* Fix many typos throughout the codebasepr/85Alex Gaynor2014-04-261-1/+1
| | | | Found using: https://github.com/intgr/topy
* - Added a new feature :func:`.schema.conv`, the purpose of which is toMike Bayer2014-03-121-0/+3
| | | | | | | | mark a constraint name as already having had a naming convention applied. This token will be used by Alembic migrations as of Alembic 0.6.4 in order to render constraints in migration scripts with names marked as already having been subject to a naming convention. re: #2991
* expose SchemaVisitor in the compatibility layerpr/57Sean Dague2014-01-111-0/+4
| | | | | | | | sqlalchemy-migrate uses SchemaVisitor. It was one of the only objects that changed namespaces without compatibility that we use. Would love to get this added to remove a work around we need at https://review.openstack.org/#/c/66156/
* - happy new yearMike Bayer2014-01-051-1/+1
|
* - A large refactoring of the ``sqlalchemy.sql`` package has reorganizedMike Bayer2013-08-121-3647/+45
| | | | | | | | | | | | | | | | | | | | | | the import structure of many core modules. ``sqlalchemy.schema`` and ``sqlalchemy.types`` remain in the top-level package, but are now just lists of names that pull from within ``sqlalchemy.sql``. Their implementations are now broken out among ``sqlalchemy.sql.type_api``, ``sqlalchemy.sql.sqltypes``, ``sqlalchemy.sql.schema`` and ``sqlalchemy.sql.ddl``, the last of which was moved from ``sqlalchemy.engine``. ``sqlalchemy.sql.expression`` is also a namespace now which pulls implementations mostly from ``sqlalchemy.sql.elements``, ``sqlalchemy.sql.selectable``, and ``sqlalchemy.sql.dml``. Most of the "factory" functions used to create SQL expression objects have been moved to classmethods or constructors, which are exposed in ``sqlalchemy.sql.expression`` using a programmatic system. Care has been taken such that all the original import namespaces remain intact and there should be no impact on any existing applications. The rationale here was to break out these very large modules into smaller ones, provide more manageable lists of function names, to greatly reduce "import cycles" and clarify the up-front importing of names, and to remove the need for redundant functions and documentation throughout the expression package.
* add more docs to index, even though this seems to be a little redundantMike Bayer2013-08-111-10/+29
|
* find some more inline imports and move them outMike Bayer2013-08-041-4/+3
|
* docsMike Bayer2013-06-231-1/+1
|
* doc fixesMike Bayer2013-06-231-5/+6
|
* sort here so that exception messages are testableMike Bayer2013-06-231-1/+1
|
* tweak this for now, would need a testMike Bayer2013-06-231-3/+3
|
* The resolution of :class:`.ForeignKey` objects to theirMike Bayer2013-06-231-110/+234
| | | | | | | | | | | | | | | | | | 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-1/+2
| | | | | | | | 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]
* Fixed bug whereby using :meth:`.MetaData.reflect` across a remoteMike Bayer2013-06-031-3/+12
| | | | | | schema as well as a local schema could produce wrong results in the case where both schemas had a table of the same name. [ticket:2728]
* a pass where we try to squash down as many list()/keys() combinationsMike Bayer2013-05-261-1/+1
| | | | as possible
* Merge branch 'master' into rel_0_9Mike Bayer2013-05-261-1/+1
|\
| * fix incorrect method nameChris Withers2013-05-261-1/+1
| |
* | - endless isinstance(x, str)s....Mike Bayer2013-04-281-36/+30
| |
* | plugging awayMike Bayer2013-04-271-18/+9
| |
* | - the raw 2to3 runMike Bayer2013-04-271-47/+50
|/ | | | - went through examples/ and cleaned out excess list() calls
* Loosened the check on dialect-specific argument namesMike Bayer2013-03-241-8/+7
| | | | | | | passed to Table(); since we want to support external dialects and also want to support args without a certain dialect being installed, it only checks the format of the arg now, rather than looking for that dialect in sqlalchemy.dialects.
* - auto-append for CheckConstraint should skip table if the expression is againstMike Bayer2013-03-091-2/+2
| | | | a lower-case-t table
* Added a new argument to :class:`.Enum` and its baseMike Bayer2013-02-011-3/+17
| | | | | | | | | | | | :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-1/+1
| | | | | | :class:`.Column` had both a foreign key as well as an alternate ".key" name for the column. Also in 0.7.10. [ticket:2643]
* - replace mssql_ordering with generalized #695 solutionMike Bayer2013-01-201-6/+9
| | | | - documentation for mssql index options plus changelog and fixes
* :class:`.Index` now supports arbitrary SQL expressions and/orMike Bayer2013-01-161-6/+36
| | | | | | | | 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]
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* Fixed a regression caused by :ticket:`2410` whereby aMike Bayer2012-12-111-9/+22
| | | | | | | | | :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]
* Fixed bug where using server_onupdate=<FetchedValue|DefaultClause>Mike Bayer2012-12-081-2/+15
| | | | | | | | | | 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]
* Fixed bug whereby using a label_length on dialect that was smallerMike Bayer2012-12-081-2/+4
| | | | | | than the size of actual column identifiers would fail to render the columns correctly in a SELECT statement. [ticket:2610]
* fixing broken links (see #2625)Diana Clarke2012-12-051-12/+11
|
* just a pep8 pass of lib/sqlalchemy/Diana Clarke2012-11-191-71/+120
|
* The :meth:`.Connection.connect` and :meth:`.Connection.contextual_connect`Mike Bayer2012-11-141-18/+10
| | | | | | | methods now return a "branched" version so that the :meth:`.Connection.close` method can be called on the returned connection without affecting the original. Allows symmetry when using :class:`.Engine` and :class:`.Connection` objects as context managers.
* Fixed :meth:`.MetaData.reflect` to correctly useMike Bayer2012-11-141-8/+17
| | | | | | the given :class:`.Connection`, if given, without opening a second connection from that connection's :class:`.Engine`. [ticket:2604]
* add docs regarding fetchedvalue with primary keys, [ticket:2598]Mike Bayer2012-11-121-0/+4
|
* Fixed bug whereby the ".key" of a Column wasn't beingMike Bayer2012-10-311-1/+1
| | | | | | | used when producing a "proxy" of the column against a selectable. This probably didn't occur in 0.7 since 0.7 doesn't respect the ".key" in a wider range of scenarios. [ticket:2597]
* - [feature] Added TIME type to mysql dialect,Mike Bayer2012-10-101-8/+10
| | | | | | | | | | | | accepts "fst" argument which is the new "fractional seconds" specifier for recent MySQL versions. The datatype will interpret a microseconds portion received from the driver, however note that at this time most/all MySQL DBAPIs do not support returning this value. [ticket:2534] - attempted to modernize the types tests in test_mysql a little, though has a long way to go
* - fix the fixture here that wasn't creating consistentlyMike Bayer2012-10-011-2/+22
| | | | | | | - rewrite --dropfirst to be more industrial strength, includes views - fix order_by="foreign_key" to maintain the same ordering as metadata.sorted_tables. Not ideal that this was the other way throughout 0.7 but this is still a little-used method, in contrast to metadata.sorted_tables.
* - [bug] When the primary key column of a TableMike Bayer2012-09-231-11/+13
| | | | | | | | 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-3/+21
| | | | | | a ForeignKeyConstraint() that was constructed to refer to multiple remote tables is first used. [ticket:2455]
* - [feature] Added a hook to the system of renderingMike Bayer2012-09-091-0/+88
| | | | | | | 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]
* fixMike Bayer2012-09-091-2/+0
|