Commit Graph

586 Commits

Author SHA1 Message Date
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
Mike Bayer cacc64d809 typo 2009-01-07 01:13:29 +00:00
Mike Bayer be0c5e4a0b one more typo 2009-01-03 19:37:17 +00:00
Mike Bayer 7e57e282c5 fixed critical errors in assocationproxy docs while we wait for the all new and improved version 2009-01-03 19:35:59 +00:00
Mike Bayer f9adad3acc - added another usage recipe for contains_eager()
- some typos
2008-12-29 20:25:11 +00:00
Mike Bayer 83a756c541 - Reflected foreign keys will properly locate
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
2008-12-26 05:28:38 +00:00
Mike Bayer 7933395055 document ConnectionProxy 2008-12-18 00:12:12 +00:00
Mike Bayer 7b7530de19 - sqlite types
- fixed targeting for sqlalchemy.types
2008-12-17 20:53:43 +00:00
Mike Bayer 172781e678 - added sphinx handler to allow __init__ methods through
- sqlite module documentation
- some corrections to pool docs
- the example in URL.translate_connect_args() never made any sense anyway so removed it
2008-12-17 20:12:07 +00:00
Michael Trier c712af4d4c Corrected output on docs and a missing {stop} that prevented python results from displaying in the docs. 2008-12-12 21:59:33 +00:00
Jason Kirtland 8d3fab1250 Index entries for thread safety. 2008-12-11 22:09:12 +00:00
Mike Bayer 609d8e8bc3 - VERSION moves just as a string in __version__
- added modified sphinx.sty with plain Verbatim section
- link to pdf doc in site
2008-12-10 21:27:21 +00:00
Mike Bayer 70f55bd2cd - restored the previous API Reference structure
- bumped latex TOC structure, the PDF looks great
- but we need to fix the translate_connect_args docstring bug to really have PDF
2008-12-08 21:32:29 +00:00
Mike Bayer 082d5db64f - removed redundant declarative docs
- cleanup of metadata/foreignkey docs
2008-12-08 20:21:02 +00:00
Mike Bayer dd91a165cc - restored the main search form
- fixed search highlighting
- the url docstring works again from a ReST perspective, still not PDF
2008-12-08 00:20:20 +00:00
Mike Bayer 480436ff7c - moved index.rst around to have the API docs right there, no "Main Documentation" chapter which is fairly needless. this all allows PDF to have a decent TOC on the side with only two levels (can we change that ?)
- added LatexFormatter.
- PDF wont work until issue with the docstirng in url.py/URL.translate_connect_args is fixed.
2008-12-07 23:58:02 +00:00
Mike Bayer 058c2895be worked schema into sections 2008-12-07 21:10:27 +00:00
Mike Bayer 9bab01d37b - convert __init__ and :members: to be compatible with autoclass_content='both' 2008-12-07 20:13:26 +00:00
Mike Bayer ee7fcf3110 - re-documented Table and Column constructors, fixed case sensitivity description [ticket:1231]
- turned on autoclass_content="both".  Need to specify __init__ docstring with a newline after the """.
- other docs
2008-12-07 06:30:00 +00:00
Jason Kirtland bdf0117578 Adjusted basis for refs. 2008-12-07 06:26:36 +00:00
Mike Bayer 994ab27aa3 - postgres docstring
- insert/update/delete are documented generatively
- values({}) is no longer deprecated, thus enabling
unicode/Columns as keys
2008-12-06 18:27:04 +00:00
Jason Kirtland de4ed96ec0 Enabled sphinx doctests. 2008-12-06 17:47:20 +00:00
Mike Bayer 65390f035a remove old files 2008-12-06 17:00:17 +00:00
Mike Bayer 1c329624a5 - merged -r5338:5429 of sphinx branch.
- Documentation has been converted to Sphinx.
In particular, the generated API documentation
has been constructed into a full blown
"API Reference" section which organizes
editorial documentation combined with
generated docstrings.   Cross linking between
sections and API docs are vastly improved,
a javascript-powered search feature is
provided, and a full index of all
classes, functions and members is provided.
2008-12-06 16:59:48 +00:00
Mike Bayer e3502f7f9d deprecated CompositeProperty 'comparator' which is now
named 'comparator_factory'.
2008-11-24 01:44:08 +00:00
Mike Bayer 6c8af5108e one more select_table... 2008-11-24 01:21:08 +00:00
Mike Bayer 75e8350e4d - comparator_factory is accepted by all MapperProperty constructors. [ticket:1149]
- added other unit tests as per [ticket:1149]
- rewrote most of the "joined table inheritance" documentation section, removed badly out of
date "polymorphic_fetch" and "select_table" arguments.
- "select_table" raises a deprecation warning.  converted unit tests to not use it.
- removed all references to "ORDER BY table.oid" from mapping docs.
- renamed PropertyLoader to RelationProperty.  Old symbol remains.
- renamed ColumnProperty.ColumnComparator to ColumnProperty.Comparator.  Old symbol remains.
2008-11-24 01:14:32 +00:00
Mike Bayer 2c69cdb350 - Tickets [ticket:1200].
- Added note about create_session() defaults.

- Added section about metadata.reflect().

- Updated `TypeDecorator` section.

- Rewrote the "threadlocal" strategy section of
the docs due to recent confusion over this
feature.

- ordered the init arguments in the docs for sessionmaker().

- other edits
2008-11-22 19:22:42 +00:00
Mike Bayer f03e4ca595 prevent extra nested li items from becoming tiny 2008-11-22 17:46:03 +00:00
Michael Trier 097f76b465 Doing my part-time editorial duties. Normalized session references and fixed lots of small spelling and grammar issues. 2008-11-12 03:05:13 +00:00
Mike Bayer cfca625e94 docstring updates 2008-11-07 22:36:21 +00:00
Mike Bayer 0a48075161 - added serializer docs to plugins.txt
- CHANGES formatting
2008-11-07 18:43:39 +00:00
Mike Bayer c3352e5542 - Fixed bug in Query involving order_by() in conjunction with
multiple aliases of the same class (will add tests in
[ticket:1218])
- Added a new extension sqlalchemy.ext.serializer.  Provides
Serializer/Deserializer "classes" which mirror Pickle/Unpickle,
as well as dumps() and loads().  This serializer implements
an "external object" pickler which keeps key context-sensitive
objects, including engines, sessions, metadata, Tables/Columns,
and mappers, outside of the pickle stream, and can later
restore the pickle using any engine/metadata/session provider.
This is used not for pickling regular object instances, which are
pickleable without any special logic, but for pickling expression
objects and full Query objects, such that all mapper/engine/session
dependencies can be restored at unpickle time.
2008-11-06 23:07:47 +00:00
Mike Bayer 9f894d2f26 - Dialects can now generate label names of adjustable length.
Pass in the argument "label_length=<value>" to create_engine()
to adjust how many characters max will be present in dynamically
generated column labels, i.e. "somecolumn AS somelabel".  Any
value less than 6 will result in a label of minimal size,
consiting of an underscore and a numeric counter.
The compiler uses the value of dialect.max_identifier_length
as a default. [ticket:1211]
- removed ANON_NAME regular expression, using string patterns now
- _generated_label() unicode subclass is used to indicate generated names
which are subject to truncation
2008-11-05 20:50:48 +00:00
Jason Kirtland 837f71eca5 Fixed assoc proxy examples [ticket:1191] 2008-11-02 22:50:12 +00:00
Michael Trier aa6c4df395 Corrected typo in Types docs. 2008-10-28 18:09:22 +00:00
Michael Trier 3d0fe5bfe2 Demonstrate mssql url examples for the database engine documentation. Closes #1198. 2008-10-23 02:09:27 +00:00
Michael Trier c4da034f7e Included documentation about the defaults for create_session() and how they differ from sessionmaker(). Closes #1197. 2008-10-23 01:47:44 +00:00
Michael Trier 86c3992318 Added in sqlite3 DBAPI to the SQLite dbengine docs. This along with a wiki edit on Database Features should close #1145. 2008-10-05 13:28:56 +00:00
Michael Trier f0a40280fd Corrected docs for declarative synonym incorrectly referring to instruments instead of descriptor. 2008-10-05 03:30:58 +00:00
Mike Bayer 17309da8e6 fixed custom TypeEngine example 2008-09-27 21:15:51 +00:00
Mike Bayer 36570c6595 - Dropped 0.3-compatibility for user defined types
(convert_result_value, convert_bind_param).
2008-09-07 00:13:28 +00:00
Mike Bayer c164c174a5 correction 2008-09-02 19:59:55 +00:00
Mike Bayer 3829b89d69 - column_property(), composite_property(), and relation() now
accept a single or list of AttributeExtensions using the
"extension" keyword argument.
- Added a Validator AttributeExtension, as well as a
@validates decorator which is used in a similar fashion
as @reconstructor, and marks a method as validating
one or more mapped attributes.
- removed validate_attributes example, the new methodology replaces it
2008-09-02 19:51:48 +00:00
Michael Trier c99d54e762 Corrected typo in the mapper docs. Fixes #1159. 2008-08-28 14:21:07 +00:00
Jason Kirtland 0b4b2454af Type processors get a dialect, not an engine... 2008-08-27 19:10:03 +00:00
Gaëtan de Menten 90ba350099 - Fix occurences of Class.c.column_name
- Fix a few typos/mistakes
- removed trailing whitespaces
- tried to achieve a more consistent syntax for spaces in properties
  declaration
2008-08-21 09:12:54 +00:00
Jason Kirtland 2d4908e88c - Renamed on_reconstitute to @reconstructor and reconstruct_instance
- Moved @reconstructor hooking to mapper
- Expanded reconstructor tests, docs
2008-08-15 22:03:42 +00:00
Mike Bayer 7897dd9827 added info on named tuples 2008-08-12 14:55:38 +00:00
Mike Bayer bf43d45cea added col with no name example 2008-08-11 18:00:10 +00:00