Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@adiroiban
Last active December 15, 2015 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adiroiban/5308783 to your computer and use it in GitHub Desktop.
Save adiroiban/5308783 to your computer and use it in GitHub Desktop.
Describe an object persisted in DB using interfaces and schema.
class IDBEventEntry(IDBTable):
message_id = schema.db.Integer(name='event_id', description='Some docstring here', lenght=12)
class DBObject(TwistarDBObject):
def getColums():
"""
Return all db columns.
"""
dev validateSchama():
"""
return a deferred with return None if everthing is ok
raise an DBValidationError if things go wrong.
"""
DBEventEntru(DBObject):
implements(IDBEventEntry)
def __init__(self):
self.message_id = 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment