本文整理汇总了Python中pyflag.DB.check_column_in_table方法的典型用法代码示例。如果您正苦于以下问题:Python DB.check_column_in_table方法的具体用法?Python DB.check_column_in_table怎么用?Python DB.check_column_in_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyflag.DB
的用法示例。
在下文中一共展示了DB.check_column_in_table方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: startup
# 需要导入模块: from pyflag import DB [as 别名]
# 或者: from pyflag.DB import check_column_in_table [as 别名]
def startup(self):
print "Checking schema for compliance"
## Make sure that the schema conforms
dbh = DB.DBO()
dbh.execute("select value from meta where property='flag_db'")
DB.check_column_in_table(None, 'sql_cache', 'status',
'enum("progress","dirty","cached")')
for row in dbh:
try:
DB.check_column_in_table(row['value'], 'sql_cache', 'status',
'enum("progress","dirty","cached")')
except: continue
## Check the schema:
dbh.check_index("jobs", "state")
DB.check_column_in_table(None, 'jobs', 'priority', 'int default 10')
DB.check_column_in_table(None, 'jobs', 'pid', 'int default 0')
DB.check_column_in_table(None, 'jobs', 'when_valid',
'TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL')
## Check for the high_priority_jobs table (its basically
## another jobs table for high priority jobs - so workers
## first check this table before the main jobs table).
try:
dbh.execute("select * from high_priority_jobs limit 1")
except:
dbh.execute("create table if not exists high_priority_jobs like jobs")
## Schedule the first periodic task:
task = Periodic()
task.run()