def execute(self, context):
if self.cmd == sym.LIST:
print('database relations:')
for table in context.db.list():
attrs = ['{}:{}'.format(attr, type.value)\
for attr, type in context.db.describe(table)]
print(' {}({})'.format(table, ', '.join(attrs)))
if len(context.views.list()) > 0:
print('views defined:')
for view in context.views.list():
raw_def = context.views.raw_def(view)
ast = RelExpr.from_view_def(raw_def)
logging.disable(logging.WARNING)
ast.validate(context)
logging.disable(logging.NOTSET)
print(' {}({}) {} {}'.format(view,
', '.join(ast.type.str_attr_names_and_types()),
literal(sym.GETS), raw_def))
elif self.cmd == sym.QUIT:
sys.exit(0)
评论列表
文章目录