CN114637744A - Database processing method and device, electronic equipment and storage medium - Google Patents

Database processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114637744A
CN114637744A CN202210152103.4A CN202210152103A CN114637744A CN 114637744 A CN114637744 A CN 114637744A CN 202210152103 A CN202210152103 A CN 202210152103A CN 114637744 A CN114637744 A CN 114637744A
Authority
CN
China
Prior art keywords
database
rule
tables
dividing
dynamic
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
CN202210152103.4A
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.)
Shenzhen Lenovo Connect Co ltd
Original Assignee
Shenzhen Lenovo Connect 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 Shenzhen Lenovo Connect Co ltd filed Critical Shenzhen Lenovo Connect Co ltd
Priority to CN202210152103.4A priority Critical patent/CN114637744A/en
Publication of CN114637744A publication Critical patent/CN114637744A/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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof

Abstract

The application provides a database processing method, a database processing device, electronic equipment and a storage medium; the method comprises the following steps: acquiring a sub-table rule; in response to a database not satisfying the sub-table rule, determining a type of the sub-table rule; creating a table in the database based on the type of the table partitioning rule. By the method and the device, the table can be automatically created in the database according to the table dividing rule of the database, and the data processing efficiency of the database is improved.

Description

Database processing method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of data processing, and in particular, to a database processing method and apparatus, an electronic device, and a storage medium.
Background
With the rapid development and wide use of databases, people gradually become the mainstream of database applications by using tables in the databases to store data. However, when the tables in the database cannot meet the requirement of storing data in the using process of the database, the database needs to stop service reconfiguration and create the tables, and people hope that the database can continuously serve and automatically create the tables meeting the requirement of storing data.
Therefore, how to intelligently create tables in a database to improve the data processing efficiency of the database is a constantly sought-after goal.
Disclosure of Invention
The embodiment of the application provides a database processing method and device, electronic equipment and a storage medium.
According to a first aspect of the present application, there is provided a database processing method, the method including: acquiring a sub-table rule; in response to a database not satisfying the sub-table rule, determining a type of the sub-table rule; creating a table in the database based on the type of the table partitioning rule.
According to an embodiment of the present application, after the sub-table rule is obtained, the method further includes: acquiring all table dividing rules of the existing table in the database; and judging whether the existing tables in the database meet the requirements of all the table dividing rules or not based on all the table dividing rules.
According to an embodiment of the present application, the determining the type of the table division rule includes: and determining the type of the table division rule according to the configuration items in the configuration file of the database, and determining a table building template corresponding to the table division rule.
According to an embodiment of the present application, the creating a table in the database based on the type of the table division rule includes: under the condition that the type of the table dividing rule is determined to be a dynamic table dividing rule, a required table in the database is created based on the dynamic table dividing rule of the required table in the database and the table building template; and determining the table in which the data in the database is to be written or read according to the first type field data of the required table.
According to an embodiment of the present application, the creating a table in the database based on the type of the table division rule includes: under the condition that the type of the table dividing rule is determined to be a fixed table dividing rule, a required table in the database is created based on the fixed table dividing rule of the required table in the database and the table building template; and determining the table in which the data in the database is to be written or read according to the second type field data of the required table.
According to an embodiment of the present application, the creating a table required in the database based on the fixed table splitting rule and the table creation template of the table required in the database includes: determining the second type field data in the database based on the fixed sub-table rule; creating all required tables in the database which meet the requirement of the fixed table dividing rule based on the second type field data and the table building template of the required tables in the database; the second type field data is preset field data.
According to an embodiment of the present application, the determining whether the existing table in the database meets the requirement of the table splitting rule based on all the table splitting rules includes: determining the first type field data in the database based on the dynamic table partitioning rule; creating all required tables in the database which meet the requirements of the dynamic table dividing rule based on the first type field data and the table building template of the required tables in the database; the first type field data is preset time type field data.
According to an embodiment of the present application, the creating all the tables required in the database that meet the requirements of the dynamic table partitioning rule based on the first type field data and the table creation template of the required tables in the database includes: and creating all the required tables meeting the requirements of the dynamic table dividing rule at preset time based on the first type field data and the table creating template.
According to an embodiment of the present application, the determining whether the existing table in the database meets the requirements of all the table-splitting rules based on all the table-splitting rules includes: judging whether the existing table in the database meets the requirement of a dynamic table dividing rule at a preset moment; under the condition that the existing table in the database meets the requirement of the dynamic table dividing rule, storing the table information of the existing table; and under the condition that the existing tables in the database do not meet the requirements of the dynamic table dividing rule, determining the dynamic table dividing rule and the table building template of the required tables in the database.
According to a second aspect of the present application, there is provided a database processing apparatus comprising: the acquisition module is used for acquiring the sub-table rules; the determining module is used for responding to the situation that the database does not meet the table dividing rule and determining the type of the table dividing rule; a creating module for creating a table in the database based on the type of the table division rule.
According to a third aspect of the present application, there is provided an electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the method described herein.
According to a fourth aspect of the present application, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method described herein.
The method of the embodiment of the application acquires the sub-table rule; in response to a database not satisfying the sub-table rule, determining a type of the sub-table rule; creating a table in the database based on the type of the table partitioning rule. Therefore, the table can be intelligently created in the database according to the table division rule of the database, and the data processing efficiency of the database is improved.
It is to be understood that the teachings of this application need not achieve all of the above-described benefits, but rather that specific embodiments may achieve specific technical results, and that other embodiments of this application may achieve benefits not mentioned above.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present application will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the present application are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
in the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
FIG. 1 is a schematic diagram illustrating an alternative processing flow of a database processing method according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram illustrating an alternative processing flow of a database processing method provided in an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating a further alternative processing flow of a database processing method according to an embodiment of the present application;
FIG. 4 is a schematic diagram illustrating yet another alternative processing flow of a database processing method provided by an embodiment of the present application;
fig. 5 is an application scenario diagram illustrating a database processing method provided by an embodiment of the present application;
fig. 6 is a diagram illustrating another application scenario of the database processing method according to an embodiment of the present application;
FIG. 7 is an alternative diagram of a data processing apparatus provided by an embodiment of the present application;
FIG. 8 is a schematic diagram of an alternative data processing apparatus according to an embodiment of the present application;
fig. 9 shows a schematic structural diagram of the electronic device provided in the embodiment of the present application.
Detailed Description
In order to make the objects, features and advantages of the present application more obvious and understandable, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. 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.
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict.
In the following description, references to the terms "first", "second", and the like, are only to distinguish similar objects and do not denote a particular order, but rather the terms "first", "second", and the like may be used interchangeably with the order specified, where permissible, to enable embodiments of the present application described herein to be practiced otherwise than as specifically illustrated or described herein.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the application.
Before further detailed description of the embodiments of the present application, terms and expressions referred to in the embodiments of the present application will be described, and the terms and expressions referred to in the embodiments of the present application will be used for the following explanation.
1) A database, which is a repository that organizes, stores, and manages data according to a data structure. Is an organized, sharable, uniformly managed collection of large amounts of data that is stored long term within a computer. Common databases are: DB2, Oracle, Informix, Sybase, SQL Server, PostgreSQL, mySQL, access, mongodb.
2) Field data, which represents variables associated with an object or class. In the database, each field data contains information of a certain topic. The field data types may include: VARCHAR, CHAR, TEXT, INTEGER, and BIGINT. VARCHAR, representing a variable-length string with a maximum string length n; CHAR, representing a string of fixed string length n; TEXT, used for storing TEXT strings. INTEGER, which represents an exact number with a precision of 10 and a decimal digit of 0. Big, representing an exact number with an accuracy of 19 or an exact number with an accuracy of 20 and a decimal number of 0.
3) Time type field data, in the database, each time type field data contains information of a certain time, and the time type field data types may include: DATE, DATETIME, TIMESTAMP and DATE data in accordance with the GB/T7408-2005 standard stored as VARCHAR type. The DATE is DATE type data which is used for representing fields of year, month and day and accords with DATE information of a gregorian calendar rule; DATETIME, a value that indicates that both date and time information needs to be included; TIMESTAMP, representing year, month, day, hour, minute, and second fields, have valid values defined for the DATE and TIME data types.
In the related art, the currently known technical solutions for database processing cannot continuously create tables in the database during the database processing. Currently, the database is created according to rules in advance during project design. When data are stored according to time type field data, a certain time length can only be configured backwards with a certain time node as a starting point in advance, and a correlation table is created based on a rule configured in advance, for example: TB _ XXXX _ 202101-TB _ XXXX _202112 tables, TB _ XXXX _ 202101-TB _ XXXX _202112 tables can only store the field data according to the month type in the time interval from 1 month in 2021 to 12 months in 2021, when the date reaches the configured maximum time or needs to be according to the field data of other time types, the rules are reconfigured and the related tables are created; for example: it is necessary to stop the service of the database, reconfigure the rules and create the relevant tables when the date reaches 2022 year 1 month or stop the service of the database, reconfigure the rules and create the relevant tables based on the reconfigured rules when the database needs to store data every hour of 2021 year 2 month 1 day. In the related technology, tables cannot be automatically and continuously created in the database processing process, so that the problem of low database processing efficiency occurs.
Aiming at the problem that tables cannot be intelligently created in a database and the processing efficiency of the database is low by the database processing method provided by the related technology, the method of the embodiment of the application acquires the sub-table rule; in response to a database not satisfying the sub-table rule, determining a type of the sub-table rule; creating a table in the database based on the type of the table partitioning rule. In the embodiment of the application, the database can automatically create the table according to the table dividing rule without stopping the service of the database. Therefore, the problem that the table cannot be intelligently created in the database can be solved, meanwhile, the database can be applied to long-term operation, the service scene of the table needs to be continuously added according to the date, the service does not need to be stopped, and the rule is not needed to be reconfigured. Therefore, compared with the prior art that the service of the database needs to be stopped and the rule needs to be reconfigured, the database method can intelligently create the table in the database according to the table dividing rule of the database, and improves the data processing efficiency of the database.
A processing flow in the database processing method provided in the embodiment of the present application is explained. Referring to fig. 1, fig. 1 is a schematic diagram of an alternative processing flow of a database processing method provided in an embodiment of the present application, and will be described with reference to steps S101 to S103 shown in fig. 1.
Step S101, a sub-table rule is obtained.
In some embodiments, the sub-table rules may include: the database can store data meeting the sub-table rules into the tables corresponding to the sub-table rules according to the sub-table rules corresponding to each table; or creating a table in the database according to the table division rule corresponding to each table when the existing table in the database does not meet the requirement of the table division rule. The types of the sub-table rules may include: the fixed sub-table rule and the dynamic sub-table rule may further include other sub-table rules, and the embodiment of the present application is not limited. The fixed table division rule may include determining a table to which data in the database is to be written or a table to which data in the database is to be read, according to preset field data of the table, and the dynamic table division rule may include determining a table to which data in the database is to be written or a table to which data in the database is to be read, according to time type field data of the table.
Step S102, responding to the database not meeting the table dividing rule, and determining the type of the table dividing rule.
In some embodiments, all of the table rules may include table rules corresponding to all of the tables existing in the database. Each table can only correspond to one table division rule, the table division rules corresponding to all the existing tables in the database can comprise a plurality of table division rules and can also comprise the same table division rule, and the embodiment of the application does not limit the types of the specific table division rules. Obtaining all sub-table rules of existing tables in the database may include: and obtaining each sub-table rule corresponding to each existing table in the database until the sub-table rules corresponding to all the existing tables in the database are obtained.
Step S103, creating a table in the database based on the type of the table dividing rule.
In some embodiments, creating a table in the database based on the type of the table splitting rule may include: and judging whether the existing tables in the database can store the data in the database according to all the table division rules according to the table division rules corresponding to all the existing tables in the database, and determining that the existing tables in the database cannot meet the requirements of the table division rules corresponding to all the existing tables under the condition that the existing tables in the database cannot store the data in the database according to the table division rules corresponding to all the existing tables.
In specific implementation, under the condition that an existing table in a database cannot store data in the database according to a dynamic table dividing rule, firstly, a dynamic table dividing rule of a required table in the database can be determined according to a configuration item in a configuration file of the database, and an instruction for operating the database when the required table is created in the database is determined, the dynamic table dividing rule can comprise a table into which data in the database is determined or a table which is read according to time type field data of the table, and the time type field data can comprise information of a certain time which the required table needs to be stored; and then, based on information of a certain time required to be stored in a required table contained in the time type field data and an instruction for operating the database when the required table is created in the database, meets the requirement of a dynamic table dividing rule, and data in the database is written or read into the table according to the dynamic table dividing rule. The configuration file of the database may include files for configuring tables in the database differently, the configuration items in the configuration file of the database may determine the type of the table splitting rule of the required table in the database, and the type of the table splitting rule may include: the fixed sub-table rule and the dynamic sub-table rule may further include other sub-table rules, and the embodiment of the present application is not limited. The fixed table division rule may include determining a table to which data in the database is to be written or a table to which data in the database is to be read, according to preset field data of the table, and the dynamic table division rule may include determining a table to which data in the database is to be written or a table to which data in the database is to be read, according to preset time type field data of the table. The required table can include a table to be created in the database meeting the requirements of the table dividing rule, and the configuration item in the configuration file of the database can also determine a table building template corresponding to the table dividing rule of the required table required when the required table is created. The table building template may include an instruction for operating the database when the database creates a table, may also include an instruction for operating the database when the database creates a table, and may also include an instruction for operating the database when the database creates another table, which is not limited in the embodiment of the present application.
In specific implementation, under the condition that an existing table in a database cannot store data in the database according to a fixed table division rule, firstly, the fixed table division rule of a required table in the database can be determined according to a configuration item in a configuration file of the database, and an instruction for operating the database when the required table is created in the database is determined, the fixed table division rule can comprise a table into which data in the database is determined or a table which is read according to preset field data of the table, and the preset field data can comprise information of a special subject which is required to be stored by the required table; and then, based on information of a special subject required to be stored in a required table contained in the preset field data and an instruction for operating the database when the required table is created, the required table is created in the database, the required table meets a fixed table dividing rule, and data in the database is written or read into the table according to the fixed table dividing rule.
The above description is given for a scenario in which the database does not satisfy the table splitting rule, and for the scenario in which the database satisfies the table splitting rule, when the existing table in the database can store data in the database according to all the table splitting rules, it is determined that the existing table in the database satisfies requirements of all the table splitting rules, and when the existing table in the database can store data in the database according to all the table splitting rules, the table name of the existing table in the database is stored in the storage unit of the database, where the storage unit of the database may include a Random Access Memory (RAM) of the database, and the storage unit of the database may also include other storage media, which is not limited in the embodiment of the present application.
In the embodiment of the application, the dynamic table dividing rule of the required table in the database can be determined according to the configuration items in the configuration file of the database, and the required table is created in the database based on the dynamic table dividing rule and the table creating template. According to the embodiment of the application, under the condition that the existing table in the database meets the requirement of the dynamic table dividing rule, the table information of the existing table is stored based on the dynamic table dividing rule; therefore, the user can conveniently inquire the use table subsequently. Therefore, compared with the prior art that the service of the database needs to be stopped and the rule needs to be reconfigured, the database method can intelligently create the table in the database according to the table dividing rule of the database, and improves the data processing efficiency of the database.
In some embodiments, another optional processing flow of the database processing method, as shown in fig. 2, includes:
step S102a, a sublist rule is obtained.
In some embodiments, the sub-table rules may include: the database can store data meeting the sub-table rules into the tables corresponding to the sub-table rules according to the sub-table rules corresponding to each table; or creating the table in the database according to the table division rule corresponding to each table under the condition that the existing table in the database does not meet the requirement of the table division rule. The types of the sub-table rules may include: the fixed sub-table rule and the dynamic sub-table rule may further include other sub-table rules, and the embodiment of the present application is not limited. The fixed table division rule may include determining a table to which data in the database is to be written or a table to which data in the database is to be read, according to preset field data of the table, and the dynamic table division rule may include determining a table to which data in the database is to be written or a table to which data in the database is to be read, according to preset time type field data of the table.
Step S102b, acquiring all table-splitting rules of the existing table in the database.
In some embodiments, all of the table rules may include table rules corresponding to all of the tables existing in the database. Each table can only correspond to one table division rule, the table division rules corresponding to all the existing tables in the database can comprise various table division rules and can also comprise the same table division rule, and the embodiment of the application does not limit the types of the specific table division rules. Obtaining all table-splitting rules of existing tables in the database may include: and obtaining each sub-table rule corresponding to each existing table in the database until the sub-table rules corresponding to all the existing tables in the database are obtained and finished.
Step S102c, based on all the table-dividing rules, determining whether the existing table in the database meets the requirements of all the table-dividing rules.
In some embodiments, determining whether existing tables in the database meet the requirements of all the table partitioning rules based on the all table partitioning rules may include: judging whether the existing tables in the database can store data in the database according to the table dividing rules corresponding to all the existing tables in the database, and determining that the existing tables in the database cannot meet the requirements of all the table dividing rules under the condition that the existing tables in the database cannot store data in the database according to the table dividing rules corresponding to all the existing tables in the database; and under the condition that the existing tables in the database can store the data in the database according to the table division rules corresponding to all the existing tables in the database, determining that the existing tables in the database meet the requirements of all the table division rules.
Step S102d, responding to the database not meeting the table dividing rule, determining the type of the table dividing rule according to the configuration items in the configuration file of the database, and determining the table building template corresponding to the table dividing rule.
In some embodiments, the configuration file of the database may include files for configuring tables in the database differently, a configuration item in the configuration file of the database may determine a type of a table division rule of a required table in the database, the required table may include a table that needs to be created in the database and meets a requirement of the table division rule, and the configuration item in the configuration file of the database may also determine a table creation template corresponding to the table division rule of the required table, which is needed when the required table is created. The table building template may include an instruction for operating the database when the database creates a table, and an instruction for operating the database when the database creates another table, which is not limited in the embodiment of the present application. In response to that the database does not satisfy the table division rule, determining the type of the table division rule according to the configuration item in the configuration file of the database, and determining the table creation template corresponding to the table division rule may include: in the case that the existing table in the database cannot store the data in the database according to the table division rule, the type of the table division rule of the required table in the database and the instruction for operating the database when the required table is created in the database can be determined according to the configuration item in the configuration file of the database.
Step S102e, in a case that the type of the table division rule is determined to be a dynamic table division rule, determining the first type field data in the database based on the dynamic table division rule.
In some embodiments, the first type field data may include preset time type field data, each of which contains information of a certain time in the database. The first type field data type may include: DATE, DATETIME, TIMESTAMP and DATE data in accordance with the GB/T7408-2005 standard stored as VARCHAR type. The DATE is DATE type data which is used for representing fields of year, month and day and accords with DATE information of a gregorian calendar rule; DATETIME, a value that indicates that both date and time information needs to be included; TIMESTAMP, representing year, month, day, hour, minute and second fields, having valid values defined for the data and TIME data types, the first type field data may also include other TIME type field data types, and the embodiment of the present application is not limited. In a case where the type of the table division rule is determined to be a dynamic table division rule, determining the first type field data in the database based on the dynamic table division rule may include: in a case that the type of the sub-table rule of the table required in the database is determined to be the dynamic sub-table rule according to the configuration items in the configuration file of the database, determining preset time type field data of the table required in the database, where the preset time type field data of each required table includes information of a certain time required to be stored by the required table, and the preset time type field data may include: the time type field data corresponding to the time of the current database and the preset time type field data corresponding to the preset time of the database.
Step S102f, creating all the tables needed in the database that meet the requirement of the dynamic table partitioning rule based on the first type field data and the table creation template of the needed tables in the database.
In some embodiments, creating all required tables in the database that meet the requirements of the dynamic tabulation rule based on the first type field data and the tabulation template of the required tables in the database may include: and creating the required table in the database based on the information of a certain time required to be stored in the required table contained in the preset time type field data and the instruction for operating the database when the required table is created in the database, wherein the required table meets the requirement of a dynamic table dividing rule, and writing or reading the data in the database into the table according to the dynamic table dividing rule.
In specific implementation, the dynamic sub-table rule may include a table for determining data writing or reading according to the field data of the preset time type, such as: according to the specified preset time type field data, in the case where the current time is 12, 16 and 2021 years, data in the month type field data decision database is stored in the TB _ XXX _202112 table. Creating all required tables in the database that meet the requirements of the dynamic table partitioning rule based on the first type field data and the table creation template of the required tables in the database may include: the dynamic sub-table rule corresponding to the table name TB _ XXX is to establish a table according to the year type field data, and the dynamic sub-table rule is based on the year type field data corresponding to the table name TB _ XXX, such as: and instructions for operating the database in 2021 and when the database creates a TB _ XXX table, the TB _ XXX _2021 is created, the TB _ XXX _2021 meets the dynamic table dividing rule, and the database determines the data in the database to be stored in the TB _ XXX _2021 table according to the specified preset time type field data, namely 2021 year.
In the embodiment of the application, the dynamic table dividing rule of the required table in the database can be determined according to the configuration items in the configuration file of the database, and the required table is created in the database based on the dynamic table dividing rule and the table creating template. According to the embodiment of the application, under the condition that the existing table in the database meets the requirement of the dynamic table dividing rule, the table information of the existing table is stored based on the dynamic table dividing rule; thus, the user can conveniently use the table for subsequent inquiry. Therefore, compared with the prior art that the service of the database needs to be stopped and the rule needs to be reconfigured, the database method can intelligently create the table in the database according to the table dividing rule of the database, and improves the data processing efficiency of the database.
In some embodiments, a further alternative processing flow of the database processing method, as shown in fig. 3, includes:
step S102g, a sublist rule is obtained.
In some embodiments, the sub-table rules may include: the database can store data meeting the sub-table rules into the tables corresponding to the sub-table rules according to the sub-table rules corresponding to each table; or creating a table in the database according to the table division rule corresponding to each table when the existing table in the database does not meet the requirement of the table division rule. The types of the sub-table rules may include: the fixed sub-table rule and the dynamic sub-table rule may further include other sub-table rules, and the embodiment of the present application is not limited. The fixed table division rule may include determining a table to which data in the database is to be written or a table to which data in the database is to be read, based on field data of the table, and the dynamic table division rule may include determining a table to which data in the database is to be written or a table to which data in the database is to be read, based on preset time type field data of the table.
Step S102h, acquiring all table-splitting rules of the existing table in the database.
In some embodiments, all of the table rules may include table rules corresponding to all of the tables existing in the database. Each table can only correspond to one table division rule, the table division rules corresponding to all the existing tables in the database can comprise various table division rules and can also comprise the same table division rule, and the embodiment of the application does not limit the types of the specific table division rules. Obtaining all sub-table rules of existing tables in the database may include: and obtaining each sub-table rule corresponding to each existing table in the database until the sub-table rules corresponding to all the existing tables in the database are obtained.
Step S102i, based on all the table-dividing rules, determining whether the existing table in the database meets the requirements of all the table-dividing rules.
In some embodiments, determining whether existing tables in the database meet the requirements of all the table partitioning rules based on the all table partitioning rules may include: judging whether the existing tables in the database can store data in the database according to the table dividing rules corresponding to all the existing tables in the database, and determining that the existing tables in the database cannot meet the requirements of all the table dividing rules under the condition that the existing tables in the database cannot store data in the database according to the table dividing rules corresponding to all the existing tables in the database; and under the condition that the existing table in the database can store the data in the database according to the table division rules corresponding to all the existing tables in the database, determining that the existing table in the database meets the requirements of all the table division rules.
Step S102j, responding to the database not meeting the table dividing rule, determining the type of the table dividing rule according to the configuration items in the configuration file of the database, and determining the table building template corresponding to the table dividing rule.
In some embodiments, the configuration file of the database may include files for configuring tables in the database differently, a configuration item in the configuration file of the database may determine a type of a table division rule of a required table in the database, the required table may include a table that needs to be created in the database and meets a requirement of the table division rule, and the configuration item in the configuration file of the database may also determine a table creation template corresponding to the table division rule of the required table, which is needed when the required table is created. The table building template may include an instruction for operating the database when the database creates a table, and an instruction for operating the database when the database creates another table, which is not limited in the embodiment of the present application. In response to that the database does not satisfy the table division rule, determining the type of the table division rule according to the configuration item in the configuration file of the database, and determining the table creation template corresponding to the table division rule may include: in the case that the existing table in the database cannot store the data in the database according to the table division rule, the type of the table division rule of the required table in the database and the instruction for operating the database when the required table is created in the database can be determined according to the configuration item in the configuration file of the database.
Step S102k, when it is determined that the type of the sub-table rule is a fixed sub-table rule, determining the second type field data in the database based on the fixed sub-table rule.
In some embodiments, the second type field data may include preset field data, where each preset field data in the database contains information of a certain topic that the database needs to store. The second type field data type may include: VARCHAR, CHAR, TEXT, INTEGER, and BIGINT. VARCHAR, representing a variable length string having a maximum string length n; CHAR, representing a string of fixed string length n; TEXT, used for storing TEXT strings. INTEGER, which represents an exact number with a precision of 10 and a decimal digit of 0. The digit indicates an accurate value with an accuracy of 19 or an accurate value with an accuracy of 20 and a decimal digit of 0, and the second type field data may also include other data types, which is not limited in the embodiments of the present application. In a case where the type of the table division rule is determined to be a fixed table division rule, determining the second type field data in the database based on the fixed table division rule may include: and under the condition that the type of the branch table rule of the required table in the database is determined to be a fixed branch table rule according to the configuration items in the configuration file of the database, determining preset field data of the required table in the database, wherein the preset field data of each required table contains information of a special subject required to be stored by the required table.
Step S102l, creating all the required tables in the database that meet the requirement of the fixed sub-table rule based on the second type field data and the table creation template of the required tables in the database.
In some embodiments, creating all required tables in the database that meet the fixed sub-table rule requirement based on the second type field data and the table creation template of the required tables in the database may include: the method comprises the steps of creating a required table in a database based on information of a special subject required to be stored in the required table contained in preset field data and an instruction for operating the database when the required table is created in the database, wherein the required table meets the requirement of a fixed table dividing rule, and writing or reading data in the database into the table according to the fixed table dividing rule.
In a specific implementation, the fixed sub-table rule may include a table for performing an operation to determine data writing or reading according to the preset field data, such as: the data in the TB _ XXX _ 0-TB _ XXX _9 table are determined according to the specified default field data and 10 remainders. Creating all required tables in the database that meet the fixed sub-table rule requirement based on the second type field data and the table creation template of the required tables in the database may include: the method comprises the steps of creating tables TB _ XXX _ 0-TB _ XXX _9 based on information of a special subject required to be stored in a required table contained in specified preset field data and an instruction for operating the database when the database creates the tables TB _ XXX _ 0-TB _ XXX _9, wherein the tables TB _ XXX _ 0-TB _ XXX _9 meet a fixed table division rule, and determining data in the database to be stored in the tables TB _ XXX _ 0-TB _ XXX _9 according to the specified preset field data and 10 surplus.
In the embodiment of the application, the fixed table dividing rule of the table required in the database can be determined according to the configuration items in the configuration file of the database, and the required table is created in the database based on the fixed table dividing rule and the table building template, so that the database can create all tables required by the database at one time, the database can automatically create the tables according to the table dividing rule, the service of the database is not required to be stopped, meanwhile, the database can be applied to long-term operation, and the service scene of the table is required to be continuously added according to the date. According to the embodiment of the application, the table information of the existing table is stored based on the fixed table dividing rule under the condition that the existing table in the database meets the requirement of the fixed table dividing rule; thus, the user can conveniently use the table for subsequent inquiry. Therefore, compared with the prior art that the service of the database needs to be stopped and the rule needs to be reconfigured, the database method can intelligently create the table in the database according to the table dividing rule of the database, and improves the data processing efficiency of the database.
In some embodiments, a further optional processing flow of the database processing method, as shown in fig. 4, includes:
step S102m, determining whether the existing table in the database meets the requirement of the dynamic table-splitting rule at a preset time.
In some embodiments, the preset time may include: the time set by the user may be any time set by any user, and the embodiment of the present application is not limited to a specific time. Judging whether the existing table in the database meets the requirement of the dynamic table dividing rule at a preset time may include: at a preset moment, judging whether the existing tables created according to the dynamic table dividing rules in the database can store data in the database according to the dynamic table dividing rules or not according to the dynamic table dividing rules corresponding to all the existing tables created according to the dynamic table dividing rules in the database, and determining that the existing tables in the database cannot meet the requirements of the dynamic table dividing rules under the condition that the existing tables in the database cannot store the data in the database according to the dynamic table dividing rules; and under the condition that the existing table in the database can store the data in the database according to the dynamic table dividing rule, determining that the existing table in the database meets the requirement of the dynamic table dividing rule.
Step S102n, when the existing table in the database meets the requirement of the dynamic table splitting rule, storing the table information of the existing table.
In some embodiments, the table information may include: the table name may also include other table information, and the embodiment of the present application is not limited. In the case that an existing table in the database meets the requirement of the dynamic table splitting rule, storing table information of the existing table may include: in a case that an existing table in the database can store data in the database according to a dynamic table partitioning rule, a table name of the existing table in the database is stored in a storage unit of the database, the storage unit of the database may include a Random Access Memory (RAM) of the database, and the storage unit of the database may further include other storage media, which is not limited in the embodiment of the present application.
Step S102 n', in case that the existing table in the database does not meet the requirement of the dynamic table dividing rule, determining the dynamic table dividing rule and the table creating template of the table required in the database.
In some embodiments, the configuration file of the database may include files for performing different configurations on tables in the database, a configuration item in the configuration file of the database may determine a dynamic table partitioning rule of a required table in the database, the required table may include a table that needs to be created in the database and meets a requirement of the dynamic table partitioning rule, and the configuration item in the configuration file of the database may also determine a table creation template corresponding to the table partitioning rule of the required table, which is needed when the required table is created. The table building template may include an instruction for operating the database when the database creates a table, and an instruction for operating the database when the database creates another table, which is not limited in the embodiment of the present application. In the case that existing tables in the database do not meet the requirements of the dynamic table partitioning rule, determining the dynamic table partitioning rule and the table building template for the required tables in the database may include: under the condition that the existing tables in the database can not store the data in the database according to the dynamic table dividing rule, the dynamic table dividing rule of the required table in the database and the instruction for operating the database when the required table is created in the database can be determined according to the configuration items in the configuration file of the database.
Step S102o, determining the first type field data in the database based on the dynamic table partitioning rule.
In some embodiments, determining the first type field data in the database based on the dynamic tabulation rule may include: in a case that the type of the sub-table rule of the table required in the database is determined to be the dynamic sub-table rule according to the configuration items in the configuration file of the database, determining preset time type field data of the table required in the database, where the preset time type field data of each required table includes information of a certain time required to be stored by the required table, and the preset time type field data may include: the time type field data corresponding to the time of the current database and the preset time type field data corresponding to the preset time of the database.
Step S102p, creating all the required tables meeting the requirements of the dynamic table partitioning rule at a preset time based on the first type field data and the table creation template.
In some embodiments, creating all of the required forms that satisfy the requirements of the dynamic tabulation rule at a preset time based on the first type field data and the tabulation template may include: and at a preset moment, creating a required table in the database based on information of a certain time required to be stored in the required table contained in the preset time type field data and an instruction for operating the database when the required table is created, wherein the required table meets the requirement of a dynamic table dividing rule, and writing or reading data in the database into the table according to the dynamic table dividing rule.
In specific implementation, the dynamic sub-table rule may include a table for determining data writing or reading according to the field data of the preset time type, such as: according to the specified preset time type field data, when the preset time is 2021, 12, month, 16, 23, and 50 minutes, the data in the database is determined to be stored in the TB _ XXX _20211217 table according to the date type field data. Creating all required tables in the database that meet the requirements of the dynamic table partitioning rule based on the first type field data and the table creation template of the required tables in the database may include: the dynamic sub-table rule corresponding to the table name TB _ XXX is to establish a table according to date type field data, and the dynamic sub-table rule is based on the date type field data corresponding to the table name TB _ XXX, such as: and 7, 12/17 th in 2021 and instructions for operating the database when the database creates a TB _ XXX table, wherein the creation table TB _ XXX _20211217 and TB _ XXX _20211217 meet the dynamic table dividing rule, and the database determines that the data in the database is stored in the TB _ XXX _20211217 table according to the specified field data of the preset time type, namely, the data in the 12/17 th in 2021.
The method of the embodiment of the application judges whether the existing table in the database meets the requirement of the dynamic table dividing rule at a preset moment, if not, the dynamic table dividing rule of the table needed in the database is determined according to the configuration items in the configuration file of the database, and then the needed table is created in the database based on the dynamic table dividing rule and the table building template; therefore, the database can automatically judge whether the tables in the database meet the requirements of the table dividing rule at a preset moment, and automatically generate the tables needing to store data when the database is in a preset time in advance under the condition that the tables do not meet the requirements, so that the data processing efficiency of the database is improved, the service of the database is not required to be stopped, meanwhile, the database can be applied to long-term operation, and the service scene that the tables are required to be continuously added according to dates is realized. According to the embodiment of the application, under the condition that the existing table in the database meets the requirement of the dynamic table dividing rule, the table information of the existing table is stored based on the dynamic table dividing rule; thus, the user can conveniently use the table for subsequent inquiry. Therefore, compared with the prior art that the service of the database needs to be stopped and the rule needs to be reconfigured, the database method can intelligently create the table in the database according to the table dividing rule of the database, and improves the data processing efficiency of the database.
Fig. 5 is an application scenario diagram illustrating a database processing method according to an embodiment of the present application.
Referring to fig. 5, in an application scenario of the database processing method provided in the embodiment of the present application, first, an application program of a database is started; reading a table division rule in a configuration file of the database, wherein the table division rule comprises the following steps: the database can store data meeting the sub-table rules into the tables corresponding to the sub-table rules according to the sub-table rules corresponding to each table, and can also create tables in the database according to the sub-table rules corresponding to each table under the condition that the existing tables in the database do not meet the requirements of the sub-table rules. The types of the sub-table rules may include: the fixed sub-table rule and the dynamic sub-table rule may further include other sub-table rules, and the embodiment of the present application is not limited. The fixed table division rule may include determining a table to which data in the database is to be written or a table to which data in the database is to be read according to preset field data of the table, and the dynamic table division rule may include determining a table to which data in the database is to be written or a table to which data in the database is to be read according to preset time type field data of the table; acquiring each sub-table rule corresponding to each existing table in the database until the sub-table rules corresponding to all the existing tables in the database are acquired; according to the table rules corresponding to all the existing tables in the database, whether the existing tables in the database can store data in the database according to all the table rules is judged, under the condition that the existing tables in the database can store data in the database according to all the table rules, the existing tables in the database are determined to meet the requirements of all the table rules, under the condition that the existing tables in the database can store data in the database according to all the table rules, the table names of the existing tables in the database are stored in a storage unit of the database, the storage unit of the database can comprise a Random Access Memory (RAM) of the database, the storage unit of the database can also comprise other storage media, and the embodiment of the application is not limited; determining that the existing table in the database can not meet the requirements of all table dividing rules under the condition that the existing table in the database can not store data in the database according to all table dividing rules; under the condition that the existing table in the database can not store the data in the database according to the dynamic table dividing rule, firstly, the dynamic table dividing rule of the required table in the database can be determined according to the configuration items in the configuration file of the database, and the instruction for operating the database when the required table is created by the database is determined, the dynamic table dividing rule can comprise the step of determining the table to be written into or read from the database according to the time type field data of the table, and the time type field data can comprise the information of a certain time required to be stored by the required table; then, based on information of a certain time required to be stored in a required table contained in the time type field data and an instruction for operating the database when the required table is created in the database, meets the requirement of a dynamic table dividing rule, and data in the database are written or read into the table according to the dynamic table dividing rule; under the condition that the existing table in the database can not store data in the database according to the fixed table division rule, firstly, the fixed table division rule of a required table in the database can be determined according to configuration items in a configuration file of the database, and an instruction for operating the database when the required table is created in the database is determined, the fixed table division rule can comprise a table into which data in the database is written or a table which is read according to preset field data of the table, and the preset field data can comprise information of a special subject which is required to be stored by the required table; and then, based on information of a special subject required to be stored in a required table contained in the preset field data and an instruction for operating the database when the required table is created in the database, the required table meets the requirement of a fixed table dividing rule, data in the database is written or read into the table according to the fixed table dividing rule, and finally, the table name of the table meeting the table dividing rule is stored in a storage unit of the database, so that the process is ended.
It is understood that the application scenario of the database processing method in fig. 5 is only a partial exemplary implementation manner in the embodiment of the present application, and the application scenario of the database processing method in the embodiment of the present application includes, but is not limited to, the application scenario of the database processing method shown in fig. 5.
Fig. 6 shows another application scenario diagram of the database processing method provided in the embodiment of the present application.
Referring to fig. 6, in another application scenario of the database processing method provided in the embodiment of the present application, a timing task is first started at a preset time, where the preset time may include: the time set by the user can be any time set by any user, the embodiment of the application is not limited to specific time, and the default preset time is 23 hours and 50 minutes every day. Starting a timing task for 50 minutes at a preset time of 2021, 12 months, 16 days and 23 days, and reading a dynamic table dividing rule in a configuration file of a database; acquiring each dynamic sub-table rule corresponding to each existing table created according to the dynamic sub-table rule in the database until the dynamic sub-table rules corresponding to all the existing tables created according to the dynamic sub-table rule in the database are acquired; the data in the data base is determined by date type field data and stored in a TB _ XXX _20211217 table. Judging whether an existing table created according to a dynamic table dividing rule in a database has a TB _ XXX _20211217 table or not, storing data in the database according to the dynamic table dividing rule, and determining that the existing table in the database does not meet the requirement of the dynamic table dividing rule under the condition that the existing table in the database does not have the TB _ XXX _20211217 table, and storing the data in the database according to the dynamic table dividing rule; when the existing table in the database has TB _ XXX _20211217 table, storing the data in the database according to the dynamic table dividing rule, determining that the existing table in the database meets the requirement of the dynamic table dividing rule; storing the table name of a TB _ XXX _20211217 table in a database into a storage unit of the database in the case that a TB _ XXX _20211217 table exists in an existing table in the database and stores data in the database according to a dynamic partitioning rule, wherein the storage unit of the database may include a Random Access Memory (RAM) of the database, determining the dynamic partitioning rule of the TB _ XXX _20211217 table in the database according to a configuration item in a configuration file of the database in the case that the TB _ XXX _20211217 table does not exist in the existing table in the database and stores data in the database according to the dynamic partitioning rule, and determining an instruction for operating the database when the TB _ XXX _20211217 table is created in the database; in the case that the type of the sub-table rule of the required tables in the database is determined to be a dynamic sub-table rule according to the configuration items in the configuration file of the database, date type field data of TB _ XXX _20211217 tables in the database is determined, and the preset time type field data of each required table contains information of a certain time required to be stored by the required table, and the preset time type field data may include: time type field data corresponding to the time of the current database and preset time type field data corresponding to the preset time of the database; the dynamic sub-table rule corresponding to the table name TB _ XXX is to establish a table according to date type field data, and based on the date type field data corresponding to the table name TB _ XXX: and (3) an instruction for operating the database when the database creates a TB _ XXX table in 12 months and 17 days in 2021, creating a table TB _ XXX _20211217, wherein TB _ XXX _20211217 meets a dynamic table dividing rule, the database determines data in the database according to specified field data of preset time types, namely the data in the table in 12 months and 17 days in 2021 and stores the data in the TB _ XXX _20211217 table, and finally, all table names meeting the dynamic table dividing rule table are stored in a storage unit of the database, so that the flow is ended.
It can be understood that the application scenario of the database processing method in fig. 6 is only a partial exemplary implementation manner in the embodiment of the present application, and the application scenario of the database processing method in the embodiment of the present application includes, but is not limited to, the application scenario of the database processing method shown in fig. 6.
The method of the embodiment of the application acquires the sub-table rule; in response to a database not satisfying the sub-table rule, determining a type of the sub-table rule; creating a table in the database based on the type of the table partitioning rule. In the embodiment of the application, the database can automatically create the table according to the table dividing rule without stopping the service of the database. Therefore, the table can be intelligently created in the database, meanwhile, the database can be applied to long-term operation, the service scenes of the table are required to be continuously added according to the date, the service is not required to be stopped, and the rule is not required to be reconfigured. The method of the embodiment of the application judges whether the existing table in the database meets the requirement of the dynamic table dividing rule at a preset moment, and stores the table information of the existing table based on the dynamic table dividing rule under the condition that the existing table in the database meets the requirement of the dynamic table dividing rule; thus, the user can conveniently use the table for subsequent inquiry. And under the condition that the existing tables in the database do not meet the requirements of the dynamic table dividing rules, all the required tables meeting the requirements of the dynamic table dividing rules are created at a preset moment based on the dynamic table dividing rules, so that the tables needing to store data when the database is in a preset time can be generated in advance, and the data processing efficiency of the database is improved conveniently.
Therefore, compared with the prior art that the service of the database needs to be stopped and the rule needs to be reconfigured, the database method can intelligently create the table in the database according to the table dividing rule of the database, and improves the data processing efficiency of the database.
Continuing with the exemplary structure of the database processing apparatus 70 provided in the embodiment of the present application implemented as software modules, in some embodiments, as shown in fig. 7, the software modules in the database processing apparatus 70 may include: an obtaining module 701, configured to obtain a sub-table rule; a determining module 702, configured to determine a type of the table division rule in response to the database not satisfying the table division rule; a creating module 703, configured to create a table in the database based on the type of the table partitioning rule.
In some embodiments, as shown in fig. 8, the software modules in the database processing device 70 may further include: a table dividing module 704, configured to obtain all table dividing rules of existing tables in the database; the determining module 705 is configured to determine whether the existing table in the database meets the requirements of all the table splitting rules based on all the table splitting rules.
In some embodiments, the determining module 701 includes a determining sub-module, and the determining sub-module is configured to determine the type of the table partitioning rule according to a configuration item in a configuration file of the database, and determine a table building template corresponding to the table partitioning rule in the process of determining the type of the table partitioning rule.
In some embodiments, the creating module 703 includes a dynamic sub-table module, which is configured to, in the creating a table in the database based on the type of the sub-table rule, create a required table in the database based on the dynamic sub-table rule of the required table in the database and the table creating template if the type of the sub-table rule is determined to be a dynamic sub-table rule; and determining the table in which the data in the database is to be written or read according to the first type field data of the required table.
In some embodiments, the creating module 703 includes a fixed sub-table sub-module, which is configured to, in the creating a table in the database based on the type of the sub-table rule, create a required table in the database based on the fixed sub-table rule of the required table in the database and the table creating template if the type of the sub-table rule is determined to be a dynamic sub-table rule; and determining the table in which the data in the database is to be written or read according to the second type field data of the required table according to the fixed sub-table rule.
In some embodiments, the fixed table sub-module is further specifically configured to, in the process of creating the table needed in the database based on the fixed table-partitioning rule and the table-building template of the table needed in the database: determining the second type field data in the database based on the fixed sub-table rule; creating all required tables in the database which meet the requirement of the fixed sub-table rule based on the second type field data and the table creation template of the required tables in the database; the second type field data is preset field data.
In some embodiments, the dynamic table partitioning sub-module is further specifically configured to, in the process of creating the table needed in the database based on the dynamic table partitioning rule and the table creation template of the table needed in the database: determining the first type field data in the database based on the dynamic table partitioning rule; creating all required tables in the database which meet the requirements of the dynamic table dividing rule based on the first type field data and the table building template of the required tables in the database; the first type field data is preset time type field data.
In some embodiments, the dynamic table sub-module, in creating all the required tables in the database that meet the requirements of the dynamic table partitioning rule based on the first type field data and the table building template of the required tables in the database, is further configured to create all the required tables that meet the requirements of the dynamic table partitioning rule at preset times based on the first type field data and the table building template.
In some embodiments, the determining module comprises: the device comprises a presetting submodule, a storage submodule and a table building submodule. In the process of judging whether the existing table in the database meets the requirements of all the table dividing rules or not based on all the table dividing rules, a preset sub-module is used for judging whether the existing table in the database meets the requirements of the dynamic table dividing rules or not at a preset moment; the storage submodule is used for storing the table information of the existing table under the condition that the existing table in the database meets the requirement of the dynamic table dividing rule; and the table building sub-module is used for determining the dynamic table dividing rule and the table building template of the table required in the database under the condition that the existing table in the database does not meet the requirement of the dynamic table dividing rule.
It should be noted that the description of the apparatus in the embodiment of the present application is similar to the description of the method embodiment, and has similar beneficial effects to the method embodiment, and therefore, the description is not repeated. The technical details that are not used up in the window display device provided in the embodiments of the present application can be understood from the description of any one of fig. 1 to 8.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
FIG. 9 illustrates a schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 9, the electronic apparatus 800 includes a computing unit 801 that can perform various appropriate actions and processes in accordance with a computer program stored in a Read Only Memory (ROM)802 or a computer program loaded from a storage unit 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic apparatus 800 can also be stored. The calculation unit 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
A number of components in the electronic device 800 are connected to the I/O interface 805, including: an input unit 806, such as a keyboard, a mouse, or the like; an output unit 807 such as various types of displays, speakers, and the like; a storage unit 808, such as a magnetic disk, optical disk, or the like; and a communication unit 809 such as a network card, modem, wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunication networks.
Computing unit 801 may be a variety of general and/or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and the like. The calculation unit 801 executes the respective methods and processes described above, such as the database processing method. For example, in some embodiments, the database processing method may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and/or installed onto the electronic device 800 via the ROM 802 and/or the communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the database processing method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the database processing method in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present application may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this application, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server with a combined blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (12)

