CN114637801A - Data import method and device, computer equipment and storage medium - Google Patents

Data import method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114637801A
CN114637801A CN202210243407.1A CN202210243407A CN114637801A CN 114637801 A CN114637801 A CN 114637801A CN 202210243407 A CN202210243407 A CN 202210243407A CN 114637801 A CN114637801 A CN 114637801A
Authority
CN
China
Prior art keywords
file
import
target
database
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210243407.1A
Other languages
Chinese (zh)
Inventor
彭发
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202210243407.1A priority Critical patent/CN114637801A/en
Publication of CN114637801A publication Critical patent/CN114637801A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the field of artificial intelligence, a target import table corresponding to a target file is determined according to a file import parameter object, and data contents in the target file are imported into a database based on the target import table, so that the data contents of files of different types can be imported in batches, the types and specific data contents of the files do not need to be concerned, and the efficiency of data import is improved. A data import method, a data import device, a computer device and a storage medium are provided, wherein the method comprises the following steps: acquiring a file import parameter object, and performing file query and database connection according to the file import parameter object; when a target file to be imported is obtained through query and the database is normally connected, determining a target import table corresponding to the target file according to the file import parameter object, wherein the target import table is an import table in the database; and importing the data content in the target file into the database based on the target import table. In addition, the present application also relates to blockchain techniques, where a database may be stored.

Description

