当前位置: 首页>>代码示例>>Python>>正文


Python Writer.make_model_dir方法代码示例

本文整理汇总了Python中writer.Writer.make_model_dir方法的典型用法代码示例。如果您正苦于以下问题:Python Writer.make_model_dir方法的具体用法?Python Writer.make_model_dir怎么用?Python Writer.make_model_dir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在writer.Writer的用法示例。


在下文中一共展示了Writer.make_model_dir方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: input

# 需要导入模块: from writer import Writer [as 别名]
# 或者: from writer.Writer import make_model_dir [as 别名]
selected_db = input("Please, select the number of the db that you want to process: ")
print("================================================================================")
selected_db_name = database_list[selected_db][0]  #user selected database name
print("Selected database: {0}".format(selected_db_name))
user_db_access = Connect(host, username, password, selected_db_name)
user_db_connect = user_db_access.mysql()
#cursors
user_db_cursor = user_db_connect.cursor()
user_tb_cursor = user_db_connect.cursor()
#find all tables in the selected schema
user_db_query = "select TABLE_NAME, engine, TABLE_COLLATION, TABLE_COMMENT from information_schema.tables where table_schema='{0}'"
#make folder structure
writer = Writer(selected_db_name)
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}'"
开发者ID:nekskm,项目名称:ci3_generator,代码行数:33,代码来源:main.py


注:本文中的writer.Writer.make_model_dir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。