1. A database processing method, the method comprising:
acquiring a sub-table rule;
in response to a database not satisfying the sub-table rule, determining a type of the sub-table rule;
creating a table in the database based on the type of the table partitioning rule.
2. The method of claim 1, wherein after obtaining the sub-table rule, the method further comprises:
acquiring all sub-table rules of the existing tables in the database;
and judging whether the existing tables in the database meet the requirements of all the table dividing rules or not based on all the table dividing rules.
3. The method of claim 1, wherein determining the type of the sublist rule comprises:
and determining the type of the table division rule according to the configuration items in the configuration file of the database, and determining a table building template corresponding to the table division rule.
4. The method of claim 3, wherein creating a table in the database based on the type of the table-splitting rule comprises:
under the condition that the type of the table dividing rule is determined to be a dynamic table dividing rule, a required table in the database is created based on the dynamic table dividing rule of the required table in the database and the table building template;
and determining the table in which the data in the database is to be written or read according to the first type field data of the required table.
5. The method of claim 3, wherein creating a table in the database based on the type of the table-splitting rule comprises:
under the condition that the type of the table dividing rule is determined to be a fixed table dividing rule, a required table in the database is created based on the fixed table dividing rule of the required table in the database and the table building template;
and determining the table in which the data in the database is to be written or read according to the second type field data of the required table according to the fixed sub-table rule.
6. The method of claim 5, wherein creating the desired table in the database based on the fixed table-splitting rule and the table-building template of the desired table in the database comprises:
determining the second type field data in the database based on the fixed sub-table rule;
creating all required tables in the database which meet the requirement of the fixed sub-table rule based on the second type field data and the table creation template of the required tables in the database;
the second type field data is preset field data.
7. The method of claim 4, wherein said determining whether existing tables in the database satisfy the requirements of the table-splitting rule based on all table-splitting rules comprises:
determining the first type field data in the database based on the dynamic table partitioning rule;
creating all required tables in the database which meet the requirements of the dynamic table dividing rule based on the first type field data and the table building template of the required tables in the database;
the first type field data is preset time type field data.
8. The method of claim 7, wherein the creating all tables needed in the database that satisfy the dynamic table partitioning rule requirement based on the first type field data and the table creation template of the needed tables in the database comprises:
and creating all the required tables meeting the requirements of the dynamic table dividing rule at a preset moment based on the first type field data and the table building template.
9. The method of claim 2, wherein said determining whether existing tables in the database satisfy the requirements of all table-splitting rules based on all table-splitting rules comprises:
judging whether the existing table in the database meets the requirement of a dynamic table dividing rule at a preset moment;
under the condition that the existing table in the database meets the requirement of the dynamic table dividing rule, storing the table information of the existing table;
and under the condition that the existing tables in the database do not meet the requirements of the dynamic table dividing rules, determining the dynamic table dividing rules and the table building templates of the required tables in the database.
10. A database processing apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring the sub-table rules;
the determining module is used for responding to the situation that the database does not meet the table dividing rule and determining the type of the table dividing rule;
a creating module for creating a table in the database based on the type of the table division rule.
11. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.
12. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-9.
CN202210152103.4A 2022-02-18 2022-02-18 Database processing method and device, electronic equipment and storage medium Pending CN114637744A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210152103.4A CN114637744A (en) 2022-02-18 2022-02-18 Database processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210152103.4A CN114637744A (en) 2022-02-18 2022-02-18 Database processing method and device, electronic equipment and storage medium