Data import method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of artificial intelligence and data processing, and in particular, to a data importing method and apparatus, a computer device, and a storage medium.
Background
In the software development process, many business functions often involve importing data content in external files into a database. The existing file data import modes mainly include two types: and (3) importing data by using a professional data processing tool and developing a special data importing function. The data processing tool generally has a plurality of complex components, the importing operation is complex, only individual files can be processed, and data of different types of files cannot be imported in batches, so that the data importing efficiency is low. If a special data import function is developed, a corresponding data import program needs to be separately developed for each type of file, so that each data import program can only process a separate file, different types of files cannot be imported in batches, and the problem of low efficiency of data import also exists.
Therefore, how to improve the efficiency of data import becomes an urgent problem to be solved.
Disclosure of Invention
The application provides a data import method, a data import device, computer equipment and a storage medium, wherein a target import table corresponding to a target file is determined according to a file import parameter object, and data contents in the target file are imported into a database based on the target import table, so that the data contents of different types of files can be imported in batches, the types and specific data contents of the files do not need to be concerned, and the data import efficiency is improved.
In a first aspect, the present application provides a data importing method, including:
acquiring a file import parameter object, and performing file query and database connection according to the file import parameter object;
when a target file to be imported is obtained through query and the database is normally connected, determining a target import table corresponding to the target file according to the file import parameter object, wherein the target import table is an import table in the database;
and importing the data content in the target file into the database based on the target import table.
In a second aspect, the present application further provides a data importing apparatus, including:
the object acquisition module is used for acquiring a file import parameter object, and performing file query and database connection according to the file import parameter object;
the import table determining module is used for determining a target import table corresponding to the target file according to the file import parameter object when the target file to be imported is obtained through query and the database is normally connected, wherein the target import table is an import table in the database;
and the data content import module is used for importing the data content in the target file into the database based on the target import table.
In a third aspect, the present application further provides a computer device comprising a memory and a processor;
the memory for storing a computer program;
the processor is configured to execute the computer program and implement the data importing method as described above when executing the computer program.
In a fourth aspect, the present application further provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program causes the processor to implement the data importing method as described above.
The application discloses a data import method, a data import device, computer equipment and a storage medium, wherein by acquiring a file import parameter object, the data content in a target file can be imported into a database subsequently based on the file import parameter object without paying attention to the type and specific data content of the file; by carrying out file query and database connection according to the file import parameter object, whether a target file is obtained by query and whether the database is normally connected can be determined, and the follow-up normal data import operation can be ensured; when the target file to be imported is obtained through query and the database is normally connected, the target import table corresponding to the target file is determined according to the file import parameter object, and the data content in the target file is imported into the database based on the target import table, so that the data content of different types of files can be imported in batches, and the efficiency of data import is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flow chart of a data importing method provided by an embodiment of the present application;
FIG. 2 is a schematic flow chart of data import provided by an embodiment of the present application;
FIG. 3 is a schematic flow chart diagram illustrating a sub-step of determining a target import table according to an embodiment of the present application;
fig. 4 is a schematic block diagram of a data importing apparatus according to an embodiment of the present application;
fig. 5 is a schematic block diagram of a structure of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
It is to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
The embodiment of the application provides a data import method, a data import device, computer equipment and a storage medium. The data import method can be applied to a server or a terminal, the target import table corresponding to the target file is determined according to the file import parameter object, and the data content in the target file is imported into the database based on the target import table, so that the data content of different types of files can be imported in batches, the types and specific data content of the files do not need to be concerned, and the data import efficiency is improved.
The server may be an independent server, or may be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), a big data and artificial intelligence platform, and the like. The terminal can be an electronic device such as a smart phone, a tablet computer, a notebook computer, a desktop computer and the like.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
As shown in fig. 1, the data import method includes steps S10 through S30.
And step S10, acquiring the file import parameter object, and performing file query and database connection according to the file import parameter object.
It should be noted that the embodiment of the present application may be applied to a data import component, and by determining a target import table corresponding to a target file according to a file import parameter object and importing data contents in the target file into a database based on the target import table, the data contents of different types of files may be imported in batch, without paying attention to the type and specific data contents of the file, so as to improve data import efficiency.
For example, in a software development scenario, a developer may import a target file to be imported into a database through a data import component, and the data import component automatically imports data contents in the target file into the database in batches, without paying attention to the type and specific data contents of the file.
Illustratively, the file import parameter object is obtained, an import importFiles function can be called, and the file import parameter object is transmitted to the data import component.
By acquiring the file import parameter object, the data content in the target file can be imported into the database subsequently based on the file import parameter object without paying attention to the type and specific data content of the file.
It should be noted that, in the embodiment of the present application, the data importing component may import data into the database by using the file import parameter object, and it is not necessary to know the type and specific data content of the imported file in advance, so that the data importing component may import a large number of files of different types at the same time. However, the existing data processing tool or data importing program needs to know the type and content of the file, so as to separately develop the corresponding importing logic for each type of file.
In the embodiment of the application, after the file import parameter object is obtained, file query and database connection can be performed according to the file import parameter object; or firstly, parameter verification is carried out on the file import parameter object, and then file query and database connection are carried out according to the file import parameter object after parameter verification.
In some embodiments, performing file query and database connection according to the file import parameter object may include: analyzing the file import parameter object to obtain corresponding file attribute information and database connection information; inquiring files according to file storage paths in the file attribute information; and establishing connection with the database according to the database connection information.
Illustratively, the file import parameter object is analyzed to obtain corresponding parameter information. The parameter information may include, but is not limited to, file attribute information, database connection information, file verification policies, and operation execution information, among others.
The file attribute information may include a file storage path, a file type, an import table name, a primary key field attribute, and an attribute value of the first row, among others. The file storage path is used for determining the storage position of the target file. The file type is used to determine a reading manner of reading the data content in the target file. The import table name is used to query an import table in the database. The primary key field attribute is used for determining a data import mode of the target file, for example, when the primary key field attribute is a null value, the data import mode is insertion; for another example, when the attribute of the primary key field is a non-null value, if the primary key field in the target file matches with the primary key field in the import table, the import mode is updating; and if the primary key field in the target file is not matched with the primary key field in the import table, the data import mode is insertion. The attribute values of the first row include that the first row is a column field of True and that the first row is a column field of Flase. The database connection information may include database server IP, database name, database type, port, username, and password, among others. The file verification policy is used for verifying the target file and may include an excluded field list, a date verification list, and the like. The operation execution information refers to an operation executed after the data import is completed, such as sending a short message notification, sending a mail notification, and the like.
Illustratively, file query can be performed according to the file storage path in the file attribute information; for example, when the file storage path is D: xlsx, the D-disk may be queried for the presence of test.xlsx files. If the file storage path has a file, determining to query to obtain a target file to be imported; if the file does not exist in the file storage path, the subsequent operation is stopped, and the file import abnormal information is recorded in the log. Wherein, the file import exception information may be that the target file does not exist.
Illustratively, when establishing connection with the database according to the database connection information, a connection request may be sent to the database according to the database server IP, the database name, the database type, the port, the user name, and the password; when a connection success message returned by the database is received, it can be determined that the file data import component successfully establishes a connection with the database. If the connection success message returned by the database or the connection failure message returned by the database is not received within the preset time, it is determined that the connection between the file data import component and the database is not successfully established, and at the moment, the subsequent operation is stopped and the file import abnormal information is recorded in the log. The file import exception information may be a database connection failure.
By carrying out file query and database connection according to the file import parameter object, whether a target file is obtained by query and whether the database is normally connected can be determined, and the follow-up normal data import operation can be ensured.
In other embodiments, before performing the file query and the database connection according to the file import parameter object, the method may further include: and carrying out parameter verification on the file import parameter object to obtain the file import parameter object after the parameter verification.
It should be noted that, the parameter verification performed on the file import parameter object mainly determines whether a parameter in the file import object is missing. When the file import parameter object is determined to be parameter missing, a parameter missing prompt message can be generated, so that a developer can re-import or configure the file import parameter object, and the missing parameters can be automatically supplemented.
Referring to fig. 2, fig. 2 is a schematic flowchart of data importing according to an embodiment of the present disclosure. As shown in fig. 2, the parameter check may be performed on the file import parameter object first.
For example, the parameter check may be performed on the file attribute information in the file import parameter object. For example, it is determined whether the file attribute information includes a file storage path, a file type, an import table name, and a primary key field attribute. And when the file attribute information does not comprise the file type, inquiring the target file according to the file storage path, and determining the file type according to the suffix information of the target file. For example, when the suffix information of the target file is xls or xlxs, the file type may be determined to be an excel file. For another example, when the suffix information of the target file is txt, the file type may be determined to be a text file.
For example, the parameter check may be performed on the database connection information in the file import parameter object. For example, it is determined whether the database connection information includes a database server IP, a database name, a database type, a port, a user name, and a password.
By performing parameter verification on the file import parameter object, whether the file import parameter object has parameter errors or not can be determined, so that the probability of abnormity in the subsequent data import of the file import parameter object can be reduced, and the efficiency of data import is improved.
In some embodiments, the file query and the database connection according to the file import parameter object may include: and importing the file into the parameter object according to the verified file to perform file query and database connection.
For example, as shown in fig. 2, after the parameter check is performed on the file import parameter object, a file query and a database connection may be performed according to the file import parameter object after the parameter check.
For example, a file may be queried according to a file storage path in the file attribute information, and a file obtained through query may be determined as a target file. The target file may be one or more files, where the target file may be the same type of file or different types of files. For example, the target file may be an excel file, a text file, or other types of files. If the file does not exist in the file storage path, the subsequent operation is stopped, and the file import abnormal information is recorded in the log.
Illustratively, when establishing connection with the database according to the database connection information, a connection request may be sent to the database according to the database server IP, the database name, the database type, the port, the user name, and the password; when a connection success message returned by the database is received, it can be determined that the file data import component successfully establishes a connection with the database. If the connection success message returned by the database or the connection failure message returned by the database is not received within the preset time, it is determined that the connection between the file data import component and the database is not successfully established, and at the moment, the subsequent operation is stopped and the file import abnormal information is recorded in the log.
By carrying out file query and database connection according to the file import parameter object after parameter verification, whether the target file is obtained by query and whether the database is normally connected can be determined, and the follow-up normal data import operation can be ensured.
And step S20, when the target file to be imported is obtained through query and the database connection is normal, determining a target import table corresponding to the target file according to the file import parameter object, wherein the target import table is an import table in the database.
For example, if the target file to be imported and/or the database are not queried and the connection is not successfully established, the import of the file is stopped and the file import abnormal information is recorded in the log.
Illustratively, when a target file to be imported is obtained through query and the database connection is normal, a target import table corresponding to the target file is determined according to the file import parameter object. The target import table is used for caching the verified data content in the target file and writing the data content into the database in batches.
Referring to fig. 3, fig. 3 is a schematic flowchart of a sub-step of determining a target import table according to an embodiment of the present application, which may specifically include the following steps S201 to S203.
Step S201, querying the database according to the import table name in the file attribute information, and determining whether a first import table corresponding to the import table name exists.
For example, if the import table name in the file attribute information is USERS, the database may be queried whether there is a first import table with the import table name being USERS.
Step S202, if the first import table exists in the database, determining the first import table as the target import table.
For example, when the database has a first import table with an import table name of USERS, the first import table may be determined as the target import table.
By determining the first import table in the database as the target import table, the data content in the target file can be imported into the database in batch based on the target import table.
Step S203, if the first import table does not exist in the database, creating a second import table, and determining the second import table as the target import table.
In some embodiments, creating the second import table may include: when the attribute value of a first line in the file attribute information is a preset value, acquiring a first row and column field in a target file; and adding the first row and column fields to the initial data table to obtain a second import table. Wherein the second import table has the same column fields as the target file.
Illustratively, the preset value is the first row is the column field True. For example, when the attribute value of the first row in the file attribute information indicates that the column field of the first row is True, the first row and column field in the target file is acquired, and the first row and column field is added to the initial data table, so that the second import table is acquired. And when the attribute value of the first row in the file attribute information is that the first row is the column field of the file attribute information of the Flase, stopping importing the file and recording abnormal information of file import in the log.
By creating the second import table, the data content in the target file can be imported into the database through the created second import table under the condition that the database does not have the first import table, and the probability of successful data import is improved.
And step S30, importing the data content in the target file into the database based on the target import table.
It should be noted that, in the embodiment of the present application, data content in the target file may be first imported into a position where a field corresponding to the target import table is located, and then data in the target import table may be written into the database in batch.
In some embodiments, before importing the data content in the target file into the database based on the target import table, the method may further include: extracting a file verification strategy in the file import parameter object; and verifying the target file according to the file verification strategy to obtain the verified target file.
Illustratively, the file check policy may include an excluded field list, a date check list, and the like. It should be noted that the excluded field list is used to filter the column fields that do not need to be imported in the target file and the field values corresponding to the column fields; when the excluded field list is null, it indicates that no fields need to be filtered. The date check list is used to correct the date format in the target file.
For example, when the target file is verified according to the file verification policy, the target file may be field-filtered according to the excluded field list and/or date-format-corrected according to the date verification list.
For example, if the target file includes three fields, i.e., USER _ ID, USER _ NAME, and pointer, and the exclusion field list includes the pointer field, the pointer field in the target file needs to be filtered.
For another example, if the 4 th field in the target file is a BIRTHDAY field, and the date format of the BIRTHDAY field needs to be YYYY-MM-DD, the date check list may be set to { 4: "YYYY-MM-DD", so as to ensure that the date format corresponding to the BITHDAY field in the target file is YYYYY-MM-DD.
It should be noted that, in the embodiment of the present application, a file verification policy in the file import parameter object may also be customized. For example, new filtering rules are added. Illustratively, the destination file includes USER _ ID, USER _ NAME, binder, bithday, and STATUS fields, and if the field values corresponding to the STATUS fields are 0 and 1, 0 is invalid and 1 is valid, the filtering rule may be STATUS 0, so that data with STATUS field 0 may be filtered out.
By checking the target file according to the file checking strategy, the validity of the data content in the target file can be ensured, unnecessary data content is prevented from being imported, the format of the imported data is unified, and the efficiency of data import is improved.
In some embodiments, importing the data content in the target file into the database based on the target import table may include: and importing the data content in the verified target file into the database based on the target import table.
The data content in the target file is imported into the database based on the target import table, so that the data content of different types of files can be imported in batches, and the data import efficiency is improved.
The importing, based on the target import table, the data content in the verified target file into the database may include: determining a data import mode corresponding to the verified target file according to the primary key field attribute in the file attribute information; and importing the data content in the verified target file into a target import table based on the data import mode, and writing the data content into the database by the target import table.
Illustratively, when the attribute of the primary key field in the file attribute information is null, the data import mode is insertion. When the attribute of the primary key field in the file attribute information is a non-null value, matching the primary key field in the target file with the primary key field in the target import table; if the primary key field in the target file is matched with the primary key field in the target import table, the data import mode can be determined to be updating; if the primary key field in the target file does not match the primary key field in the target import table, the data import mode can be determined to be insertion.
It can be understood that when the target import table is a newly created import table or the primary key field in the target import table is different from the primary key field in the target file, the data content in the target file needs to be inserted into the target import table. When the primary key field in the target import table is the same as the primary key field in the target file, the data content in the target file needs to be updated to the target import table.
For example, the data content in the verified target file may be imported into the target import table based on the data import manner, and the data content may be written into the database by the target import table.
When the data import mode is updating, an updating operation can be executed, and the data content in the verified target file is updated to the target import table. When the data import mode is insertion, an insertion operation may be performed to insert the data content in the verified target file into the target import table. And when the number of the data contents in the target import table reaches a preset threshold value, executing the writing operation. The preset threshold may be set according to actual conditions, and the specific value is not limited herein. For example, the preset threshold may be 5000.
To further ensure the privacy and security of the database, the database may be stored in a node of a blockchain.
The data import mode corresponding to the verified target file is determined according to the main key field attribute in the file attribute information, so that the data content in the verified target file can be flexibly imported into the target import table on the basis of the data import mode.
In some embodiments, importing the data content in the verified target file into the database based on the target import table, which may further include: acquiring import progress information of data contents in a target file, and displaying the import progress information; and when the import progress information does not reach the preset progress value within the preset time, stopping importing the file and recording abnormal file import information in the log. Wherein, the file import exception information may be a data import timeout.
Illustratively, the import progress information may be displayed by way of a progress bar. By displaying the import progress information, the user can more intuitively know the progress of data import.
In some embodiments, after importing the data content in the verified target file into the database based on the target import table, the method may further include: acquiring operation execution information in a file import parameter object; and executing the operation corresponding to the operation execution information.
Illustratively, when the operation execution information is a send mail notification, the send mail notification is sent to the developer. And when the operation execution information is the short message notification, sending the short message notification to the developer. When the operation execution information is null, no operation is executed.
In the data importing method provided by the embodiment, the file importing parameter object is acquired, and then the data content in the target file can be imported into the database based on the file importing parameter object without paying attention to the type and specific data content of the file; by carrying out file query and database connection according to the file import parameter object, whether a target file is obtained by query and whether the database is normally connected can be determined, and the follow-up normal data import operation can be ensured; by performing parameter verification on the file import parameter object, whether the file import parameter object has parameter errors or not can be determined, so that the probability of abnormity in the subsequent data import of the file import parameter object can be reduced, and the efficiency of data import is improved; by creating the second import table, the data content in the target file can be imported into the database through the created second import table under the condition that the first import table does not exist in the database, so that the probability of successful data import is improved; by verifying the target file according to the file verification strategy, the validity of the data content in the target file can be ensured, unnecessary data content is prevented from being imported, the format of the imported data is unified, and the efficiency of data import is improved; the data content in the target file is imported into the database based on the target import table, so that the data content of different types of files can be imported in batches, and the data import efficiency is improved; the data import mode corresponding to the verified target file is determined according to the main key field attribute in the file attribute information, so that the data content in the verified target file can be flexibly imported into the target import table on the basis of the data import mode.
Referring to fig. 4, fig. 4 is a schematic block diagram of a data importing apparatus 1000 according to an embodiment of the present application, the data importing apparatus being configured to perform the foregoing data importing method. The data importing device may be configured in a server or a terminal.
As shown in fig. 4, the data importing apparatus 1000 includes: an object acquisition module 1001, an import table determination module 1002, and a data content import module 1003.
The object obtaining module 1001 is configured to obtain a file import parameter object, and perform file query and database connection according to the file import parameter object.
The import table determining module 1002 is configured to determine, when the target file to be imported is obtained through query and the database connection is normal, a target import table corresponding to the target file according to the file import parameter object, where the target import table is an import table in the database.
A data content importing module 1003, configured to import the data content in the target file into the database based on the target import table.
It should be noted that, as will be clear to those skilled in the art, for convenience and brevity of description, the specific working processes of the apparatus and the modules described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The apparatus described above may be implemented in the form of a computer program which is executable on a computer device as shown in fig. 5.
Please refer to fig. 5 and fig. 5 are schematic block diagrams illustrating a computer device according to an embodiment of the present application.
Referring to fig. 5, the computer device includes a processor and a memory connected by a system bus, wherein the memory may include a storage medium and an internal memory. The storage medium may be a nonvolatile storage medium or a volatile storage medium.
The processor is used for providing calculation and control capability and supporting the operation of the whole computer equipment.
The internal memory provides an environment for running a computer program in the non-volatile storage medium, which, when executed by the processor, causes the processor to perform any of the data importing methods.
It should be understood that the Processor may be a Central Processing Unit (CPU), and the Processor may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Wherein, in one embodiment, the processor is configured to execute a computer program stored in the memory to implement the steps of:
acquiring a file import parameter object, and performing file query and database connection according to the file import parameter object; when a target file to be imported is obtained through query and the database is normally connected, determining a target import table corresponding to the target file according to the file import parameter object, wherein the target import table is an import table in the database; and importing the data content in the target file into the database based on the target import table.
In one embodiment, when implementing file query and database connection according to the file import parameter object, the processor is configured to implement:
analyzing the file import parameter object to obtain corresponding file attribute information and database connection information; inquiring files according to the file storage paths in the file attribute information; and establishing connection with a database according to the database connection information.
In one embodiment, the file import parameter object includes file attribute information; when the processor determines the target import table corresponding to the target file according to the file import parameter object, the processor is configured to implement:
querying the database according to the import table name in the file attribute information, and determining whether a first import table corresponding to the import table name exists; if the first import table exists in the database, determining the first import table as the target import table; and if the first import table does not exist in the database, creating a second import table, and determining the second import table as the target import table.
In one embodiment, the processor, when implementing creating the second import table, is configured to implement:
when the attribute value of a first row in the file attribute information is a preset value, acquiring a first row and column field in the target file; and adding the first row and column fields to an initial data table to obtain the second import table.
In one embodiment, the processor, before implementing importing the data content in the target file into the database based on the target import table, is further configured to implement:
extracting a file verification strategy in the file import parameter object; and verifying the target file according to the file verification strategy to obtain the verified target file.
In one embodiment, the processor, when implementing importing the data content in the target file into the database based on the target import table, is configured to implement:
and importing the data content in the verified target file into the database based on the target import table.
In one embodiment, the file import parameter object includes file attribute information; when the processor is used for importing the data content in the verified target file into the database based on the target import table, the processor is used for realizing that:
determining a data import mode corresponding to the verified target file according to the primary key field attribute in the file attribute information; and importing the data content in the verified target file into the target import table based on the data import mode, and writing the data content into the database by the target import table.
In one embodiment, before implementing file query and database connection according to the file import parameter object, the processor is further configured to implement:
and performing parameter verification on the file import parameter object to obtain the file import parameter object after the parameter verification.
In one embodiment, when implementing file query and database connection according to the file import parameter object, the processor is configured to implement:
and importing the parameter object according to the file after the parameter verification to perform file query and database connection.
The embodiment of the application also provides a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, the computer program comprises program instructions, and the processor executes the program instructions to realize any data importing method provided by the embodiment of the application.
For example, the program is loaded by a processor and may perform the following steps:
acquiring a file import parameter object, and performing file query and database connection according to the file import parameter object; when a target file to be imported is obtained through query and the database is normally connected, determining a target import table corresponding to the target file according to the file import parameter object, wherein the target import table is an import table in the database; and importing the data content in the target file into the database based on the target import table.
The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital Card (SD Card), a Flash memory Card (Flash Card), and the like provided on the computer device.
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a string of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, which is used for verifying the validity (anti-counterfeiting) of the information and generating a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A data import method, comprising:
acquiring a file import parameter object, and performing file query and database connection according to the file import parameter object;
when a target file to be imported is obtained through query and the database is normally connected, determining a target import table corresponding to the target file according to the file import parameter object, wherein the target import table is an import table in the database;
and importing the data content in the target file into the database based on the target import table.
2. The data import method according to claim 1, wherein the performing file query and database connection according to the file import parameter object includes:
analyzing the file import parameter object to obtain corresponding file attribute information and database connection information;
inquiring files according to the file storage paths in the file attribute information;
and establishing connection with a database according to the database connection information.
3. The data import method according to claim 1, wherein the file import parameter object includes file attribute information; the determining a target import table corresponding to the target file according to the file import parameter object includes:
querying the database according to the import table name in the file attribute information, and determining whether a first import table corresponding to the import table name exists;
if the first import table exists in the database, determining the first import table as the target import table;
and if the first import table does not exist in the database, creating a second import table, and determining the second import table as the target import table.
4. The data import method of claim 3, wherein the creating the second import table comprises:
when the attribute value of a first row in the file attribute information is a preset value, acquiring a first row and column field in the target file;
and adding the first row and column field to an initial data table to obtain the second import table.
5. The data import method according to claim 1, wherein before importing the data content in the target file into the database based on the target import table, the method further comprises:
extracting a file verification strategy in the file import parameter object;
verifying the target file according to the file verification strategy to obtain a verified target file;
the importing, based on the target import table, the data content in the target file into the database includes:
and importing the data content in the verified target file into the database based on the target import table.
6. The data import method according to claim 5, wherein the file import parameter object includes file attribute information; the importing the data content in the verified target file into the database based on the target import table includes:
determining a data import mode corresponding to the verified target file according to the primary key field attribute in the file attribute information;
and importing the data content in the verified target file into the target import table based on the data import mode, and writing the data content into the database by the target import table.
7. The data import method according to any one of claims 1 to 6, wherein before performing the file query and the database connection according to the file import parameter object, the method further comprises:
performing parameter verification on the file import parameter object to obtain a file import parameter object after the parameter verification;
the file query and database connection according to the file import parameter object comprises:
and importing the file into the parameter object according to the verified file to perform file query and database connection.
8. A data importing apparatus, comprising:
the object acquisition module is used for acquiring a file import parameter object, and performing file query and database connection according to the file import parameter object;
the import table determining module is used for determining a target import table corresponding to the target file according to the file import parameter object when the target file to be imported is obtained through query and the database is normally connected, wherein the target import table is an import table in the database;
and the data content import module is used for importing the data content in the target file into the database based on the target import table.
9. A computer device, wherein the computer device comprises a memory and a processor;
the memory for storing a computer program;
the processor, configured to execute the computer program and to implement the data import method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, causes the processor to implement the data import method according to any one of claims 1 to 7.
CN202210243407.1A 2022-03-11 2022-03-11 Data import method and device, computer equipment and storage medium Pending CN114637801A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210243407.1A CN114637801A (en) 2022-03-11 2022-03-11 Data import method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210243407.1A CN114637801A (en) 2022-03-11 2022-03-11 Data import method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114637801A true CN114637801A (en) 2022-06-17

Family

ID=81948705

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210243407.1A Pending CN114637801A (en) 2022-03-11 2022-03-11 Data import method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114637801A (en)

Similar Documents

Publication Publication Date Title
US10904009B2 (en) Blockchain implementing delta storage
US11018853B2 (en) Workflow management via distributed ledgers and smart contracts
CN112035472B (en) Data processing method, device, computer equipment and storage medium
CN112565393B (en) File uploading method, downloading method, device, computer equipment and storage medium
CN110543516A (en) Intelligent contract processing method and device, computer equipment and storage medium
US20120151036A1 (en) Identifying stray assets in a computing enviroment and responsively taking resolution actions
CN112150113A (en) Method, device and system for borrowing file data and method for borrowing data
CN110598996A (en) Risk processing method and device, electronic equipment and storage medium
CN111339551B (en) Data verification method and related device and equipment
CN113434582B (en) Service data processing method and device, computer equipment and storage medium
CN111782456A (en) Anomaly detection method and device, computer equipment and storage medium
WO2022116761A1 (en) Self auditing blockchain
CN112363997B (en) Data version management method, device and storage medium
US20180069774A1 (en) Monitoring and reporting transmission and completeness of data upload from a source location to a destination location
CN111641715A (en) Data processing method, device, equipment and medium based on block chain
CN114637801A (en) Data import method and device, computer equipment and storage medium
CN114157662B (en) Cloud platform parameter adaptation method, device, terminal equipment and storage medium
CN115567218A (en) Data processing method and device of security certificate based on block chain and server
CN114979109A (en) Behavior track detection method and device, computer equipment and storage medium
CN113722225A (en) Page testing method and device, computer equipment and storage medium
CN113592645A (en) Data verification method and device
CN112350868A (en) Wall opening processing method, device, server, system and readable storage medium
CN112286881A (en) Document authentication and tracing method and device
CN111698227A (en) Information synchronization management method, device, computer system and readable storage medium
US20230239153A1 (en) System and method for digital proof generation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination