diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-08-24 18:48:42 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-08-24 18:48:42 -0400 |
commit | 393b29477648e9b2db9597916a0e53602610ac44 (patch) | |
tree | 533dc7cb74b21cbd6f9ebeab89a6837c9bf30f35 /lib/sqlalchemy/schema.py | |
parent | a113c7b3a74f3c1b3128995a20c1760c87695cf3 (diff) | |
download | sqlalchemy-393b29477648e9b2db9597916a0e53602610ac44.tar.gz |
- [feature] Added support for .info dictionary argument to
column_property(), relationship(), composite().
All MapperProperty classes have an auto-creating .info
dict available overall.
Diffstat (limited to 'lib/sqlalchemy/schema.py')
-rw-r--r-- | lib/sqlalchemy/schema.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 4ce27582b..8b46dc250 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -71,6 +71,14 @@ class SchemaItem(events.SchemaEventTarget, visitors.Visitable): @util.memoized_property def info(self): + """Info dictionary associated with the object, allowing user-defined + data to be associated with this :class:`.SchemaItem`. + + The dictionary is automatically generated when first accessed. + It can also be specified in the constructor of some objects, + such as :class:`.Table` and :class:`.Column`. + + """ return {} def _get_table_key(name, schema): @@ -204,8 +212,8 @@ class Table(SchemaItem, expression.TableClause): ``Table`` object. Defaults to ``None`` which indicates all columns should be reflected. - :param info: A dictionary which defaults to ``{}``. A space to store - application specific data. This must be a dictionary. + :param info: Optional data dictionary which will be populated into the + :attr:`.SchemaItem.info` attribute of this object. :param keep_existing: When ``True``, indicates that if this Table is already present in the given :class:`.MetaData`, ignore @@ -408,11 +416,6 @@ class Table(SchemaItem, expression.TableClause): self, include_columns, exclude_columns ) - @util.memoized_property - def info(self): - """Dictionary provided for storage of additional information.""" - return {} - @property def _sorted_constraints(self): """Return the set of constraints as a list, sorted by creation order.""" @@ -797,8 +800,8 @@ class Column(SchemaItem, expression.ColumnClause): contain multiple columns, use the :class:`.Index` construct instead. - :param info: A dictionary which defaults to ``{}``. A space to store - application specific data. This must be a dictionary. + :param info: Optional data dictionary which will be populated into the + :attr:`.SchemaItem.info` attribute of this object. :param nullable: If set to the default of ``True``, indicates the column will be rendered as allowing NULL, else it's rendered as @@ -971,11 +974,6 @@ class Column(SchemaItem, expression.ColumnClause): else: return self.description - @util.memoized_property - def info(self): - """Dictionary provided for storage of additional information.""" - return {} - def references(self, column): """Return True if this Column references the given column via foreign key.""" |