Changeset 401
- Timestamp:
- 09/15/08 15:32:51 (5 years ago)
- Location:
- elixir/trunk/elixir
- Files:
-
- 3 modified
-
fields.py (modified) (1 diff)
-
options.py (modified) (1 diff)
-
relationships.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/elixir/fields.py
r383 r401 105 105 has_field('name', String(50)) 106 106 ''' 107 import sys108 109 107 from sqlalchemy import Column 110 108 from sqlalchemy.orm import deferred, synonym -
elixir/trunk/elixir/options.py
r400 r401 174 174 ''' 175 175 176 import sqlalchemy177 import sqlalchemy.orm178 176 from sqlalchemy import Integer, String 179 177 -
elixir/trunk/elixir/relationships.py
r400 r401 64 64 | Option Name | Description | 65 65 +======================+======================================================+ 66 | ``colname`` | Specify a custom column name. | 66 | ``colname`` | Specify a custom name for the foreign key column(s). | 67 | | This argument accepts either a single string or a | 68 | | list of strings. The number of strings passed must | 69 | | match the number of primary key columns of the target| 70 | | entity. If this argument is not used, the name of the| 71 | | column(s) is generated with the pattern | 72 | | defined in options.FKCOL_NAMEFORMAT, which is, by | 73 | | default: "%(relname)s_%(key)s", where relname is the | 74 | | name of the ManyToOne relationship, and 'key' is the | 75 | | name (key) of the primary column in the target | 76 | | entity. That's with, in the above Pet/owner example, | 77 | | the name of the column would be: "owner_id". | 67 78 +----------------------+------------------------------------------------------+ 68 79 | ``required`` | Specify whether or not this field can be set to None | … … 124 135 +======================+======================================================+ 125 136 | ``field`` | Specify the previously-declared field to be used for | 126 | | the foreign key |127 | | column. Use of this parameter is mutually exclusive|128 | | with the colname and column_kwargs arguments.|137 | | the foreign key column. Use of this parameter is | 138 | | mutually exclusive with the colname and column_kwargs| 139 | | arguments. | 129 140 +----------------------+------------------------------------------------------+ 130 141 … … 216 227 articles = ManyToMany('Article') 217 228 218 Behind the scene, the ``ManyToMany`` relationship will 219 automatically create anintermediate table to host its data.229 Behind the scene, the ``ManyToMany`` relationship will automatically create an 230 intermediate table to host its data. 220 231 221 232 Note that you don't necessarily need to define the inverse relationship. In … … 237 248 | | can be used both when the tables needs to be created | 238 249 | | and when the table is autoloaded/reflected from the | 239 | | database. | 250 | | database. If this argument is not used, a name will be | 251 | | automatically generated by Elixir depending on the name| 252 | | of the tables of the two entities of the relationship, | 253 | | the name of the relationship, and, if present, the name| 254 | | of its inverse. Even though this argument is optional, | 255 | | it is wise to use it if you are not sure what are the | 256 | | exact consequence of using a generated table name. | 240 257 +--------------------+--------------------------------------------------------+ 241 258 | ``schema`` | Specify a custom schema for the intermediate table. | … … 374 391 ''' 375 392 376 import sys377 393 import warnings 378 394 … … 383 399 import options 384 400 from elixir.statements import ClassMutator 385 from elixir.fields import Field386 401 from elixir.properties import Property 387 from elixir.entity import Entity Descriptor, EntityMeta, DEBUG402 from elixir.entity import EntityMeta, DEBUG 388 403 389 404 __doc_all__ = [] … … 823 838 e1_schema = e1_desc.table_options.get('schema', None) 824 839 e2_schema = e2_desc.table_options.get('schema', None) 825 schema = (self.schema is not None) and s chema or e1_schema840 schema = (self.schema is not None) and self.schema or e1_schema 826 841 827 842 assert e1_schema == e2_schema or self.schema, \
