1 from sqlalchemy
import Column
, ForeignKey
2 from sqlalchemy
.orm
import relation
3 from sqlalchemy
.types
import Integer
, Unicode
5 from floof
.model
import meta
7 __all__
= ['User', 'IdentityURL']
9 class User(meta
.TableBase
):
10 __tablename__
= 'users'
11 id = Column(Integer
, primary_key
=True)
12 name
= Column(Unicode(length
=20), nullable
=False)
14 class IdentityURL(meta
.TableBase
):
15 __tablename__
= 'identity_urls'
16 url
= Column(Unicode(length
=255), primary_key
=True)
17 user_id
= Column(Integer
, ForeignKey('users.id'))
19 IdentityURL
.user
= relation(User
, lazy
=False, backref
="identity_urls")