本文整理汇总了Python中table.Table.validate方法的典型用法代码示例。如果您正苦于以下问题:Python Table.validate方法的具体用法?Python Table.validate怎么用?Python Table.validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table.Table
的用法示例。
在下文中一共展示了Table.validate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gen_for_table
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import validate [as 别名]
def gen_for_table(self,tbl):
"""Generates sql files for creating history tables and stored procedures.
Calls functions for generating stored functions which differ for some cases. (embed tables, refuid columns)
Stored functions means function for add object, set attribute, get attribute, get object data, get list of instances and functions for diffing of versions.
For templated tables are generated stored functions to get resolved data or resolved data with its origin.
"""
# select col info
columns = self.plpy.execute(self.column_str % tbl)
att_types = self.plpy.execute(self.att_type_str % tbl)
self.atts[tbl] = dict(att_types)
self.refs[tbl] = list()
# create table obj
table = Table(tbl)
# add columns
for col in columns[:]:
table.add_column(col[0],col[1])
# add pk constraints
constraints = self.plpy.execute(self.pk_str % tbl)
for col in constraints[:]:
table.add_pk(col[0],col[1])
record = self.plpy.execute(self.refers_to_set_info_str % {'tbl': tbl})
table.refers_to_set = list()
if len(record) > 0:
for row in record:
table.refers_to_set.append(row[0])
self.refers_to_set[tbl] = table.refers_to_set
# add fk constraints
fkconstraints = self.plpy.execute(self.fk_str % tbl)
for col in fkconstraints[:]:
table.add_fk(col[0],col[1],col[2],col[3])
relName = col[0]
while relName in self.relFromTbl:
#check if relation if this name exists
#and add suffix to it
relName = relName + "_XXX"
self.relFromTbl[relName] = tbl
self.relFromCol[relName] = col[1]
self.relToTbl[relName] = col[2]
# if there is a reference, change int for identifier'
if col[1] not in table.refers_to_set:
self.atts[tbl][col[1]] = 'identifier'
prefix = col[0][0:7]
prefixForSet = col[0][0:5]
if prefix == "rembed_":
self.embed[tbl] = col[1]
self.embedNames[relName] = tbl
elif prefix == "rconta_":
self.composition[tbl] = col[1]
self.containsNames[relName] = tbl
elif prefix == "rcoble_":
self.containableNames[relName] = tbl
elif prefix == "rtempl_":
self.template[tbl] = col[2]
self.templateNames[relName] = tbl
elif prefix == "rrefer_" or prefixForSet == "rset_":
self.refs[tbl].append(col[1])
self.refNames[relName] = tbl
embed_into_rec = self.plpy.execute(self.embed_into_str % tbl)
table.embed_column = ""
for row in embed_into_rec:
table.embed_column = row[0]
refuid_rec = self.plpy.execute(self.refuid_columns_str % tbl)
table.refuid_columns = dict()
for row in refuid_rec:
table.refuid_columns[row[0]] = row[1]
record = self.plpy.execute(self.composition_str % tbl)
table.contains = list()
for row in record:
table.contains.append(row[0])
if tbl in self.templates:
templated_table = self.templates[tbl]
refuid_rec = self.plpy.execute(self.refuid_columns_str % templated_table)
for row in refuid_rec:
if row[0] not in table.refuid_columns:
table.refuid_columns[row[0]] = row[1]
table.validate();
# generate sql
self.table_sql.write(table.gen_hist())
self.fks = self.fks + (table.gen_fks())
#get dictionary of colname and reftable, which uid colname references
#cols_ref_uid = table.get_cols_reference_uid()
for col in columns[:]:
if (col[0] in table.refuid_columns):
reftable = table.refuid_columns[col[0]]
if col[0] in table.refers_to_set:
self.fn_sql.write(table.gen_set_refuid_set(col[0], reftable))
#.........这里部分代码省略.........