def main(q, i, p, params, tags): rootobject = 'businessparams' domain = "datacenter" view_name = '%s_view_%s_list' % (domain, rootobject) connection = OsisDB().getConnection('dcsimulator') if not connection.viewExists(domain, rootobject, view_name): view = connection.viewCreate(domain, rootobject, view_name) view.setCol('name', q.enumerators.OsisType.STRING, True) view.setCol('collocation', q.enumerators.OsisType.INTEGER, True) view.setCol('storage', q.enumerators.OsisType.INTEGER, True) view.setCol('cpu', q.enumerators.OsisType.INTEGER, True) view.setCol('leasebuilding', q.enumerators.OsisType.INTEGER, True) view.setCol('leaseinfrastructure', q.enumerators.OsisType.INTEGER, True) view.setCol('leasehw', q.enumerators.OsisType.INTEGER, True) view.setCol('interestbuilding', q.enumerators.OsisType.FLOAT, True) view.setCol('interestdatacenter', q.enumerators.OsisType.FLOAT, True) view.setCol('leaseperiodbuilding', q.enumerators.OsisType.INTEGER, True) view.setCol('leaseperioddatacenter', q.enumerators.OsisType.INTEGER, True) view.setCol('technology', q.enumerators.OsisType.INTEGER, True) view.setCol('installperiod', q.enumerators.OsisType.INTEGER, True) view.setCol('size', q.enumerators.OsisType.INTEGER, False) view.setCol('racksurface', q.enumerators.OsisType.INTEGER, False) view.setCol('kwhourcost', q.enumerators.OsisType.FLOAT, False) view.setCol('pue', q.enumerators.OsisType.FLOAT, False) view.setCol('salescollocation', q.enumerators.OsisType.FLOAT, False) view.setCol('salescpu', q.enumerators.OsisType.FLOAT, False) view.setCol('salesstorage', q.enumerators.OsisType.FLOAT, False) view.setCol('salesbandwidth', q.enumerators.OsisType.FLOAT, False) connection.viewAdd(view) indexes = ['collocation', 'size', 'leasebuilding', 'interestdatacenter'] for field in indexes: context = {'schema': "%s_%s" % (domain, rootobject), 'view': view_name, 'field': field} connection.runQuery("CREATE INDEX %(field)s_%(schema)s_%(view)s ON %(schema)s.%(view)s (%(field)s)" % context)
def main(q, i, p, params, tags): rootobject = 'activity' domain = "crm" view_name = '%s_view_%s_list' % (domain, rootobject) connection = OsisDB().getConnection('sampleapp') if not connection.viewExists(domain, rootobject, view_name): view = connection.viewCreate(domain, rootobject, view_name) view.setCol('name', q.enumerators.OsisType.STRING, False) view.setCol('description', q.enumerators.OsisType.STRING, False) view.setCol('customer', q.enumerators.OsisType.STRING, True) view.setCol('lead', q.enumerators.OsisType.STRING, True) view.setCol('location', q.enumerators.OsisType.STRING, True) view.setCol('type', q.enumerators.OsisType.STRING, True) view.setCol('priority', q.enumerators.OsisType.STRING, True) view.setCol('status', q.enumerators.OsisType.STRING, True) view.setCol('starttime', q.enumerators.OsisType.DATETIME, True) view.setCol('endtime', q.enumerators.OsisType.DATETIME, True) connection.viewAdd(view) indexes = ['name', 'customer', 'type', 'priority'] for field in indexes: context = { 'schema': "%s_%s" % (domain, rootobject), 'view': view_name, 'field': field } connection.runQuery( "CREATE INDEX %(field)s_%(schema)s_%(view)s ON %(schema)s.%(view)s (%(field)s)" % context)
def main(q, i, params, tags): rootobject = 'customer' domain = "crm" appname = params['appname'] view_name = '%s_view_%s_list' % (domain, rootobject) connection = OsisDB().getConnection(appname) if not connection.viewExists(domain, rootobject, view_name): view = connection.viewCreate(domain, rootobject, view_name) view.setCol('name', q.enumerators.OsisType.STRING, True) connection.viewAdd(view) indexes = ['name'] for field in indexes: context = {'schema': "%s_%s" % (domain, rootobject), 'view': view_name, 'field': field} connection.runQuery("CREATE INDEX %(field)s_%(schema)s_%(view)s ON %(schema)s.%(view)s (%(field)s)" % context)
def main(q, i, params, tags): rootobject = 'eventqueue' domain = "monitoring" appname = params['appname'] view_name = '%s_view_%s_list' % (domain, rootobject) connection = OsisDB().getConnection(appname) if not connection.viewExists(domain, rootobject, view_name): view = connection.viewCreate(domain, rootobject, view_name) view.setCol('name', q.enumerators.OsisType.STRING, True) view.setCol('numberofevents', q.enumerators.OsisType.INTEGER, True) connection.viewAdd(view) indexes = ['name', 'numberofevents'] for field in indexes: context = {'schema': "%s_%s" % (domain, rootobject), 'view': view_name, 'field': field} connection.runQuery("CREATE INDEX %(field)s_%(schema)s_%(view)s ON %(schema)s.%(view)s (%(field)s)" % context)
def main(q, i, params, tags): rootobject = 'permission' domain = "crm" appname = params['appname'] view_name = '%s_view_%s_list' % (domain, rootobject) connection = OsisDB().getConnection(appname) if not connection.viewExists(domain, rootobject, view_name): view = connection.viewCreate(domain, rootobject, view_name) view.setCol('name', q.enumerators.OsisType.STRING, True) view.setCol('uri', q.enumerators.OsisType.STRING, True) connection.viewAdd(view) indexes =list() indexes.append('name') indexes.append('uri') for field in indexes: context = {'schema': "%s_%s" % (domain, rootobject), 'view': view_name, 'field': field} connection.runQuery("CREATE INDEX %(field)s_%(schema)s_%(view)s ON %(schema)s.%(view)s (%(field)s)" % context)
def main(q, i, params, tags): rootobject = 'lead' domain = "crm" appname = params['appname'] view_name = '%s_view_%s_list' % (domain, rootobject) connection = OsisDB().getConnection(appname) if not connection.viewExists(domain, rootobject, view_name): view = connection.viewCreate(domain, rootobject, view_name) view.setCol('name', q.enumerators.OsisType.STRING, True) view.setCol('code', q.enumerators.OsisType.STRING, True) view.setCol('customerguid', q.enumerators.OsisType.UUID, True) view.setCol('source', q.enumerators.OsisType.STRING, True) view.setCol('type', q.enumerators.OsisType.STRING, True) view.setCol('status', q.enumerators.OsisType.STRING, True) view.setCol('amount', q.enumerators.OsisType.FLOAT, True) view.setCol('probability', q.enumerators.OsisType.BIGINT, True) connection.viewAdd(view) indexes = ['name', 'code', 'source', 'type', 'status', 'amount', 'probability'] for field in indexes: context = {'schema': "%s_%s" % (domain, rootobject), 'view': view_name, 'field': field} connection.runQuery("CREATE INDEX %(field)s_%(schema)s_%(view)s ON %(schema)s.%(view)s (%(field)s)" % context)
def main(q, i, p, params, tags): rootobject = 'activity' domain = "crm" view_name = '%s_view_%s_list' % (domain, rootobject) connection = OsisDB().getConnection('sampleapp') if not connection.viewExists(domain, rootobject, view_name): view = connection.viewCreate(domain, rootobject, view_name) view.setCol('name', q.enumerators.OsisType.STRING, False) view.setCol('description', q.enumerators.OsisType.STRING, False) view.setCol('customer', q.enumerators.OsisType.STRING, True) view.setCol('lead', q.enumerators.OsisType.STRING, True) view.setCol('location', q.enumerators.OsisType.STRING, True) view.setCol('type', q.enumerators.OsisType.STRING, True) view.setCol('priority', q.enumerators.OsisType.STRING, True) view.setCol('status', q.enumerators.OsisType.STRING, True) view.setCol('starttime', q.enumerators.OsisType.DATETIME, True) view.setCol('endtime', q.enumerators.OsisType.DATETIME, True) connection.viewAdd(view) indexes = ['name', 'customer', 'type', 'priority'] for field in indexes: context = {'schema': "%s_%s" % (domain, rootobject), 'view': view_name, 'field': field} connection.runQuery("CREATE INDEX %(field)s_%(schema)s_%(view)s ON %(schema)s.%(view)s (%(field)s)" % context)
def main(q, i, params, tags): con = OsisDB().getConnection('main') params['result'] = con.runQuery(params['query'])
def main(q, i, params, tags): con = OsisDB().getConnection('main') params['result'] = con.runQuery(params['query'])