)
user_prefs = Table('user_prefs', engine,
- Column('pref_id', Integer, primary_key = True),
- Column('user_id', Integer, nullable = False, ForeignKey("users.user_id"))
- Column('pref_name', String(40), nullable = False),
+ Column('pref_id', Integer, primary_key=True),
+ Column('user_id', Integer, ForeignKey("users.user_id"), nullable=False),
+ Column('pref_name', String(40), nullable=False),
Column('pref_value', String(100))
)
</&>
<p>Defining a Sequence means that it will be created along with the table.create() call, and more importantly the sequence will be explicitly used when inserting new rows for this table. For databases that dont support sequences, the Sequence object has no effect. A sequence can also be specified with <span class="codeline">optional=True</span> which indicates the Sequence should only be used on a database that requires an explicit sequence (which currently is just Oracle). A database like Postgres, while it uses sequences to create primary keys, is often used via the SERIAL column option which removes the need for explicit access to the sequence.</p>
</&>
-</&>
\ No newline at end of file
+</&>