Exemplo n.º 1
0
    def setUp(self):
        self.oname = 'testcase1'

        #create dataobject
        self.obj = DataObject(
            oname=self.oname,
            oname_cn='testcase No.1',
            table_split_idx=8,
            table_create_sql="create table testcase1(\
                    timeline char(12) comment '时间',\
                    shopname varchar(32) comment '店铺名称',\
                    shoptype varchar(32) comment '店铺分类',\
                    region varchar(32) comment '区域',\
                    channel varchar(32) comment '渠道',\
                    income varchar(32) comment '收入',\
                    cost varchar(32) comment '成本',\
                    fee varchar(32) comment '费用',\
                    primary key(timeline, shoptype, region, channel))",
            allowips='',
        )
        self.obj.save()

        #auto add tablefields
        auto_add_tablefields(self.obj)

        #create mysqlservices
        self.m1 = MySQLService(
            mname='testmysql1',
            writer='jdata/[email protected]/jdata1',
            reader='jdata/[email protected]/jdata1',
        )
        self.m1.save()
        self.m2 = MySQLService(
            mname='testmysql2',
            writer='jdata/[email protected]/jdata2',
            reader='jdata/[email protected]/jdata2',
        )
        self.m2.save()
        self.m3 = MySQLService(
            mname='testmysql3',
            writer='jdata/[email protected]/jdata3',
            reader='jdata/[email protected]/jdata3',
        )
        self.m3.save()

        self.c = Client()
Exemplo n.º 2
0
def add_tablelocation(objectname, mysqlservice_id, tablename):
    tl = TableLocation(dataobject=DataObject(objectname),
                       mysqlservice=MySQLService(mysqlservice_id),
                       tname=tablename)
    tl.save()