Ejemplo n.º 1
0
def temperarily_save_a_local_json(raw_object_to_save,json_filename):
	'''
	临时存入一个文件
	'''
	
	target_object_to_save=nested_dict_apply(raw_object_to_save)#过滤其中的set

	try:
		with open(json_filename,'w')as file_struct:
			json_serialised=json.dumps(target_object_to_save)
			file_struct.write(json_serialised)
			file_struct.close()
			pass

	except Exception,current_exception:
		print'%s文件写入失败,错误信息%s'%(json_filename, current_exception.__repr__())
Ejemplo n.º 2
0
	def scan_all_tables(self):
		
		
		
		all_tables=self.mssql_cur.tables()
		
		table_list=[]
		
		for rows in all_tables:
			if rows.table_type=='TABLE':
				table_list.append(rows.table_name)
			else:
				#print rows
				pass
			pass
		all_tables_result=nested_dict_apply(target_data_for_json=table_list, operation_function=to_string_if_unicode)
		return all_tables_result
Ejemplo n.º 3
0
	def list_all_tables(self):
		inspector=inspect(self.engine)
		table_names=nested_dict_apply(inspector.get_table_names(),to_string_if_unicode)
		return table_names
Ejemplo n.º 4
0
		print '写入pickle文件失败,信息',error_msg
		pass
	pass

def temperarily_load_a_local_json(json_filename,as_set=False):
	loaded_content=None
	try:
		with open(json_filename,'r')as file_struct:
			loaded_content=json.loads(file_struct.read())
			pass

	except Exception,current_error:
		print'%s文件读取失败,错误信息%s'%(json_filename,current_error.__repr__())
		pass
	
	return nested_dict_apply(loaded_content,to_string_if_unicode,set_or_list=as_set)

def temperarily_save_a_local_json(raw_object_to_save,json_filename):
	'''
	临时存入一个文件
	'''
	
	target_object_to_save=nested_dict_apply(raw_object_to_save)#过滤其中的set

	try:
		with open(json_filename,'w')as file_struct:
			json_serialised=json.dumps(target_object_to_save)
			file_struct.write(json_serialised)
			file_struct.close()
			pass