Commit Graph

635 Commits

Author SHA1 Message Date
Mike Bayer aa557982fa - Added new ENUM type to the Postgresql dialect, which exists as a schema-level
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
2009-10-25 00:40:34 +00:00
Mike Bayer b16f1ca427 fix SQL output 2009-10-12 16:32:29 +00:00
Mike Bayer d6239f2262 - added "ddl" argument to the "on" callable of DDLElement [ticket:1538]
- fixed the imports in the "postgres" cleanup dialect
- renamed "schema_item" attribute/argument of DDLElement
  to "target".
2009-10-12 00:11:00 +00:00
Mike Bayer b47f8237d8 export UPPERCASE types as "from sqlalchemy.dialects.<dbname> import VARCHAR, TEXT, INET, ..." 2009-10-10 19:28:18 +00:00
Lele Gaifax 3c1e054251 Fix #1560 revisiting Firebird dialect docs 2009-10-03 13:44:14 +00:00
Philip Jenvey 79ce8e89bd small change 2009-09-21 19:43:51 +00:00
Mike Bayer 2acd40f0dc tweaks 2009-09-20 16:48:15 +00:00
Mike Bayer 6d4186999f a picture 2009-09-20 16:40:02 +00:00
Philip Jenvey a5217abf5f typo 2009-09-11 23:18:27 +00:00
Philip Jenvey fd22efe297 oracle/mssql+zxjdbc blurb 2009-09-11 23:16:20 +00:00
Mike Bayer 5ca7fa3abd all about DDL events 2009-09-11 22:37:13 +00:00
Mike Bayer 0c26713326 docs 2009-09-10 21:23:04 +00:00
Mike Bayer d987afc8d9 move foreign keys stuff into the constraints section 2009-09-09 21:00:14 +00:00
Mike Bayer a3499358f9 edits plus redid "sequences". 2009-09-09 20:18:48 +00:00
Mike Bayer 590d5d99f0 fix update examples for [ticket:1533] 2009-09-09 16:26:26 +00:00
Mike Bayer ebcdb289d9 - distill contextual parameters for the purpose of default functions into context.current_parameters
- metadata docs continued
2009-09-03 22:26:16 +00:00
Mike Bayer 030ca77f68 doc fixes 2009-08-25 01:31:27 +00:00
Lele Gaifax f50bac1b74 Replace HTML entities with reST markup 2009-08-11 08:19:37 +00:00
Mike Bayer 57fe160fe7 some doc work 2009-08-10 23:06:07 +00:00
Mike Bayer 347150090e 0.6 2009-08-10 21:44:14 +00:00
Mike Bayer 57b36ebcb8 documentation updates 2009-08-07 22:17:24 +00:00
Mike Bayer 8fc5005dfe merge 0.6 series to trunk. 2009-08-06 21:11:27 +00:00
Mike Bayer 066bdaec75 beefed up documentation for count(), [ticket:1465] 2009-07-25 18:54:20 +00:00
Mike Bayer f5b055fabb beefed up the description of dialects 2009-07-13 22:53:20 +00:00
Mike Bayer 5503028d8c changed reference to PostgreSQL in docs. 2009-07-13 02:04:54 +00:00
Mike Bayer 40772955a5 - remove docs about partial flush, add docs about disabling autoflush 2009-07-12 22:34:06 +00:00
Mike Bayer eeecbb8fc6 updates 2009-07-11 21:07:52 +00:00
Mike Bayer d8aa899bfb added docs for post_update 2009-06-21 16:21:52 +00:00
Mike Bayer adde312c2a assoc proxy object appends to list automatically [ticket:1351] 2009-06-15 22:39:45 +00:00
Mike Bayer d7e531ce9f - Back-ported the "compiler" extension from SQLA 0.6. This
is a standardized interface which allows the creation of custom
ClauseElement subclasses and compilers.  In particular it's
handy as an alternative to text() when you'd like to
build a construct that has database-specific compilations.
See the extension docs for details.
2009-05-17 22:58:21 +00:00
Mike Bayer d1d3c1ad93 unusual ... 2009-05-17 22:44:35 +00:00
Michael Trier 78da9e361b Corrected missing stop in the ORM Tutorial. Fixes #1395. 2009-04-29 00:14:09 +00:00
Mike Bayer 3eeb240fd1 we work with sphinx 0.6.1 now 2009-04-25 15:13:30 +00:00
Michael Trier 0143770384 Corrected duplication of serializer docs. Fixes #1375. 2009-04-09 22:57:16 +00:00
Michael Trier a7574d3a26 Added Oracle examples showing how to use named parameters with a TNS. Fixes #1361. 2009-04-04 02:42:42 +00:00
Michael Trier 7f1e6621f8 Corrected examples in ORM tutorial to specify actual exception being thrown. Fixes 1365. 2009-04-04 02:39:23 +00:00
Michael Trier 1954b87039 Corrected doc notations that suppressed some non-SQL output. Fixes #1366. 2009-04-04 00:48:26 +00:00
Mike Bayer 12b5ab7e4f - added a section on using aliased() with a subquery
- doctests needed huge number of +NORMALIZE_WHITESPACE not needed before for some reason
2009-03-29 18:39:54 +00:00
Mike Bayer 0bb1e1b8e3 add collections module to API ref for completeness. links to the mapper documentation
which is less wordy.
2009-03-21 18:03:47 +00:00
Mike Bayer 4928ea0e46 - updated builders for latest sphinx tip
- applied patch from [ticket:1321]
2009-03-02 00:01:09 +00:00
Lele Gaifax b2204616c7 Fix markup glitch 2009-02-25 13:20:38 +00:00
Mike Bayer 2cee9cb243 - Added an attribute helper method `set_committed_value` in
sqlalchemy.orm.attributes.  Given an object, attribute name,
and value, will set the value on the object as part of its
"committed" state, i.e. state that is understood to have
been loaded from the database.   Helps with the creation of
homegrown collection loaders and such.
- documented public attributes helper functions.
2009-02-15 20:43:14 +00:00
Mike Bayer 332be8c396 further fixes to sphinx.sty per progress on the sphinx trunk 2009-01-24 22:42:30 +00:00
Mike Bayer cb69dd6aea create correct hyperlink for the pdf file 2009-01-24 19:51:32 +00:00
Mike Bayer 20132a9caa - 0.5.3
- add new directives to sphinx.sty.  pdf output is still currently busted for other reasons, however.
2009-01-24 19:37:41 +00:00
Mike Bayer 7c56371f81 - Further refined 0.5.1's warning about delete-orphan cascade
placed on a many-to-many relation.   First, the bad news:
the warning will apply to both many-to-many as well as
many-to-one relations.  This is necessary since in both
cases, SQLA does not scan the full set of potential parents
when determining "orphan" status - for a persistent object
it only detects an in-python de-association event to establish
the object as an "orphan".  Next, the good news: to support
one-to-one via a foreign key or assocation table, or to
support one-to-many via an association table, a new flag
single_parent=True may be set which indicates objects
linked to the relation are only meant to have a single parent.
The relation will raise an error if multiple parent-association
events occur within Python.

