本文整理汇总了Python中WMCore.Database.DBCreator.DBCreator类的典型用法代码示例。如果您正苦于以下问题:Python DBCreator类的具体用法?Python DBCreator怎么用?Python DBCreator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DBCreator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, logger = None, dbi = None, params = None):
myThread = threading.currentThread()
DBCreator.__init__(self, myThread.logger, myThread.dbi)
self.create = {}
self.constraints = {}
self.create['a_transaction'] = """
SET AUTOCOMMIT = 0; """
self.create['threadpool'] = """
CREATE TABLE tp_threadpool(
id int(11) NOT NULL auto_increment,
event varchar(255) NOT NULL,
component varchar(255) NOT NULL,
payload text NOT NULL,
thread_pool_id varchar(255) NOT NULL,
state enum('queued','process') default 'queued',
primary key(id)
) ENGINE=InnoDB;
"""
self.create['threadpool_buffer_in'] = """
CREATE TABLE tp_threadpool_buffer_in(
id int(11) NOT NULL auto_increment,
event varchar(255) NOT NULL,
component varchar(255) NOT NULL,
payload text NOT NULL,
thread_pool_id varchar(255) NOT NULL,
state enum('queued','process') default 'queued',
primary key(id)
) ENGINE=InnoDB;
"""
self.create['threadpool_buffer_out'] = """
示例2: __init__
def __init__(self, logger = None, dbi = None, params = None):
myThread = threading.currentThread()
DBCreator.__init__(self, myThread.logger, myThread.dbi)
self.create = {}
self.constraints = {}
tablespaceTable = ""
tablespaceIndex = ""
if params:
if params.has_key("tablespace_table"):
tablespaceTable = "TABLESPACE %s" % params["tablespace_table"]
if params.has_key("tablespace_index"):
tablespaceIndex = "USING INDEX TABLESPACE %s" % params["tablespace_index"]
self.create["rc_threshold"] = """
CREATE TABLE rc_threshold(
site_id INTEGER NOT NULL,
sub_type_id INTEGER NOT NULL,
max_slots INTEGER NOT NULL,
priority INTEGER DEFAULT 1) %s""" % tablespaceTable
self.constraints["rc_threshold_fk1"] = \
"""ALTER TABLE rc_threshold ADD
(CONSTRAINT rc_threshold_fk1 FOREIGN KEY (site_id) REFERENCES wmbs_location(id) ON DELETE CASCADE)"""
self.constraints["rc_threshold_fk2"] = \
"""ALTER TABLE rc_threshold ADD
示例3: __init__
def __init__(self, logger = None, dbi = None):
"""
_init_
Call the base class's constructor and add all necessary tables for
deletion,
"""
myThread = threading.currentThread()
if logger == None:
logger = myThread.logger
if dbi == None:
dbi = myThread.dbi
DBCreator.__init__(self, logger, dbi)
orderedTables = Create.requiredTables[:]
orderedTables.reverse()
i = 0
for tableName in orderedTables:
i += 1
prefix = string.zfill(i, 2)
if tableName.endswith("_seq"):
self.create[prefix + tableName] = "DROP SEQUENCE %s" % tableName
elif tableName.endswith("_trg"):
self.create[prefix + tableName] = "DROP TRIGGER %s" % tableName
else:
self.create[prefix + tableName] = "DROP TABLE %s" % tableName
示例4: __init__
def __init__(self, logger = None, dbi = None):
"""
_init_
Call the DBCreator constructor and create the list of required tables.
"""
myThread = threading.currentThread()
if logger == None:
logger = myThread.logger
if dbi == None:
dbi = myThread.dbi
DBCreator.__init__(self, logger, dbi)
self.delete['01bl_runjob'] = "DROP TABLE bl_runjob"
self.delete['02bl_status'] = "DROP TABLE bl_status"
j = 50
for i in Create.sequence_tables:
seqname = '%s_SEQ' % i
self.create["%s%s" % (j, seqname)] = \
"DROP SEQUENCE %s" % seqname
return
示例5: execute
def execute(self, conn = None, transaction = None):
"""
_execute_
"""
DBCreator.execute(self, conn, transaction)
return True
示例6: __init__
def __init__(self, logger = None, dbi = None, params = None):
"""
_init_
Call the DBCreator constructor and create the list of required tables.
"""
myThread = threading.currentThread()
if logger == None:
logger = myThread.logger
if dbi == None:
dbi = myThread.dbi
DBCreator.__init__(self, logger, dbi)
self.requiredTables = ["01bl_status", "02bl_runjob"]
self.create['01bl_status'] = \
"""CREATE TABLE bl_status
(
id INT auto_increment,
name VARCHAR(255),
PRIMARY KEY (id),
UNIQUE (name)
)
ENGINE = InnoDB DEFAULT CHARSET=latin1;
"""
self.create['02bl_runjob'] = \
"""CREATE TABLE bl_runjob
(
id INT auto_increment,
wmbs_id INT,
grid_id VARCHAR(255),
bulk_id VARCHAR(255),
status CHAR(1) DEFAULT '1',
sched_status INT,
retry_count INT,
status_time INT,
location INT,
user_id INT,
PRIMARY KEY (id),
FOREIGN KEY (wmbs_id) REFERENCES wmbs_job(id) ON DELETE CASCADE,
FOREIGN KEY (sched_status) REFERENCES bl_status(id),
FOREIGN KEY (user_id) REFERENCES wmbs_users(id) ON DELETE CASCADE,
FOREIGN KEY (location) REFERENCES wmbs_location(id) ON DELETE CASCADE,
UNIQUE (retry_count, wmbs_id)
)
ENGINE = InnoDB DEFAULT CHARSET=latin1;
"""
return
示例7: __init__
def __init__(self):
"""
_init_
Call the base class's constructor and create all necessary tables,
constraints and inserts.
"""
myThread = threading.currentThread()
DBCreator.__init__(self, myThread.logger, myThread.dbi)
self.delete["02managed_feeders"] = "DROP TABLE managed_feeders"
self.delete["01managed_filesets"] = "DROP TABLE managed_filesets"
示例8: __init__
def __init__(self):
"""
_init_
Call the base class's constructor and create all necessary tables,
constraints and inserts.
"""
myThread = threading.currentThread()
DBCreator.__init__(self, myThread.logger, myThread.dbi)
self.delete["02wm_managed_workflow_location"] = \
"DROP TABLE wm_managed_workflow_location"
self.delete["01wm_managed_workflow"] = "DROP TABLE wm_managed_workflow"
示例9: __init__
def __init__(self):
myThread = threading.currentThread()
DBCreator.__init__(self, myThread.logger, myThread.dbi)
self.create = {}
self.constraints = {}
self.create['threadpool'] = """
CREATE TABLE tp_threadpool(
id integer PRIMARY KEY AUTOINCREMENT,
event varchar(255) NOT NULL,
component varchar(255) NOT NULL,
payload text NOT NULL,
thread_pool_id varchar(255) NOT NULL,
state varchard(20) NOT NULL default 'queued',
FOREIGN KEY(state) references tp_queued_process_enum(value)
)
"""
self.create['threadpool_buffer_in'] = """
CREATE TABLE tp_threadpool_buffer_in(
id integer PRIMARY KEY AUTOINCREMENT,
event varchar(255) NOT NULL,
component varchar(255) NOT NULL,
payload text NOT NULL,
thread_pool_id varchar(255) NOT NULL,
state varchard(20) NOT NULL default 'queued',
FOREIGN KEY(state) references tp_queued_process_enum(value)
)
"""
self.create['threadpool_buffer_out'] = """
CREATE TABLE tp_threadpool_buffer_out(
id integer PRIMARY KEY AUTOINCREMENT,
event varchar(255) NOT NULL,
component varchar(255) NOT NULL,
payload text NOT NULL,
thread_pool_id varchar(255) NOT NULL,
state varchard(20) NOT NULL default 'queued',
FOREIGN KEY(state) references tp_queued_process_enum(value)
)
"""
self.create['tp_queued_process_enum'] = """
CREATE TABLE tp_queued_process_enum (
value varchar(20) PRIMARY KEY NOT NULL
)"""
self.create['tp_queued_process_enum_insert1'] = """
INSERT INTO tp_queued_process_enum VALUES('queued')
"""
self.create['tp_queued_process_enum_insert2'] = """
示例10: execute
def execute(self, conn=None, transaction=None):
"""
_execute_
Check to make sure that all required tables have been defined. If
everything is in place have the DBCreator make everything.
"""
for requiredTable in self.requiredTables:
if requiredTable not in self.create.keys():
raise WMException("The table '%s' is not defined." % requiredTable, "WMCORE-2")
DBCreator.execute(self, conn, transaction)
return True
示例11: __init__
def __init__(self,logger=None, dbi=None, params = None):
myThread = threading.currentThread()
DBCreator.__init__(self, myThread.logger, myThread.dbi)
self.create = {}
self.constraints = {}
self.create['taa'] = """
SET AUTOCOMMIT = 0; """
self.create['ta_managed_feeders'] = """
CREATE TABLE `managed_feeders` (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
feeder_type VARCHAR(256) NOT NULL,
feeder_state VARCHAR(256) NOT NULL,
insert_time INT(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
"""
self.create['ta_managed_filesets'] = """
示例12: __init__
def __init__(self, logger = None, dbi = None, params = None):
"""
_init_
Call the DBCreator constructor and create the list of required tables.
"""
myThread = threading.currentThread()
if logger == None:
logger = myThread.logger
if dbi == None:
dbi = myThread.dbi
tablespaceTable = ""
tablespaceIndex = ""
if params:
if "tablespace_table" in params:
tablespaceTable = "TABLESPACE %s" % params["tablespace_table"]
if "tablespace_index" in params:
tablespaceIndex = "USING INDEX TABLESPACE %s" % params["tablespace_index"]
DBCreator.__init__(self, logger, dbi)
self.create["01wm_components"] = \
"""CREATE TABLE wm_components (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
pid INTEGER NOT NULL,
update_threshold INTEGER NOT NULL,
UNIQUE (name))"""
self.create["02wm_workers"] = \
"""CREATE TABLE wm_workers (
component_id INTEGER NOT NULL,
name VARCHAR(255) NOT NULL,
last_updated INTEGER NOT NULL,
state VARCHAR(255),
pid INTEGER,
poll_interval INTEGER NOT NULL,
last_error INTEGER,
cycle_time DECIMAL(9,4) DEFAULT 0 NOT NULL,
outcome VARCHAR(1000),
error_message VARCHAR(1000),
UNIQUE (component_id, name))"""
self.constraints["FK_wm_component_worker"] = \
"""ALTER TABLE wm_workers ADD CONSTRAINT FK_wm_component_worker
示例13: __init__
def __init__(self, logger = None, dbi = None, params = None):
"""
__init__
"""
myThread = threading.currentThread()
if logger == None:
logger = myThread.logger
if dbi == None:
dbi = myThread.dbi
DBCreator.__init__(self, logger, dbi)
self.delete["01test_tablea"] = "DROP TABLE test_tablea"
self.delete["02test_tableb"] = "DROP TABLE test_tableb"
self.delete["03test_tablec"] = "DROP TABLE test_tablec"
self.delete["04test_bigcol"] = "DROP TABLE test_bigcol"
return
示例14: __init__
def __init__(self, logger=None, dbi=None, param=None):
if dbi == None:
myThread = threading.currentThread()
dbi = myThread.dbi
logger = myThread.logger
DBCreator.__init__(self, logger, dbi)
self.create = {}
self.constraints = {}
# //
# // Define create statements for each table
# //
# //
# tm_id - unique ID which is also the primary key (len 60 chars)
# tm_user - username (len 30 chars is ENOUGH)
# tm_workflow - taskName (len 255 chars)
# tm_group - group which is used inside cert
# tm_role - role which is used inside cert
self.create['b_transfers'] = """
示例15: __init__
def __init__(self, logger = None, dbi = None):
"""
_init_
Call the DBCreator constructor and create the list of required tables.
"""
myThread = threading.currentThread()
if logger == None:
logger = myThread.logger
if dbi == None:
dbi = myThread.dbi
DBCreator.__init__(self, logger, dbi)
self.create = {}
self.delete = {}
self.delete["rc_threshold"] = "DROP TABLE rc_threshold"
return