def create_table(self):
sql = """
CREATE TABLE """ + self._table_name + """ (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
read_timestamp TIMESTAMP NOT NULL DEFAULT "0000-00-00 00:00:00",
write_timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
ost CHAR(7) NOT NULL,
ip CHAR(15) NOT NULL,
size BIGINT(20) UNSIGNED NOT NULL,
read_throughput BIGINT(20) SIGNED NOT NULL,
write_throughput BIGINT(20) SIGNED NOT NULL,
read_duration INT(10) SIGNED NOT NULL,
write_duration INT(10) SIGNED NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
"""
logging.debug("Creating database table:\n" + sql)
with closing(MySQLdb.connect(host=self._host, user=self._user, passwd=self._passwd, db=self._db)) as conn:
with closing(conn.cursor()) as cur:
cur.execute(sql)
ost_perf_history_table_handler.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录