Instantly share code, notes, and snippets.

Embed
What would you like to do?
class GuideMixin(object):
""" Provides methods for parsing Rovi flat files. This class must be
subclassed by SQLAlchemy model classes wishing to use the file loading.
"""
flatfile = None
#set to true if the table does contain a delta column
nodelta = False
@ClassProperty
@classmethod
def fieldorder(cls):
""" Returns the column names in the order they are in the
flat file.
By default returns the column attribute names in order of definition.
Elements set to None will be skipped.
"""
fields = [col.name for col in cls.__table__.columns]
fields.append(u'delta')
return fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment