Changes between Version 3 and Version 4 of FAQ

Show
Ignore:
Timestamp:
12/15/07 11:10:09 (5 years ago)
Author:
ged (IP: 213.219.164.51)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FAQ

    v3 v4  
    88#!python 
    99class Person(Entity): 
    10     id = Field(Integer, primary_key=True) 
     10    person_id = Field(Integer, primary_key=True) 
    1111    firstname = Field(Unicode(30)) 
    1212    surname = Field(Unicode(30)) 
    1313}}} 
    1414 
     15This also works if your primary key is composed of several fields: 
     16 
     17{{{ 
     18#!python 
     19class Person(Entity): 
     20    firstname = Field(Unicode(30), primary_key=True) 
     21    surname = Field(Unicode(30), primary_key=True) 
     22}}} 
     23 
     24 
    1525=== Is there a way to declare uniqueness constraints? === 
    1626         
    17 Yes, you can use the `using_table_options` statement.  Here is an example: 
     27Yes, you can use the `using_table_options` statement in combination with SQLAlchemy's `UniqueConstraint`.  Here is an example: 
    1828{{{ 
    1929#!python 
     30from sqlalchemy import UniqueConstraint 
     31 
    2032class Person(Entity): 
    2133    firstname = Field(Unicode(30))