- Fixed bug in delete-orphan cascade whereby two one-to-one
relations from two different parent classes to the same target
class would prematurely expunge the instance.  This is
an extension of the non-ticketed fix in r4247.

- the order of "sethasparent" flagging in relation to
AttributeExtensions has been refined such that false setparents
are issued before the event, true setparents issued afterwards.
event handlers "know" that a remove event originates
from a non-orphan but need to know if its become an orphan,
and that append events will become non-orphans but need to know
if the event originates from a non-orphan.
2009-01-20 21:35:57 +00:00
Lele Gaifax 4fad095858 Fix a hyperref 2009-01-14 17:02:17 +00:00
Mike Bayer 4ae6690bb9 happy new year 2009-01-12 21:19:11 +00:00
Mike Bayer 32add82d01 - Can now specify Column objects on subclasses which have no
table of their own (i.e. use single table inheritance).
The columns will be appended to the base table, but only
mapped by the subclass.

- For both joined and single inheriting subclasses, the subclass
will only map those columns which are already mapped on the
superclass and those explicit on the subclass.  Other
columns that are present on the `Table` will be excluded
from the mapping by default, which can be disabled
by passing a blank `exclude_properties` collection to the
`__mapper_args__`.  This is so that single-inheriting
classes which define their own columns are the only classes
to map those columns.   The effect is actually a more organized
mapping than you'd normally get with explicit `mapper()`
calls unless you set up the `exclude_properties` arguments
explicitly.

- docs/tests
2009-01-12 20:36:06 +00:00
Mike Bayer 209e888e1b - Concrete inheriting mappers now instrument attributes which are inherited 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.
2009-01-11 22:41:20 +00:00