Skip to content

Instantly share code, notes, and snippets.

@raygunsix
Created April 12, 2010 22:01
Show Gist options
  • Save raygunsix/364048 to your computer and use it in GitHub Desktop.
Save raygunsix/364048 to your computer and use it in GitHub Desktop.
sample pylons model with sa declarative syntax
from collector.model.meta import Base
# Using SQLAlchemy 0.5 optional declarative syntax
# More info here: http://pylonshq.com/docs/en/0.9.7/models/
# and here: http://pylonshq.com/pasties/1000
class Keyphrases(Base):
__tablename__ = "keyphrases"
__table_args__ = {'schema':'algo'}
keyword_id = sa.Column(sa.types.Integer, sa.Sequence('keyword_id_seq', optional=True), primary_key=True)
keyword = sa.Column(sa.types.String(256), default='')
source = sa.Column(sa.types.String(25), index=True, default='')
insert_date = sa.Column(sa.types.DateTime, index=True, default='')
check_date = sa.Column(sa.types.DateTime, index=True)
global_monthly = sa.Column(sa.types.Numeric, default='0')
ngram_group = sa.Column(sa.types.String(250), default='')
average_targeted_monthly = sa.Column(sa.types.Numeric, default='0')
competition = sa.Column(sa.types.Numeric, default='0')
total_search_results = sa.Column(sa.types.Numeric, default='0')
keyword_type = sa.Column(sa.types.String(25), default='')
upperclicksperday = sa.Column(sa.types.Numeric, default='0')
lowerclicksperday = sa.Column(sa.types.Numeric, default='0')
lowercpc = sa.Column(sa.types.Numeric, default='0')
uppercpc = sa.Column(sa.types.Numeric, default='0')
upperavgposition = sa.Column(sa.types.Numeric, default='0')
loweravgposition = sa.Column(sa.types.Numeric, default='0')
sa.Index('idx_nggm', Keyphrases.ngram_group, Keyphrases.global_monthly)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment