本文整理汇总了Python中DataModel.dump_database_as_csv_file方法的典型用法代码示例。如果您正苦于以下问题:Python DataModel.dump_database_as_csv_file方法的具体用法?Python DataModel.dump_database_as_csv_file怎么用?Python DataModel.dump_database_as_csv_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataModel
的用法示例。
在下文中一共展示了DataModel.dump_database_as_csv_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_file
# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import dump_database_as_csv_file [as 别名]
# add the file to the set of processed files so that we don't process it again. Do it outside the
# try/except block so that we don't try to process a bogus file over and over again.
DataModel.addProcessedFile(session, data_filename)
some_files_processed = True
else:
global_config['logger'].debug( '%s - Skipping file: %s, already processed' % (process_files.__name__,data_filename))
# Commit all updates to the database
session.commit()
if some_files_processed == True:
log_msg = 'files processed, elapsed time - %s' % (str(datetime.datetime.now()-start_time))
print log_msg
global_config['logger'].debug( '%s - %s' % (process_files.__name__,log_msg))
DataModel.dump_database_as_csv_file(session, global_config, attr_definitions)
log_msg = 'database dumped, elapsed time - %s' % (str(datetime.datetime.now()-start_time))
print log_msg
global_config['logger'].debug( '%s - %s' % (process_files.__name__,log_msg))
session.remove()
def process_file(global_config, session, attr_definitions, data_filename):
print 'processing %s'%data_filename
# Initialize the file_attributes dictionary in preparation for the
# parsing of the data file
file_attributes = {}
# Parse the data file, storing all the information in the file_attributes