summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/schema.py
Commit message (Collapse)AuthorAgeFilesLines
* Removals: MetaData.bind, Table.bind, all other .bindMike Bayer2021-12-021-1/+0
| | | | | Change-Id: I1ef2eb2018f4b68825fe40a2a8d99084cf217b35 References: #7257
* Replace all http:// links to https://Federico Caselli2021-07-041-1/+1
| | | | | | Also replace http://pypi.python.org/pypi with https://pypi.org/project Change-Id: I84b5005c39969a82140706472989f2a30b0c7685
* happy new yearMike Bayer2021-01-041-1/+1
| | | | Change-Id: Ic5bb19ca8be3cb47c95a0d3315d84cb484bac47c
* upgrade to black 20.8b1Mike Bayer2020-09-281-1/+1
| | | | | | | It's better, the majority of these changes look more readable to me. also found some docstrings that had formatting / quoting issues. Change-Id: I582a45fde3a5648b2f36bab96bad56881321899b
* Add support for identity columnsFederico Caselli2020-08-191-1/+1
| | | | | | | | | | | | | | Added the :class:`_schema.Identity` construct that can be used to configure identity columns rendered with GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY. Currently the supported backends are PostgreSQL >= 10, Oracle >= 12 and MSSQL (with different syntax and a subset of functionalities). Fixes: #5362 Fixes: #5324 Fixes: #5360 Change-Id: Iecea6f3ceb36821e8b96f0b61049b580507a1875
* Introduce :class:`.IdentityOptions` to store common parameters forFederico Caselli2020-05-151-0/+1
| | | | | | | sequences and identity columns. References: #5324 Change-Id: I72f7fc1a003456206b004d3d26306940f9c36414
* happy new yearMike Bayer2020-01-011-1/+1
| | | | Change-Id: I08440dc25e40ea1ccea1778f6ee9e28a00808235
* Source base cleanupsMike Bayer2020-01-011-1/+1
| | | | | | | | | | | | | | | in trying to apply 2020 copyright to files, the pre-commit hooks complain about random file issues. - remove old corrections.py utility, this had something to do with repairing refs in the sphinx docs - run pre commit hooks on all files - formatting adjustments to work around code formatting collisions (long import lines that zimports can't rewrite correctly) Change-Id: I260744866f69e902eb93665c7c728ee94d3371a2
* Support for generated columnsCaselIT2019-11-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Added DDL support for "computed columns"; these are DDL column specifications for columns that have a server-computed value, either upon SELECT (known as "virtual") or at the point of which they are INSERTed or UPDATEd (known as "stored"). Support is established for Postgresql, MySQL, Oracle SQL Server and Firebird. Thanks to Federico Caselli for lots of work on this one. ORM round trip tests included. The ORM makes use of existing FetchedValue support and no additional ORM logic is present for the basic feature. It has been observed that Oracle RETURNING does not return the new value of a computed column upon UPDATE; it returns the prior value. As this is very dangerous, a warning is emitted if a computed column is rendered into the RETURNING clause of an UPDATE statement. Fixes: #4894 Closes: #4928 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4928 Pull-request-sha: d39c521d5ac6ebfb4fb5b53846451de79752e64c Change-Id: I2610b2999a5b1b127ed927dcdaeee98b769643ce
* Remove deprecated elementsAsif Saif Uddin (Auvi)2019-10-111-1/+0
| | | | | | | | | | | | | | | | | | | | | Includes: PassiveDefault SchemaItem.quote Table.useexisting Table.quote_schema Table.append_ddl_listener MetaData.append_ddl_listener Metadata.reflect kw parameter (use reflect() method) DDL.execute_at DDL.on Partially-fixes: #4643 Closes: #4893 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4893 Pull-request-sha: 860eb6a253fe4a95685b4f5f3349b19823a304f3 Change-Id: I0f5b8a873e7581365ff8dba48eab358d9e8e7b13
* happy new yearMike Bayer2019-01-111-1/+1
| | | | Change-Id: I6a71f4924d046cf306961c58dffccf21e9c03911
* Post black reformattingMike Bayer2019-01-061-57/+47
| | | | | | | | | | | | | Applied on top of a pure run of black -l 79 in I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9, this set of changes resolves all remaining flake8 conditions for those codes we have enabled in setup.cfg. Included are resolutions for all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe
* Run black -l 79 against all source filesMike Bayer2019-01-061-5/+3
| | | | | | | | | | | | | | This is a straight reformat run using black as is, with no edits applied at all. The black run will format code consistently, however in some cases that are prevalent in SQLAlchemy code it produces too-long lines. The too-long lines will be resolved in the following commit that will resolve all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9
* happy new yearMike Bayer2018-01-121-1/+1
| | | | Change-Id: I3ef36bfd0cb0ba62b3123c8cf92370a43156cf8f
* 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]