本文整理汇总了Python中writer.Writer.make_controller_file方法的典型用法代码示例。如果您正苦于以下问题:Python Writer.make_controller_file方法的具体用法?Python Writer.make_controller_file怎么用?Python Writer.make_controller_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类writer.Writer
的用法示例。
在下文中一共展示了Writer.make_controller_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Controller
# 需要导入模块: from writer import Writer [as 别名]
# 或者: from writer.Writer import make_controller_file [as 别名]
writer.make_base_dir()
writer.make_controller_dir()
writer.make_model_dir()
controller = Controller(selected_db_name)
model = Model(selected_db_name)
user_db_cursor.execute(user_db_query.format(selected_db_name))
start_time = datetime.datetime.now()
counter_tables = 1
for row in user_db_cursor.fetchall():
#setting up all table variables
table_name = row[0]
table_engine = row[1]
table_collation = row[2]
table_comment = row[3]
#creating new files
controller_file = writer.make_controller_file(table_name)
model_file = writer.make_model_file(table_name)
field_query = "SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE, COLUMN_KEY, COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '{0}' AND TABLE_NAME = '{1}'"
user_tb_cursor.execute(field_query.format(selected_db_name, table_name))
field_in_table = user_tb_cursor.fetchall()
#make new controller
controller.new(
controller_file,
writer.pascal_casing(table_name),
table_comment,
field_in_table)
#make new model
model.new(model_file,
writer.pascal_casing(table_name),
table_comment,
table_engine,