Asynchronous file import method and device, computer equipment, readable storage medium and program product
Through the asynchronous import method, suitable temporary storage and import modes are screened, and files are asynchronously imported into the database, which solves the problem of low file import efficiency in the existing technology, improves efficiency and accuracy, and enhances system stability.
Patent Information
- Application Number
- CN202410846411.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-10-01
AI Technical Summary
The file import efficiency in the existing technology is low, which makes it time-consuming and labor-intensive for enterprises to manage business file data, making it difficult to quickly import it into a business management system or database.
By responding to file import requests, obtaining file attribute information, screening appropriate temporary storage, and selecting the import mode and priority according to business needs, asynchronously import files to the target database, and separate the upload and import processes to improve efficiency.
It improves the efficiency and accuracy of file import, avoids long-term system operation, and enhances system stability and reliability.
Smart Images

Figure CN118733535A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a method, apparatus, computer device, readable storage medium and program product for asynchronously importing files. Background Art
[0002] With the rapid development of big data, a large amount of business file data will be generated in the business management process of each enterprise. Enterprises need to effectively manage these business file data. In this context, how to quickly import these business file data into the corresponding business management system or business database for the convenience of enterprise management has become a major problem currently faced by various enterprises.
[0003] In the prior art, manual import is usually adopted, that is, the files to be imported are manually uploaded to the database one by one. However, this method is often time-consuming and labor-intensive, which easily leads to low efficiency of file import. Summary of the invention
[0004] Based on this, it is necessary to provide a file asynchronous import method, device, computer equipment, computer-readable storage medium and computer program product that can improve the efficiency of file import in response to the above technical problems.
[0005] In a first aspect, the present application provides a method for asynchronously importing files, comprising: in response to a file import request for a target file, if the target file meets the file import conditions, obtaining file attribute information of the target file; based on the file attribute information, screening out a temporary storage device that matches the file attribute information from each candidate storage device, and sending the target file to the temporary storage device; obtaining the business requirements indicated by the file import request, and based on the business requirements, screening out a target import mode that matches the business requirements from each candidate file import mode; determining the import priority of the target file, and asynchronously importing the target file into a target database through the temporary storage device according to the target import mode and the import priority.
[0006] In one of the embodiments, based on the file attribute information, a temporary storage device that matches the file attribute information is screened out from each candidate storage device, including: respectively obtaining the storage attribute information corresponding to each candidate storage device; respectively matching the file attribute information with each storage attribute information to obtain a target matching degree between the file attribute information and each storage attribute information; and selecting the candidate storage device whose target matching degree reaches a matching degree threshold as a temporary storage device.
[0007] In one of the embodiments, based on business requirements, a target import mode that matches the business requirements is screened out from each candidate file import mode, including: extracting file content information of the target file, performing correlation analysis between the business requirements and the file content information, and obtaining a target correlation between the business requirements and the file content information; based on the target correlation, screening from each candidate file import mode to obtain a target import mode that matches the target correlation.
[0008] In one of the embodiments, a target file is asynchronously imported into a target database through a temporary storage device based on a target import mode and an import priority, including: reading the target file from the temporary storage device based on the import priority; and asynchronously importing the target file into the target database according to the target import mode when there is no historical import record for the target file.
[0009] In one of the embodiments, in response to a file import request for a target file, when the target file meets the file import conditions, file attribute information of the target file is obtained, including: in response to the file import request for the target file, splitting the target file to obtain multiple initial sub-files; performing file preprocessing on each initial sub-file to obtain a target sub-file corresponding to each initial sub-file; when each target sub-file meets the file import conditions, aggregating each target sub-file to obtain an aggregated file, and obtaining file attribute information of the aggregated file.
[0010] In one of the embodiments, the business requirements include the business application time of the target file, and the file attribute information includes the file size of the target file; determining the import priority of the target file includes: analyzing the target time required to import the target file into the target database based on the file size of the target file; and performing a priority analysis on the target file based on the target time and the business application time of the target file to obtain the import priority of the target file.
[0011] In the second aspect, the present application also provides a file asynchronous import device, including: an information acquisition module, used to respond to a file import request for a target file, and obtain the file attribute information of the target file when the target file meets the file import conditions; a storage screening module, used to screen out a temporary storage device that matches the file attribute information from each candidate storage device according to the file attribute information, and send the target file to the temporary storage device; an import pattern matching module, used to obtain the business requirements indicated by the file import request, and based on the business requirements, screen out a target import pattern that matches the business requirements from each candidate file import pattern; an asynchronous import module, used to determine the import priority of the target file, and asynchronously import the target file into the target database through the temporary storage device according to the target import mode and import priority.
[0012] In one of the embodiments, the memory screening module is also used to: respectively obtain the memory attribute information corresponding to each candidate memory; respectively match the file attribute information with each memory attribute information to obtain the target matching degree between the file attribute information and each memory attribute information; and use the candidate memory whose target matching degree reaches the matching degree threshold as a temporary memory.
[0013] In one of the embodiments, the import pattern matching module is also used to: extract file content information of the target file, perform correlation analysis on the business requirements and the file content information, and obtain a target correlation between the business requirements and the file content information; based on the target correlation, screen among the candidate file import patterns to obtain a target import pattern that matches the target correlation.
[0014] In one of the embodiments, the asynchronous import module is further used to: read the target file from the temporary storage based on the import priority; and asynchronously import the target file into the target database according to the target import mode when there is no historical import record for the target file.
[0015] In one of the embodiments, the information acquisition module is also used to: respond to a file import request for a target file, split the target file into multiple initial sub-files; perform file preprocessing on each initial sub-file to obtain a target sub-file corresponding to each initial sub-file; when each target sub-file meets the file import condition, aggregate the target sub-files to obtain an aggregate file, and obtain file attribute information of the aggregate file.
[0016] In one of the embodiments, the asynchronous import module is also used to: analyze the target time required to import the target file into the target database based on the file size of the target file; and perform priority analysis on the target file based on the target time and the business application time of the target file to obtain the import priority of the target file.
[0017] In a third aspect, the present application also provides a computer device, including a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program: in response to a file import request for a target file, obtaining file attribute information of the target file when the target file meets the file import conditions; based on the file attribute information, screening out a temporary storage device that matches the file attribute information from each candidate storage device, and sending the target file to the temporary storage device; obtaining the business requirements indicated by the file import request, and based on the business requirements, screening out a target import mode that matches the business requirements from each candidate file import mode; determining the import priority of the target file, and asynchronously importing the target file into the target database through the temporary storage device according to the target import mode and the import priority.
[0018] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the following steps when the computer program is executed by a processor: in response to a file import request for a target file, obtaining file attribute information of the target file when the target file meets the file import conditions; based on the file attribute information, screening out a temporary storage device that matches the file attribute information from each candidate storage device, and sending the target file to the temporary storage device; obtaining the business requirements indicated by the file import request, and based on the business requirements, screening out a target import mode that matches the business requirements from each candidate file import mode; determining an import priority of the target file, and asynchronously importing the target file into the target database through the temporary storage device according to the target import mode and the import priority.
[0019] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the following steps when executed by a processor: in response to a file import request for a target file, if the target file meets the file import conditions, obtain the file attribute information of the target file; based on the file attribute information, screen out a temporary storage device that matches the file attribute information from each candidate storage device, and send the target file to the temporary storage device; obtain the business requirements indicated by the file import request, and based on the business requirements, screen out a target import mode that matches the business requirements from each candidate file import mode; determine the import priority of the target file, and asynchronously import the target file into the target database through the temporary storage device according to the target import mode and the import priority.
[0020] The above-mentioned asynchronous file import method, device, computer equipment, computer-readable storage medium and computer program product, in response to a file import request for a target file, first obtains the file attribute information of the target file when the target file meets the file import conditions, and selects a temporary storage device that matches the file attribute information from each candidate storage device according to the file attribute information, and sends the target file to the temporary storage device for storage. It can be understood that the temporary storage device is used as an intermediate storage device to store files before import, and can distinguish the two processes of file upload and file import, so that the two processes are independent of each other, thereby effectively improving the efficiency of file import. Then, the business requirements indicated by the file import request are obtained, and according to the business requirements, the target import mode that matches the business requirements is selected from each candidate file import mode, and the appropriate target import model is used to import the target file, which can improve the accuracy and efficiency of file import. Finally, according to the import priority of the target file, the target file is read from the temporary storage, and the target file is asynchronously imported into the target database according to the target import mode. In this way, the current technical defect of low file import efficiency caused by time-consuming and labor-intensive manual import is overcome, and the efficiency and accuracy of file import are effectively improved. In addition, asynchronous import can also avoid long-term operation of the system and improve system stability and reliability. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0022] FIG1 is a diagram of an application environment of a method for asynchronously importing files in one embodiment;
[0023] FIG2 is a schematic diagram of a flow chart of a method for asynchronously importing files in one embodiment;
[0024] FIG3 is a schematic diagram of a flow chart of selecting a memory in one embodiment;
[0025] FIG4 is a schematic diagram of a process for selecting an import mode in one embodiment;
[0026] FIG5 is a schematic diagram of a process of importing files in one embodiment;
[0027] FIG6 is a schematic diagram of a process flow of file preprocessing in one embodiment;
[0028] FIG7 is a schematic diagram of a flow chart of import priority determination in one embodiment;
[0029] FIG8 is a schematic diagram of a specific process of asynchronously importing files in one embodiment;
[0030] FIG9 is a structural block diagram of a file asynchronous import device in one embodiment;
[0031] FIG. 10 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. It should be noted that in the embodiments of the present application, certain software, groups, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0033] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations. The acquisition, storage, use, and processing of data in the technical solution of this application are in compliance with relevant provisions of national laws and regulations.
[0034] The asynchronous file import method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The server 104 responds to the file import request for the target file sent by the terminal 102, and obtains the file attribute information of the target file when the target file meets the file import condition; according to the file attribute information, a temporary storage device matching the file attribute information is selected from each candidate storage device, and the target file is sent to the temporary storage device; the business requirements indicated by the file import request are obtained, and based on the business requirements, a target import mode matching the business requirements is selected from each candidate file import mode; the import priority of the target file is determined, and the target file is asynchronously imported into the target database through the temporary storage device according to the target import mode and the import priority. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers and Internet of Things devices. The server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0035] In an exemplary embodiment, as shown in FIG. 2 , a method for asynchronously importing a file is provided, which is described by taking the method applied to the server 104 in FIG. 1 as an example, and includes:
[0036] Step S202: In response to a file import request for a target file, if the target file meets a file import condition, obtain file attribute information of the target file.
[0037] Among them, the target file refers to the file that needs to be imported into the target database. In this embodiment, multiple types of files are supported, and the target file can be multiple files. A file import request refers to a request instruction to import a target file. File import conditions refer to the pre-set prerequisites for allowing files to be imported, to prevent non-compliant or other abnormal files from being imported into the database, affecting the accuracy and efficiency of file import. File attribute information refers to the basic attributes of the target file, including but not limited to file size, file type, file source, the business corresponding to the file, etc.
[0038] Exemplarily, when the server receives a file import request for a target file sent by a terminal, it can first determine whether the target file meets the prerequisites for file import. If the target file meets the file import conditions, the server can further obtain basic attribute information of the target file to facilitate candidate screening of suitable temporary storage devices to store the target file.
[0039] Step S204: According to the file attribute information, a temporary storage device matching the file attribute information is selected from each candidate storage device, and the target file is sent to the temporary storage device.
[0040] Among them, the storage is an intermediate device to distinguish the two processes of file upload and file import, so that the two processes are independent of each other and do not affect each other, so as to realize the asynchronous import of files, thereby improving the efficiency of file import. It can be understood that the storage includes but is not limited to Alibaba Cloud's OSS (Object Storage Service) storage, Tencent Cloud's COS (Cloud Object Storage) storage, and OBS (Object Storage Service) storage. Of course, other storage services can also be called in actual applications, and the calling of specific storage services is not limited here. The temporary storage is the storage used to store the target file in this embodiment.
[0041] Exemplarily, after obtaining the file attribute information of the target file, the server matches the file attribute information with various pre-configured candidate storage devices to filter out a temporary storage device that matches the target file from various candidate storage devices, and temporarily stores the target file in the storage device, thereby improving the reliability of file storage and thus improving the reliability of subsequent file imports.
[0042] Step S206 , obtaining the business requirement indicated by the file import request, and based on the business requirement, selecting a target import mode that matches the business requirement from among the candidate file import modes.
[0043] Among them, business requirements refer to the business requirements corresponding to the imported target file. File import mode refers to the operation method of file import, including but not limited to ordinary storage mode, Java implementation class processing mode and Python script processing mode. Among them, ordinary storage mode is a standard file import method and does not require additional development. Java implementation class processing mode and Python script processing mode are two customized file import methods. Configure the corresponding file import mode according to actual business needs.
[0044] Exemplarily, the server parses the file import request to obtain the business requirements for the target file carried by the file import request, and then analyzes the business logic complexity of the target file based on the business requirements, and then selects a suitable target import mode from each candidate file import mode for subsequent use of the target import mode to import the target file into the target database.
[0045] For example, for files with complex business logic, you can choose between the Java implementation class processing mode and the Python script processing mode. As for which one to choose, you can decide based on the actual situation, such as the development language used. For files with simple business logic, you can choose the ordinary storage mode.
[0046] Step S208, determining the import priority of the target file, and asynchronously importing the target file into the target database through the temporary storage according to the target import mode and the import priority.
[0047] The import priority refers to the priority level of the target file for asynchronous import, and the files with higher priority levels are imported first. The target database refers to the target database for storing the target files read from the temporary storage.
[0048] Exemplarily, the server may obtain an import priority of the target file, and read the target file from a temporary storage device according to the import priority, and then asynchronously import the target file into the target database according to the selected target import mode.
[0049] In this embodiment, the server responds to the file import request for the target file, firstly, when the target file meets the file import condition, obtains the file attribute information of the target file, and selects the temporary storage matching the file attribute information from each candidate storage according to the file attribute information, and sends the target file to the temporary storage for storage. It can be understood that the temporary storage is used as an intermediate storage device to store the file before import, and can distinguish the two processes of file upload and file import, so that the two processes are independent of each other, thereby effectively improving the efficiency of file import. Then, the business demand indicated by the file import request is obtained, and according to the business demand, the target import mode matching the business demand is selected from each candidate file import mode, and the target file is imported using a suitable target import model, which can improve the accuracy and efficiency of file import. Finally, according to the import priority of the target file, the target file is read from the temporary storage, and the target file is asynchronously imported into the target database according to the target import mode. In this way, the technical defect of low efficiency of file import caused by the time-consuming and labor-consuming problem of manual import is overcome, and the efficiency and accuracy of file import are effectively improved. In addition, asynchronous import can also avoid long-term operation of the system and improve system stability and reliability.
[0050] In an exemplary embodiment, as shown in FIG3 , according to the file attribute information, selecting a temporary storage device that matches the file attribute information from each candidate storage device includes:
[0051] Step S302: Obtain memory attribute information corresponding to each candidate memory.
[0052] The memory attribute information refers to the basic attribute information of the candidate memory, including but not limited to the memory type, memory capacity, storage object of the memory, storage location, memory cost, etc.
[0053] For example, for each pre-configured candidate storage, when matching the storage, the server may first obtain basic attribute information of each candidate storage to facilitate subsequent accurate matching.
[0054] Step S304: Match the file attribute information with each storage attribute information to obtain a target matching degree between the file attribute information and each storage attribute information.
[0055] The target matching degree is used to indicate the matching degree between the file attribute information and the storage attribute information.
[0056] Exemplarily, the server matches the file attribute information of the target file with each storage device information respectively. The matching content includes but is not limited to whether the storage capacity meets the file size, whether the storage object meets the file type, etc. Each matching item can be set with a corresponding score. The higher the matching degree, the higher the score. Finally, the scores of all matching items are averaged to obtain the matching value between the file attribute information and the storage device attribute information. The matching value indicates the degree of matching.
[0057] Step S306: The candidate storage whose target matching degree reaches the matching degree threshold is used as a temporary storage.
[0058] The matching degree threshold refers to a preset matching degree critical value. If the threshold is reached, it means that the two are matched, and if the threshold is not reached, it means that the two are not matched.
[0059] Exemplarily, after obtaining the target matching degree between the file attribute information and each storage device information, it is determined whether each target matching degree reaches the matching degree threshold, and the candidate storage device that reaches the matching degree threshold is used as the storage device for temporarily storing the target file. If there are multiple candidate storage devices that reach the matching degree threshold, one of them can be randomly selected as the temporary storage device.
[0060] In this embodiment, by calculating the information matching degree between the file attribute information and the memory attribute information, a suitable temporary memory is selected from each candidate memory, thereby improving the accuracy of memory selection, thereby improving the accuracy and reliability of file storage, and further improving the accuracy of the entire file import process.
[0061] In an exemplary embodiment, as shown in FIG4 , based on business requirements, a target import mode matching the business requirements is selected from each candidate file import mode, including:
[0062] Step S402: extract the file content information of the target file, perform correlation analysis on the business demand and the file content information, and obtain the target correlation between the business demand and the file content information.
[0063] Among them, the file content information refers to the file content of the target file. The target relevance refers to the degree of relevance between the file content information and the business requirements. It can be understood that the relevance can be used to characterize the business logic complexity of the target file. The higher the relevance between the file content information and the business requirements, the higher the relevance between the target file and the business, and thus the higher the business logic complexity of the target file.
[0064] Exemplarily, the server extracts the file content of the target file and performs a correlation analysis between the file content and the business needs to analyze the degree of association between the file content and the business needs. In one example, it can be determined whether there is a correlation with the business needs based on the content fields in the file content.
[0065] Step S404 , based on the target relevance, screening is performed among the candidate file import modes to obtain a target import mode that matches the target relevance.
[0066] For example, after analyzing the correlation between the file content information of the target file and the business requirements, the server further selects from various candidate file import modes according to the target correlation. For example, when the target correlation is high, the Java implementation class processing mode or the Python script processing mode can be selected, and when the target correlation is low, the ordinary storage mode can be selected. Of course, in actual applications, the complexity of interacting with external systems during the file processing of the target file can also be used to select a suitable target import mode.
[0067] In this embodiment, the degree of association between the file content information and the business requirements is analyzed to select a suitable file import mode, thereby improving the accuracy and efficiency of file import.
[0068] In an exemplary embodiment, as shown in FIG5 , asynchronously importing a target file into a target database through a temporary storage device based on a target import mode and an import priority includes:
[0069] Step S502: Read the target file from the temporary storage based on the import priority.
[0070] Step S504: when there is no historical import record for the target file, asynchronously import the target file into the target database according to the target import mode.
[0071] The historical import record refers to the historical record of asynchronous import of the target file. It is understandable that in order to avoid processing repeated import tasks, a deduplication mechanism is used in this embodiment to improve the accuracy of file import.
[0072] Exemplarily, the server reads the target file from the temporary storage device according to the import priority of the target file, and further detects whether there is a historical import record for the target file. If so, the asynchronous import task is not executed. If not, the target file is imported into the target database according to the previously selected target import mode.
[0073] In this embodiment, by detecting whether there is a historical import record for the target file, it is determined whether to import the target file into the target database, which effectively avoids executing repeated import tasks, thereby improving the efficiency and accuracy of file import.
[0074] In an exemplary embodiment, as shown in FIG6 , in response to a file import request for a target file, when the target file meets the file import condition, obtaining file attribute information of the target file includes:
[0075] Step S602 , in response to a file import request for a target file, the target file is segmented to obtain a plurality of initial sub-files.
[0076] The initial sub-file refers to a file obtained after the target file is split.
[0077] Exemplarily, considering that the target file may be a large-scale data file, in order to further improve the efficiency of file import, the target file is selected to be segmented in this embodiment. That is, the server responds to the file import request for the target file, adds the target file to the asynchronous import queue, forms a file import task for the target file, and divides the file import task into multiple sub-import tasks, and the sub-import tasks correspond to the initial sub-files one by one.
[0078] In one embodiment, the file segmentation may be performed by date field, mobile phone number field or other specified fields, so that the segmented files are pre-processed to improve the performance of file processing.
[0079] Step S604: perform file preprocessing on each initial sub-file to obtain a target sub-file corresponding to each initial sub-file.
[0080] The file preprocessing refers to the normalization of the file. The target subfile refers to the normalized file obtained after the initial subfile is preprocessed.
[0081] Exemplarily, for each initial sub-file, the server may pre-process it to ensure import accuracy, and the pre-processing includes but is not limited to outlier detection, missing value processing, data processing exceeding standard thresholds, file format unification, file source unification, i.e., unification of various files from different data sources, etc. In one example, for large-scale files, the server supports distributed pre-processing to improve the efficiency of file pre-processing.
[0082] Step S606: When all target sub-files meet the file import condition, the target sub-files are aggregated to obtain an aggregated file, and file attribute information of the aggregated file is obtained.
[0083] Exemplarily, when each target sub-file meets the file import conditions, that is, there are no outliers, no missing values, the file format is unified, the file source is unified, etc., the target sub-files are aggregated to obtain an aggregated file, and the file attribute information of the aggregated file is obtained to asynchronously import the aggregated file.
[0084] In this embodiment, by performing file segmentation, file preprocessing, and file aggregation, the standardization and uniformity of the imported files are ensured, thereby improving the accuracy of file import.
[0085] In an exemplary embodiment, as shown in FIG7 , determining the import priority of the target file includes:
[0086] Step S702: Analyze the target time required to import the target file into the target database according to the file size of the target file.
[0087] Step S704: Based on the target time and the business application time of the target file, a priority analysis is performed on the target file to obtain an import priority of the target file.
[0088] The target time refers to the time required to import the target file into the target database. The business application time refers to the time when the target file is applied. For example, if the target file needs to be displayed two hours after being imported into the target database, the import priority of the target file can be set to high priority.
[0089] Exemplarily, the server determines the time required to completely import the target file into the target database based on the file size of the target file and the time when the target file is applied as recorded in the business requirements, and sets the import priority of the target file based on the two time differences.
[0090] In this embodiment, the import priority of the target file is set based on the time required for the target file to complete import and the time when the target file is called, thereby improving the accuracy of priority setting and making the priority more in line with business needs, thereby improving the accuracy of file import.
[0091] In one embodiment, the entire file asynchronous import process can be monitored by the server in real time, and detailed log information can be recorded to facilitate subsequent problem troubleshooting. In addition, the entire process can be displayed visually, and the user object can view the detailed information of the entire file import process in real time. During the file import process, when data fails to be imported, the re-import mechanism will intervene, that is, the failed data will be put back into the asynchronous import queue and wait for the next processing.
[0092] In a specific embodiment, as shown in FIG8 , the process of the file asynchronous import method includes:
[0093] The operation object uploads the target file through the terminal. After receiving the target file, the terminal initiates a file import request to the server. The server adds the target file to the asynchronous task queue, splits the target file, and obtains multiple initial sub-files. For each initial sub-file, the server performs file preprocessing to obtain the target sub-file corresponding to each initial sub-file. When each target sub-file meets the file import conditions, each target sub-file is aggregated to obtain a summary file, and the file attribute information of the summary file is obtained. The storage attribute information corresponding to each candidate storage is obtained respectively. The candidate storage includes OSS storage and COS storage. The file attribute information is matched with each storage attribute information respectively to obtain the target matching degree between the file attribute information and each storage attribute information. The candidate storage whose target matching degree reaches the matching degree threshold is used as a temporary storage, and the summary file is sent to the temporary storage. The business requirements indicated by the file import request are obtained, the file content information of the summary file is extracted, the business requirements and the file content information are analyzed for correlation, and the target correlation between the business requirements and the file content information is obtained. The target correlation is used to characterize the business logic complexity of the summary file. Based on the target correlation, the candidate file import modes, namely the general storage mode, the Java implementation class processing mode and the Python script processing mode, are screened to obtain the target import mode that matches the target correlation. According to the file size of the summary file, the target time required for the summary file to be imported into the target database is analyzed. Based on the target time and the business application time of the summary file, the summary file is analyzed for priority to obtain the import priority of the summary target file. Based on the import priority, the summary file is read from the temporary storage device. If there is no historical import record for the summary file, the summary file is asynchronously imported into the target database according to the target import mode. The import result details are generated, and the import result details are visualized to the operation object. For data that fails to be imported, the re-direction mechanism will intervene and put the failed data back into the asynchronous import queue to wait for the next processing.
[0094] In this embodiment, in response to a file import request for a target file, first, when the target file meets the file import condition, the file attribute information of the target file is obtained, so that according to the file attribute information, a temporary storage device matching the file attribute information is screened out from each candidate storage device, and the target file is sent to the temporary storage device for storage. It can be understood that the temporary storage device is used as an intermediate storage device to store the file before import, and can distinguish the two processes of file upload and file import, so that the two processes are independent of each other, thereby effectively improving the efficiency of file import. Then, the business requirements indicated by the file import request are obtained, and according to the business requirements, a target import mode matching the business requirements is screened out from each candidate file import mode, and a suitable target import model is used to import the target file, which can improve the accuracy and efficiency of file import. Finally, according to the import priority of the target file, the target file is read out from the temporary storage device, and the target file is asynchronously imported into the target database according to the target import mode. In this way, the technical defect of low efficiency of file import caused by the time-consuming and labor-intensive problem of manual import is overcome, and the efficiency and accuracy of file import are effectively improved. In addition, asynchronous import can also avoid long-term operation of the system and improve system stability and reliability.
[0095] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0096] Based on the same inventive concept, the embodiment of the present application also provides a file asynchronous import device for implementing the file asynchronous import method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more file asynchronous import device embodiments provided below can refer to the limitations of the file asynchronous import method above, and will not be repeated here.
[0097] In an exemplary embodiment, as shown in FIG9 , a file asynchronous import device is provided, including: an information acquisition module 902, for responding to a file import request for a target file, and obtaining file attribute information of the target file when the target file meets the file import conditions; a storage screening module 904, for screening out a temporary storage device that matches the file attribute information from each candidate storage device according to the file attribute information, and sending the target file to the temporary storage device; an import pattern matching module 906, for obtaining the business requirements indicated by the file import request, and based on the business requirements, screening out a target import pattern that matches the business requirements from each candidate file import pattern; an asynchronous import module 908, for determining the import priority of the target file, and asynchronously importing the target file into the target database through the temporary storage device according to the target import pattern and the import priority.
[0098] In one of the embodiments, the memory screening module 904 is also used to: respectively obtain the memory attribute information corresponding to each candidate memory; respectively match the file attribute information with each memory attribute information to obtain the target matching degree between the file attribute information and each memory attribute information; and use the candidate memory whose target matching degree reaches the matching degree threshold as a temporary memory.
[0099] In one of the embodiments, the import pattern matching module 906 is also used to: extract file content information of the target file, perform correlation analysis on the business requirements and the file content information, and obtain a target correlation between the business requirements and the file content information; based on the target correlation, screen among the candidate file import patterns to obtain a target import pattern that matches the target correlation.
[0100] In one embodiment, the asynchronous import module 906 is further used to: read the target file from the temporary storage based on the import priority; and asynchronously import the target file into the target database according to the target import mode when there is no historical import record for the target file.
[0101] In one of the embodiments, the information acquisition module 902 is also used to: in response to a file import request for a target file, split the target file into multiple initial sub-files; perform file preprocessing on each initial sub-file to obtain a target sub-file corresponding to each initial sub-file; when each target sub-file meets the file import condition, aggregate the target sub-files to obtain an aggregate file, and obtain file attribute information of the aggregate file.
[0102] In one of the embodiments, the asynchronous import module 908 is also used to: analyze the target time required to import the target file into the target database based on the file size of the target file; perform priority analysis on the target file based on the target time and the business application time of the target file to obtain the import priority of the target file.
[0103] Each module in the above-mentioned file asynchronous import device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0104] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG10. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store file asynchronous import data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for asynchronously importing files is implemented.
[0105] Those skilled in the art will understand that the structure shown in FIG. 10 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0106] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: in response to a file import request for a target file, if the target file meets the file import conditions, obtaining file attribute information of the target file; based on the file attribute information, screening out a temporary storage device that matches the file attribute information from each candidate storage device, and sending the target file to the temporary storage device; obtaining the business requirement indicated by the file import request, and based on the business requirement, screening out a target import mode that matches the business requirement from each candidate file import mode; determining the import priority of the target file, and asynchronously importing the target file into a target database through the temporary storage device according to the target import mode and the import priority.
[0107] In one embodiment, when the processor executes the computer program, the following steps are also implemented: respectively obtaining the memory attribute information corresponding to each candidate memory; respectively matching the file attribute information with each memory attribute information to obtain the target matching degree between the file attribute information and each memory attribute information; and using the candidate memory whose target matching degree reaches the matching degree threshold as a temporary memory.
[0108] In one embodiment, when the processor executes the computer program, the following steps are also implemented: extracting file content information of the target file, performing correlation analysis on the business requirements and the file content information, and obtaining a target correlation between the business requirements and the file content information; based on the target correlation, screening among the candidate file import modes to obtain a target import mode that matches the target correlation.
[0109] In one embodiment, when the processor executes the computer program, the following steps are also implemented: based on the import priority, the target file is read from the temporary storage; if there is no historical import record for the target file, the target file is asynchronously imported into the target database according to the target import mode.
[0110] In one embodiment, the processor further implements the following steps when executing the computer program: in response to a file import request for a target file, the target file is segmented to obtain a plurality of initial sub-files; for each initial sub-file, file preprocessing is performed to obtain a target sub-file corresponding to each initial sub-file; when each target sub-file meets the file import condition, each target sub-file is aggregated to obtain an aggregated file, and file attribute information of the aggregated file is obtained.
[0111] In one embodiment, when the processor executes the computer program, the following steps are also implemented: according to the file size of the target file, the target time required to import the target file into the target database is analyzed; based on the target time and the business application time of the target file, the priority analysis of the target file is performed to obtain the import priority of the target file.
[0112] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: in response to a file import request for a target file, if the target file meets the file import conditions, file attribute information of the target file is obtained; based on the file attribute information, a temporary storage device matching the file attribute information is screened out from each candidate storage device, and the target file is sent to the temporary storage device; the business requirement indicated by the file import request is obtained, and based on the business requirement, a target import mode matching the business requirement is screened out from each candidate file import mode; the import priority of the target file is determined, and the target file is asynchronously imported into a target database through the temporary storage device according to the target import mode and the import priority.
[0113] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: respectively obtaining the memory attribute information corresponding to each candidate memory; respectively matching the file attribute information with each memory attribute information to obtain the target matching degree between the file attribute information and each memory attribute information; and using the candidate memory whose target matching degree reaches the matching degree threshold as a temporary memory.
[0114] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: extracting file content information of the target file, performing correlation analysis on the business requirements and the file content information, and obtaining a target correlation between the business requirements and the file content information; based on the target correlation, screening among the candidate file import modes to obtain a target import mode that matches the target correlation.
[0115] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the import priority, the target file is read from the temporary storage; if there is no historical import record for the target file, the target file is asynchronously imported into the target database according to the target import mode.
[0116] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to a file import request for a target file, the target file is segmented to obtain multiple initial sub-files; for each initial sub-file, file preprocessing is performed to obtain a target sub-file corresponding to each initial sub-file; when each target sub-file meets the file import condition, each target sub-file is aggregated to obtain an aggregated file, and file attribute information of the aggregated file is obtained.
[0117] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the file size of the target file, the target time required to import the target file into the target database is analyzed; based on the target time and the business application time of the target file, a priority analysis is performed on the target file to obtain the import priority of the target file.
[0118] In one embodiment, a computer program product is provided, including a computer program, which implements the following steps when executed by a processor: in response to a file import request for a target file, if the target file meets the file import conditions, obtain file attribute information of the target file; based on the file attribute information, screen out a temporary storage device that matches the file attribute information from each candidate storage device, and send the target file to the temporary storage device; obtain the business requirement indicated by the file import request, and based on the business requirement, screen out a target import mode that matches the business requirement from each candidate file import mode; determine the import priority of the target file, and asynchronously import the target file into a target database through the temporary storage device according to the target import mode and the import priority.
[0119] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: respectively obtaining the memory attribute information corresponding to each candidate memory; respectively matching the file attribute information with each memory attribute information to obtain the target matching degree between the file attribute information and each memory attribute information; and using the candidate memory whose target matching degree reaches the matching degree threshold as a temporary memory.
[0120] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: extracting file content information of the target file, performing correlation analysis on the business requirements and the file content information, and obtaining a target correlation between the business requirements and the file content information; based on the target correlation, screening among the candidate file import modes to obtain a target import mode that matches the target correlation.
[0121] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the import priority, the target file is read from the temporary storage; if there is no historical import record for the target file, the target file is asynchronously imported into the target database according to the target import mode.
[0122] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to a file import request for a target file, the target file is segmented to obtain multiple initial sub-files; for each initial sub-file, file preprocessing is performed to obtain a target sub-file corresponding to each initial sub-file; when each target sub-file meets the file import condition, each target sub-file is aggregated to obtain an aggregated file, and file attribute information of the aggregated file is obtained.
[0123] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the file size of the target file, the target time required to import the target file into the target database is analyzed; based on the target time and the business application time of the target file, a priority analysis is performed on the target file to obtain the import priority of the target file.
[0124] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0125] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0126] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for asynchronously importing files, characterized in that: The method comprises: In response to a file import request for a target file, if the target file meets a file import condition, obtaining file attribute information of the target file; According to the file attribute information, a temporary storage device matching the file attribute information is selected from each candidate storage device, and the target file is sent to the temporary storage device; Acquire the business requirement indicated by the file import request, and based on the business requirement, select a target import mode that matches the business requirement from among the candidate file import modes; The import priority of the target file is determined, and the target file is asynchronously imported into the target database through the temporary storage device according to the target import mode and the import priority.
2. The method according to claim 1, characterized in that The step of selecting a temporary storage device that matches the file attribute information from each candidate storage device according to the file attribute information includes: Respectively obtain memory attribute information corresponding to each candidate memory; Matching the file attribute information with each of the storage attribute information to obtain a target matching degree between the file attribute information and each of the storage attribute information; The candidate memory whose target matching degree reaches the matching degree threshold is used as a temporary memory.
3. The method according to claim 1, characterized in that The step of selecting a target import mode that matches the business requirement from among the candidate file import modes based on the business requirement includes: Extracting file content information of the target file, performing correlation analysis on the business requirement and the file content information, and obtaining a target correlation degree between the business requirement and the file content information; Based on the target relevance, each candidate file import mode is screened to obtain a target import mode that matches the target relevance.
4. The method according to claim 1, characterized in that: The step of asynchronously importing the target file into the target database through the temporary storage device based on the target import mode and the import priority includes: Based on the import priority, reading the target file from the temporary storage; When there is no historical import record for the target file, the target file is asynchronously imported into the target database according to the target import mode.
5. The method according to claim 1, characterized in that The step of responding to a file import request for a target file and obtaining file attribute information of the target file when the target file meets a file import condition includes: In response to a file import request for a target file, the target file is segmented to obtain a plurality of initial sub-files; For each of the initial sub-files, file preprocessing is performed to obtain a target sub-file corresponding to each of the initial sub-files; When all the target sub-files meet the file import condition, the target sub-files are aggregated to obtain an aggregated file, and file attribute information of the aggregated file is obtained.
6. The method according to claim 1, characterized in that The business requirement includes the business application time of the target file, and the file attribute information includes the file size of the target file; and determining the import priority of the target file includes: Analyzing the target time required to import the target file into the target database according to the file size of the target file; Based on the target time and the business application time of the target file, a priority analysis is performed on the target file to obtain an import priority of the target file.
7. A file asynchronous import device, characterized in that: The device comprises: An information acquisition module, configured to respond to a file import request for a target file and, if the target file meets a file import condition, acquire file attribute information of the target file; A storage screening module, used for screening out a temporary storage that matches the file attribute information from each candidate storage according to the file attribute information, and sending the target file to the temporary storage; An import mode matching module is used to obtain the business requirement indicated by the file import request, and based on the business requirement, select a target import mode that matches the business requirement from each candidate file import mode; The asynchronous import module is used to determine the import priority of the target file, and asynchronously import the target file into the target database through the temporary storage according to the target import mode and the import priority.
8. The device according to claim 7, characterized in that The memory screening module is further used to: respectively obtain memory attribute information corresponding to each candidate memory; respectively match the file attribute information with each memory attribute information to obtain a target matching degree between the file attribute information and each memory attribute information; The candidate memory whose target matching degree reaches the matching degree threshold is used as a temporary memory.
9. The device according to claim 7, characterized in that The import pattern matching module is further used to: extract the file content information of the target file, perform correlation analysis on the business demand and the file content information, and obtain the target correlation between the business demand and the file content information; Based on the target relevance, each candidate file import mode is screened to obtain a target import mode that matches the target relevance.
10. The device according to claim 7, characterized in that The asynchronous import module is also used to: read the target file from the temporary storage device based on the import priority; and asynchronously import the target file into the target database according to the target import mode when there is no historical import record for the target file.
11. The device according to claim 7, characterized in that The information acquisition module is also used to: respond to a file import request for a target file, split the target file into multiple initial sub-files; perform file preprocessing on each of the initial sub-files to obtain a target sub-file corresponding to each of the initial sub-files; When all the target sub-files meet the file import condition, the target sub-files are aggregated to obtain an aggregated file, and file attribute information of the aggregated file is obtained.
12. The device according to claim 7, characterized in that The asynchronous import module is also used to: analyze the target time required to import the target file into the target database according to the file size of the target file; and perform priority analysis on the target file based on the target time and the business application time of the target file to obtain the import priority of the target file.
13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Data transmission method and device
CN110597766A
Asynchronous file importing method based on thread pool
CN113434469A
Image file storage and retrieval method and device
CN114385566A
Supply chain design system based on rule engine
CN117931134A