Publications (1)

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

Family

ID=81946137

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210152103.4A Pending CN114637744A (en) 2022-02-18 2022-02-18 Database processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114637744A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100153349A1 (en) * 2008-12-16 2010-06-17 Albrecht Schroth Continuous, automated database-table partitioning and database-schema evolution
CN103714097A (en) * 2012-10-09 2014-04-09 阿里巴巴集团控股有限公司 Method and device for accessing database
CN106547870A (en) * 2016-10-31 2017-03-29 天脉聚源(北京)科技有限公司 Point table method and device of data base
CN109344157A (en) * 2018-09-20 2019-02-15 深圳市牛鼎丰科技有限公司 Read and write abruption method, apparatus, computer equipment and storage medium
CN111090974A (en) * 2019-12-27 2020-05-01 中国银行股份有限公司 Report generation method, device and equipment
CN113254535A (en) * 2021-06-08 2021-08-13 成都新潮传媒集团有限公司 Method and device for synchronizing data from mongodb to mysql and computer readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100153349A1 (en) * 2008-12-16 2010-06-17 Albrecht Schroth Continuous, automated database-table partitioning and database-schema evolution
CN103714097A (en) * 2012-10-09 2014-04-09 阿里巴巴集团控股有限公司 Method and device for accessing database
CN106547870A (en) * 2016-10-31 2017-03-29 天脉聚源(北京)科技有限公司 Point table method and device of data base
CN109344157A (en) * 2018-09-20 2019-02-15 深圳市牛鼎丰科技有限公司 Read and write abruption method, apparatus, computer equipment and storage medium
CN111090974A (en) * 2019-12-27 2020-05-01 中国银行股份有限公司 Report generation method, device and equipment
CN113254535A (en) * 2021-06-08 2021-08-13 成都新潮传媒集团有限公司 Method and device for synchronizing data from mongodb to mysql and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN111177231B (en) Report generation method and report generation device
US20140316540A1 (en) Method for producing plc and hmi tag database and system
CN111125064B (en) Method and device for generating database schema definition statement
CN103678396B (en) A kind of data back up method and device based on data model
CN115686499A (en) Method, device, storage medium and electronic equipment for generating request message
CN113609100B (en) Data storage method, data query device and electronic equipment
CN113190517B (en) Data integration method and device, electronic equipment and computer readable medium
CN111259090A (en) Graph generation method and device of relational data, electronic equipment and storage medium
CN114064925A (en) Knowledge graph construction method, data query method, device, equipment and medium
CN114637744A (en) Database processing method and device, electronic equipment and storage medium
CN116185389A (en) Code generation method and device, electronic equipment and medium
CN115525721A (en) Data synchronization method, device, equipment and storage medium
CN115408111A (en) Database script control method, system, device, storage medium and program product
CN114003717A (en) Data processing method and device, electronic equipment and storage medium
US20170161359A1 (en) Pattern-driven data generator
CN113485763A (en) Data processing method and device, electronic equipment and computer readable medium
CN114820079B (en) Crowd determination method, device, equipment and medium
CN114925118B (en) Cross-table searching method, device, equipment and storage medium
US20170286519A1 (en) Synchronizing data modifications based on time zones
CN115981657A (en) Code generation method and device, electronic equipment and readable medium
CN116050371A (en) Report generation method, device, equipment and program product
CN118012897A (en) Heterogeneous database grammar conversion method, device, equipment and storage medium
CN115458103A (en) Medical data processing method and device, electronic equipment and readable storage medium
CN117332773A (en) Method, device, equipment and medium for cascading document design results
CN115576977A (en) Data paging query method and device, electronic equipment and storage medium

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 518066 room 1901, 19 / F, building 31 (Building B), Caihui center, No. 1 Cuiying street, Nansha District, Guangzhou, Guangdong Province (office only)

Applicant after: Guangdong Lenovo understand Communication Co.,Ltd.

Address before: Room 201, building a, No.1 Qianwan 1st Road, Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong Province (settled in Shenzhen Qianhai business secretary Co., Ltd.)

Applicant before: SHENZHEN LENOVO CONNECT Co.,Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20220617