summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/schema.py
Commit message (Collapse)AuthorAgeFilesLines
...
* - the _make_proxy() method of ColumnClause and Column now useMike Bayer2010-05-101-1/+1
| | | | | | | self.__class__ to determine the class of object to be returned instead of hardcoding to ColumnClause/Column, making it slightly easier to produce specific subclasses of these which work in alias/subquery situations.
* - Fixed "table" argument on constructor of ForeginKeyConstraintMike Bayer2010-04-261-1/+1
| | | | [ticket:1571]
* - Table.create() and Table.drop() no longer apply metadata-Mike Bayer2010-04-161-2/+10
| | | | level create/drop events. [ticket:1771]
* - The ORM will set the docstring of all generated descriptorsMike Bayer2010-04-021-0/+5
| | | | | | | | | to None by default. This can be overridden using 'doc' (or if using Sphinx, attribute docstrings work too). - Added kw argument 'doc' to all mapper property callables as well as Column(). Will assemble the string 'doc' as the '__doc__' attribute on the descriptor.
* - the copy() method of Column now copies over uninitializedMike Bayer2010-03-111-2/+5
| | | | | "on table attach" events. Helps with the new declarative "mixin" capability.
* -remove proof of concept "cascade constraints"Mike Bayer2010-02-281-4/+0
|
* Added the ability to strip the schema when using tometadata by passing ↵Michael Trier2010-02-251-2/+4
| | | | schema=None as an argument. Fixes #1673.
* - "out" parameters require a type that is supported byMike Bayer2010-02-231-1/+6
| | | | | | | | cx_oracle. An error will be raised if no cx_oracle type can be found. - Column() requires a type if it has no foreign keys (this is not new). An error is now raised if a Column() has no type and no foreign keys. [ticket:1705]
* - added util.portable_instancemethod to provide a quick way to make an ↵Mike Bayer2010-02-221-3/+14
| | | | | | | | | | instancemethod "serializable" - SchemaType and subclasses Boolean, Enum are now serializable, including their ddl listener and other event callables. [ticket:1694] [ticket:1698] - AddConstraint/DropConstraint use the wrapper for _create_rule - added test coverage for AddConstraint override of _create_rule
* - Made sqlalchemy.sql.expressions.Executable part of publicMike Bayer2010-02-121-2/+2
| | | | | | | | | | | API, used for any expression construct that can be sent to execute(). FunctionElement now inherits Executable so that it gains execution_options(), which are also propagated to the select() that's generated within execute(). Executable in turn subclasses _Generative which marks any ClauseElement that supports the @_generative decorator - these may also become "public" for the benefit of the compiler extension at some point.
* - the "connection" argument from engine.transaction() andMike Bayer2010-01-291-3/+1
| | | | | | | engine.run_callable() is removed - Connection itself now has those methods. All four methods accept *args and **kwargs which are passed to the given callable, as well as the operating connection.
* - the "autocommit" flag on select() and text() as wellMike Bayer2010-01-281-1/+2
| | | | | | as select().autocommit() are deprecated - now call .execution_options(autocommit=True) on either of those constructs, also available directly on Connection and orm.Query.
* - reorganized and re-documented Oracle schema tests to assumeMike Bayer2010-01-171-7/+13
| | | | | | | | | test user has DBA privs, and all objects can be created /dropped. - added ORDER BY to oracle column listing - Oracle all_tables always limits to current user if schema not given. - views reflect - added documentation + a unit test for this. - Table(autoload) with no bind produces an error message specific to the fact that autoload_with should be the first option to try.
* - added "statement_options()" to Query, to so options can beMike Bayer2010-01-161-2/+1
| | | | | | | | | | | | | | | | | | | | | passed to the resulting statement. Currently only Select-statements have these options, and the only option used is "stream_results", and the only dialect which knows "stream_results" is psycopg2. - Query.yield_per() will set the "stream_results" statement option automatically. - Added "statement_options()" to Selects, which set statement specific options. These enable e.g. dialect specific options such as whether to enable using server side cursors, etc. - The psycopg2 now respects the statement option "stream_results". This option overrides the connection setting "server_side_cursors". If true, server side cursors will be used for the statement. If false, they will not be used, even if "server_side_cursors" is true on the connection. [ticket:1619] - added a "frozendict" from http://code.activestate.com/recipes/414283/, adding more default collections as immutable class vars on Query, Insert, Select
* happy new yearMike Bayer2010-01-071-1/+1
|
* merge r6616 of 0.5 branch, allow DefaultGenerators as "default" and "onupdate"Mike Bayer2010-01-071-1/+4
|
* - clarify ForeignKey docs, copy operationMike Bayer2010-01-021-8/+46
| | | | - link all classes/functions in expressions
* - The copy() method on Column now supports uninitialized,Mike Bayer2010-01-021-7/+9
| | | | | | unnamed Column objects. This allows easy creation of declarative helpers which place common columns on multiple subclasses (merged from 0.5 with changes).
* - Column() supports a keyword argument "sqlite_autoincrement", whichMike Bayer2009-12-181-1/+2
| | | | | | | | applies the SQLite keyword "AUTOINCREMENT" to columns within DDL - will prevent generation of a separate PRIMARY KEY constraint. [ticket:1016] - added docs - fixed underlines in mysql.rst
* - The Boolean type, when used on a backend that doesn'tMike Bayer2009-12-061-72/+84
| | | | | | | | | | have native boolean support, will generate a CHECK constraint "col IN (0, 1)" along with the int/smallint- based column type. This can be switched off if desired with create_constraint=False. Note that MySQL has no native boolean *or* CHECK constraint support so this feature isn't available on that platform. [ticket:1589]
* - reworked the DDL generation of ENUM and similar to be more platform agnostic.Mike Bayer2009-12-061-20/+31
| | | | | | | Uses a straight CheckConstraint with a generic expression. Preparing for boolean constraint in [ticket:1589] - CheckConstraint now accepts SQL expressions, though support for quoting of values will be very limited. we don't want to get into formatting dates and such.
* - subclassed Function off of new FunctionElement generic baseMike Bayer2009-11-101-38/+39
| | | | | | - removed "key" accessor of Function, Grouping - this doesn't seem to be used for anything - various formatting - documented the four "Element" classes in the compiler extension as per [ticket:1590]
* - ForeignKey(constraint=some_parent) is now private _constraintMike Bayer2009-11-091-71/+90
| | | | | - ForeignKey and ForeignKeyConstraint objects now correctly copy() all their public keyword arguments. [ticket:1605]
* - the `__contains__()` method of `MetaData` now acceptsMike Bayer2009-11-011-2/+4
| | | | | | strings or `Table` objects as arguments. If given a `Table`, the argument is converted to `table.key` first, i.e. "[schemaname.]<tablename>" [ticket:1541]
* - generalized Enum to issue a CHECK constraint + VARCHAR on default platformMike Bayer2009-10-251-8/+6
| | | | - added native_enum=False flag to do the same on MySQL, PG, if desired
* - Added new ENUM type to the Postgresql dialect, which exists as a schema-levelMike Bayer2009-10-251-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | construct and extends the generic Enum type. Automatically associates itself with tables and their parent metadata to issue the appropriate CREATE TYPE/DROP TYPE commands as needed, supports unicode labels, supports reflection. [ticket:1511] - MySQL ENUM now subclasses the new generic Enum type, and also handles unicode values implicitly, if the given labelnames are unicode objects. - Added a new Enum generic type, currently supported on Postgresql and MySQL. Enum is a schema-aware object to support databases which require specific DDL in order to use enum or equivalent; in the case of PG it handles the details of `CREATE TYPE`, and on other databases without native enum support can support generation of CHECK constraints. [ticket:1109] [ticket:1511] - types documentation updates - some cleanup on schema/expression docs
* deprecations per [ticket:1498]:Mike Bayer2009-10-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - deprecated PassiveDefault - use DefaultClause. - the BINARY and MSBinary types now generate "BINARY" in all cases. Omitting the "length" parameter will generate "BINARY" with no length. Use BLOB to generate an unlengthed binary column. - the "quoting='quoted'" argument to MSEnum/ENUM is deprecated. It's best to rely upon the automatic quoting. - "shortname" attribute on bindparam() is removed. - fold_equivalents flag on join is deprecated (will remain until [ticket:1131] is implemented) - "scalar" flag on select() is removed, use select.as_scalar(). - 'transactional' flag on sessionmaker() and others is removed. Use 'autocommit=True' to indicate 'transactional=False'. - 'polymorphic_fetch' argument on mapper() is removed. Loading can be controlled using the 'with_polymorphic' option. - 'select_table' argument on mapper() is removed. Use 'with_polymorphic=("*", <some selectable>)' for this functionality. - 'proxy' argument on synonym() is removed. This flag did nothing throughout 0.5, as the "proxy generation" behavior is now automatic. - Passing a single list of elements to eagerload(), eagerload_all(), contains_eager(), lazyload(), defer(), and undefer() instead of multiple positional -args is deprecated. - Passing a single list of elements to query.order_by(), query.group_by(), query.join(), or query.outerjoin() instead of multiple positional *args is deprecated. - query.iterate_instances() is removed. Use query.instances(). - Query.query_from_parent() is removed. Use the sqlalchemy.orm.with_parent() function to produce a "parent" clause, or alternatively query.with_parent(). - query._from_self() is removed, use query.from_self() instead. - the "comparator" argument to composite() is removed. Use "comparator_factory". - RelationProperty._get_join() is removed. - the 'echo_uow' flag on Session is removed. Use logging on the "sqlalchemy.orm.unitofwork" name. - session.clear() is removed. use session.expunge_all(). - session.save(), session.update(), session.save_or_update() are removed. Use session.add() and session.add_all(). - the "objects" flag on session.flush() remains deprecated. - the "dont_load=True" flag on session.merge() is deprecated in favor of "load=False". - passing an InstanceState (internal SQLAlchemy state object) to attributes.init_collection() or attributes.get_history() is deprecated. These functions are public API and normally expect a regular mapped object instance. - the 'engine' parameter to declarative_base() is removed. Use the 'bind' keyword argument.
* - an executemany() now requires that all bound parameterMike Bayer2009-10-151-0/+4
| | | | | | | | | | | | sets require that all keys are present which are present in the first bound parameter set. The structure and behavior of an insert/update statement is very much determined by the first parameter set, including which defaults are going to fire off, and a minimum of guesswork is performed with all the rest so that performance is not impacted. For this reason defaults would otherwise silently "fail" for missing parameters, so this is now guarded against. [ticket:1566]
* remove instanceof() in favor of memoized flags, part of [ticket:1566]Mike Bayer2009-10-141-1/+21
|
* - added "ddl" argument to the "on" callable of DDLElement [ticket:1538]Mike Bayer2009-10-121-50/+55
| | | | | | - fixed the imports in the "postgres" cleanup dialect - renamed "schema_item" attribute/argument of DDLElement to "target".
* - unit test fixesMike Bayer2009-10-101-2/+2
| | | | | - py3k readme - removed column.sequence accessor
* merge from branches/clauseelement-nonzeroPhilip Jenvey2009-09-241-5/+5
| | | | | | adds a __nonzero__ to _BinaryExpression to avoid faulty comparisons during hash collisions (which only occur on Jython) fixes #1547
* all about DDL eventsMike Bayer2009-09-111-1/+4
|
* docsMike Bayer2009-09-101-5/+6
|
* - Fixed column.copy() to copy defaults and onupdates.Mike Bayer2009-08-281-0/+4
| | | | [ticket:1373]
* python3k fixesMike Bayer2009-08-091-1/+10
|
* documentation updatesMike Bayer2009-08-071-14/+40
|
* merge 0.6 series to trunk.Mike Bayer2009-08-061-588/+622
|
* - Fixed bug in Table and Column whereby passing emptyMike Bayer2009-07-251-12/+8
| | | | | dict for "info" argument would raise an exception. [ticket:1482]
* changed reference to PostgreSQL in docs.rel_0_5_5Mike Bayer2009-07-131-1/+1
|
* removed needless "thread" imports from utilMike Bayer2009-05-301-1/+1
|
* Added multi part schema name support. Closes #594 and #1341.Michael Trier2009-04-111-6/+22
|
* - Fixed __repr__() and other _get_colspec() methods onMike Bayer2009-03-271-1/+6
| | | | | ForeignKey constructed from __clause_element__() style construct (i.e. declarative columns). [ticket:1353]
* - use ForeignKey.column as _colspec source in Column._make_proxy(), ↵Mike Bayer2009-01-141-6/+14
| | | | | | | | | | | | | preventing needless redundant string arithmetic in memoized ForeignKey.column method - _pre_existing_column attribute becomes optional, only needed for original Table-bound column, not proxies - compare two ForeignKeys based on target_fullname, don't assume self._colspec is a string - Fixed bug when overriding a Column with a ForeignKey on a reflected table, where derived columns (i.e. the "virtual" columns of a select, etc.) would inadvertently call upon schema-level cleanup logic intended only for the original column. [ticket:1278]
* prefer this methodsMike Bayer2009-01-131-8/+3
|
* - Column with no name (as in declarative) won't raise aMike Bayer2009-01-131-1/+8
| | | | | NoneType error when it's string output is requsted (such as in a stack trace).
* happy new yearMike Bayer2009-01-121-1/+1
|
* - Concrete inheriting mappers now instrument attributes which are inherited ↵Mike Bayer2009-01-111-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from the superclass, but are not defined for the concrete mapper itself, with an InstrumentedAttribute that issues a descriptive error when accessed. [ticket:1237] - Added a new `relation()` keyword `back_populates`. This allows configuation of backreferences using explicit relations. [ticket:781] This is required when creating bidirectional relations between a hierarchy of concrete mappers and another class. [ticket:1237] - Test coverage added for `relation()` objects specified on concrete mappers. [ticket:1237] - A short documentation example added for bidirectional relations specified on concrete mappers. [ticket:1237] - Mappers now instrument class attributes upon construction with the final InstrumentedAttribute object which remains persistent. The `_CompileOnAttr`/`__getattribute__()` methodology has been removed. The net effect is that Column-based mapped class attributes can now be used fully at the class level without invoking a mapper compilation operation, greatly simplifying typical usage patterns within declarative. [ticket:1269] - Index now accepts column-oriented InstrumentedAttributes (i.e. column-based mapped class attributes) as column arguments. [ticket:1214] - Broke up attributes.register_attribute into two separate functions register_descriptor and register_attribute_impl. The first assembles an InstrumentedAttribute or Proxy descriptor, the second assembles the AttributeImpl inside the InstrumentedAttribute. register_attribute remains for outside compatibility. The argument lists have been simplified. - Removed class_manager argument from all but MutableScalarAttributeImpl (the branch had removed class_ as well but this has been reverted locally to support the serializer extension). - Mapper's previous construction of _CompileOnAttr now moves to a new MapperProperty.instrument_class() method which is called on all MapperProperty objects at the moment the mapper receives them. All MapperProperty objects now call attributes.register_descriptor within that method to assemble an InstrumentedAttribute object directly. - InstrumentedAttribute now receives the "property" attribute from the given PropComparator. The guesswork within the constructor is removed, and allows "property" to serve as a mapper compilation trigger. - RelationProperty.Comparator now triggers compilation of its parent mapper within a util.memoized_property accessor for the "property" attribute, which is used instead of "prop" (we can probably remove "prop"). - ColumnProperty and similar handle most of their initialization in their __init__ method since they must function fully at the class level before mappers are compiled. - SynonymProperty and ComparableProperty move their class instrumentation logic to the new instrument_class() method. - LoaderStrategy objects now add their state to existing InstrumentedAttributes using attributes.register_attribute_impl. Both column and relation-based loaders instrument in the same way now, with a unique InstrumentedAttribute *and* a unique AttributeImpl for each class in the hierarchy. attribute.parententity should now be correct in all cases. - Removed unitofwork.register_attribute, and simpified the _register_attribute methods into a single function in strategies.py. unitofwork exports the UOWEventHandler extension directly. - To accomodate the multiple AttributeImpls across a class hierarchy, the sethasparent() method now uses an optional "parent_token" attribute to identify the "parent". AbstractRelationLoader sends the MapperProperty along to serve as this token. If the token isn't present (which is only the case in the attributes unit tests), the AttributeImpl is used instead, which is essentially the same as the old behavior. - Added new ConcreteInheritedProperty MapperProperty. This is invoked for concrete mappers within _adapt_inherited_property() to accomodate concrete mappers which inherit unhandled attributes from the base class, and basically raises an exception upon access. [ticket:1237] - attributes.register_attribute and register_descriptor will now re-instrument an attribute unconditionally without checking for a previous attribute. Not sure if this is controversial. It's needed so that ConcreteInheritedProperty instrumentation can be overridden by an incoming legit MapperProperty without any complexity. - Added new UninstrumentedColumnLoader LoaderStrategy. This is used by the polymorphic_on argument when the given column is not represented within the mapped selectable, as is typical with a concrete scenario which maps to a polymorphic union. It does not configure class instrumentation, keeping polymorphic_on from getting caught up in the new concrete attribute-checking logic. - RelationProperty now records its "backref" attributes using a set assigned to `_reverse_property` instead of a scalar. The `back_populates` keyword allows any number of properties to be involved in a single bidirectional relation. Changes were needed to RelationProperty.merge(), DependencyProcessor to accomodate for the new multiple nature of this attribute. - Generalized the methodology used by ManyToManyDP to check for "did the other dependency already handle this direction", building on the `_reverse_property` collection. - post_update logic within dependency.py moves to use the same methodology as ManyToManyDP so that "did the other dependency do this already" checks are made to be specific to the two dependent instances. - Caught that RelationProperty.merge() was writing to instance.__dict__ directly (!) - repaired to talk to instance_state.dict. - Removed needless eager loading example from concrete mapper docs. - Added test for [ticket:965]. - Added the usual Node class/nodes table to orm/_fixtures.py, but haven't used it for anything yet. We can potentially update test/orm/query.py to use this fixture. - Other test/documentation cleanup.
* - Reflected foreign keys will properly locateMike Bayer2008-12-261-36/+47
| | | | | | | | | | | | | | | | | | | | | | | their referenced column, even if the column was given a "key" attribute different from the reflected name. This is achieved via a new flag on ForeignKey/ForeignKeyConstraint called "link_to_name", if True means the given name is the referred-to column's name, not its assigned key. [ticket:650] - removed column types from sqlite doc, we aren't going to list out "implementation" types since they aren't significant and are less present in 0.6 - mysql will report on missing reflected foreign key targets in the same way as other dialects (we can improve that to be immediate within reflecttable(), but it should be within ForeignKeyConstraint()). - postgres dialect can reflect table with an include_columns list that doesn't include one or more primary key columns
* merged -r5299:5438 of py3k warnings branch. this fixes some sqlite py2.6 ↵Mike Bayer2008-12-181-4/+6
| | | | | | | | testing issues, and also addresses a significant chunk of py3k deprecations. It's mainly expicit __hash__ methods. Additionally, most usage of sets/dicts to store columns uses util-based placeholder names.