def make_query_queue_table(): metadata = make_metadata(query_queue_engine) table = sa.Table(settings.DB_APP_NAME + '_query_queue', metadata, sa.Column('iden', sa.String, primary_key = True), sa.Column('query', sa.Binary), sa.Column('date', sa.DateTime(timezone = True))) date_idx = index_str(table, 'date', 'date') create_table(table, [date_idx]) return table
def make_query_queue_table(): engine = g.dbm.engines['query_queue'] metadata = make_metadata(engine) table = sa.Table(g.db_app_name + '_query_queue', metadata, sa.Column('iden', sa.String, primary_key = True), sa.Column('query', sa.Binary), sa.Column('date', sa.DateTime(timezone = True))) date_idx = index_str(table, 'date', 'date') create_table(table, [date_idx]) return table
def __init__(self, force = False): engine = g.dbm.get_engine('email') self.metadata = make_metadata(engine) self.queue_table = mail_queue(self.metadata) indices = [index_str(self.queue_table, "date", "date"), index_str(self.queue_table, 'kind', 'kind')] create_table(self.queue_table, indices) self.opt_table = opt_out(self.metadata) indices = [index_str(self.opt_table, 'email', 'email')] create_table(self.opt_table, indices) self.track_table = sent_mail_table(self.metadata) self.reject_table = sent_mail_table(self.metadata, name = "reject_mail") def sent_indices(tab): indices = [index_str(tab, 'to_addr', 'to_addr'), index_str(tab, 'date', 'date'), index_str(tab, 'ip', 'ip'), index_str(tab, 'kind', 'kind'), index_str(tab, 'fullname', 'fullname'), index_str(tab, 'account_id', 'account_id'), index_str(tab, 'msg_hash', 'msg_hash'), ] create_table(self.track_table, sent_indices(self.track_table)) create_table(self.reject_table, sent_indices(self.reject_table))
def __init__(self, force=False): engine = g.dbm.get_engine("email") self.metadata = make_metadata(engine) self.queue_table = mail_queue(self.metadata) indices = [index_str(self.queue_table, "date", "date"), index_str(self.queue_table, "kind", "kind")] create_table(self.queue_table, indices) self.opt_table = opt_out(self.metadata) indices = [index_str(self.opt_table, "email", "email")] create_table(self.opt_table, indices) self.track_table = sent_mail_table(self.metadata) self.reject_table = sent_mail_table(self.metadata, name="reject_mail") def sent_indices(tab): indices = [ index_str(tab, "to_addr", "to_addr"), index_str(tab, "date", "date"), index_str(tab, "ip", "ip"), index_str(tab, "kind", "kind"), index_str(tab, "fullname", "fullname"), index_str(tab, "account_id", "account_id"), index_str(tab, "msg_hash", "msg_hash"), ] create_table(self.track_table, sent_indices(self.track_table)) create_table(self.reject_table, sent_indices(self.reject_table))
def __init__(self, force=False): engine = g.dbm.get_engine('email') self.metadata = make_metadata(engine) self.queue_table = mail_queue(self.metadata) indices = [ index_str(self.queue_table, "date", "date"), index_str(self.queue_table, 'kind', 'kind') ] create_table(self.queue_table, indices) self.opt_table = opt_out(self.metadata) indices = [index_str(self.opt_table, 'email', 'email')] create_table(self.opt_table, indices) self.track_table = sent_mail_table(self.metadata) self.reject_table = sent_mail_table(self.metadata, name="reject_mail") def sent_indices(tab): indices = [ index_str(tab, 'to_addr', 'to_addr'), index_str(tab, 'date', 'date'), index_str(tab, 'ip', 'ip'), index_str(tab, 'kind', 'kind'), index_str(tab, 'fullname', 'fullname'), index_str(tab, 'account_id', 'account_id'), index_str(tab, 'msg_hash', 'msg_hash'), ] create_table(self.track_table, sent_indices(self.track_table)) create_table(self.reject_table, sent_indices(self.reject_table))
# status can be: invalid, unclaimed, claimed sa.Column('status', sa.String, nullable = False), sa.Column('date', sa.DateTime(timezone=True), nullable=False), sa.Column('payer_email', sa.String, nullable = False), sa.Column('paying_id', sa.String, nullable = False), sa.Column('pennies', sa.Integer, nullable = False), sa.Column('secret', sa.String, nullable = True), sa.Column('account_id', sa.String, nullable = True)) indices = [index_str(gold_table, 'status', 'status'), index_str(gold_table, 'date', 'date'), index_str(gold_table, 'account_id', 'account_id'), index_str(gold_table, 'secret', 'secret', unique = True), index_str(gold_table, 'payer_email', 'payer_email')] create_table(gold_table, indices) def create_unclaimed_gold (trans_id, payer_email, paying_id, pennies, secret, date): gold_table.insert().execute(trans_id=trans_id, status="unclaimed", payer_email=payer_email, paying_id=paying_id, pennies=pennies, secret=secret, date=date) # caller is expected to engoldenate user def create_claimed_gold (trans_id, payer_email, paying_id, pennies, account, date): gold_table.insert().execute(trans_id=trans_id,
sa.Column('pennies', sa.Integer, nullable=False), sa.Column('secret', sa.String, nullable=True), sa.Column('account_id', sa.String, nullable=True), sa.Column('days', sa.Integer, nullable=True), sa.Column('subscr_id', sa.String, nullable=True), sa.Column('gilding_type', sa.String, nullable=True)) indices = [ index_str(gold_table, 'status', 'status'), index_str(gold_table, 'date', 'date'), index_str(gold_table, 'account_id', 'account_id'), index_str(gold_table, 'secret', 'secret'), index_str(gold_table, 'payer_email', 'payer_email'), index_str(gold_table, 'subscr_id', 'subscr_id') ] create_table(gold_table, indices) class GoldRevenueGoalByDate(object): __metaclass__ = tdb_cassandra.ThingMeta _use_db = True _cf_name = "GoldRevenueGoalByDate" _read_consistency_level = tdb_cassandra.CL.ONE _write_consistency_level = tdb_cassandra.CL.ALL _extra_schema_creation_args = { "column_name_class": UTF8_TYPE, "default_validation_class": INT_TYPE, } _compare_with = UTF8_TYPE _type_prefix = None