CN118069758A - Distributed database data changing method and device, electronic equipment and medium - Google Patents

Distributed database data changing method and device, electronic equipment and medium Download PDF

Info

Publication number
CN118069758A
CN118069758A CN202410064662.9A CN202410064662A CN118069758A CN 118069758 A CN118069758 A CN 118069758A CN 202410064662 A CN202410064662 A CN 202410064662A CN 118069758 A CN118069758 A CN 118069758A
Authority
CN
China
Prior art keywords
data
target
change
sql statement
distributed database
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
CN202410064662.9A
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.)
Beijing Even Number Technology Co ltd
Original Assignee
Beijing Even Number Technology 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 Beijing Even Number Technology Co ltd filed Critical Beijing Even Number Technology Co ltd
Priority to CN202410064662.9A priority Critical patent/CN118069758A/en
Publication of CN118069758A publication Critical patent/CN118069758A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the disclosure discloses a distributed database data changing method, a distributed database data changing device, electronic equipment and a distributed database data changing medium. One embodiment of the method comprises the following steps: in response to detecting that the target source data has data change, obtaining change data of the target source data; generating SQL sentences according to the change data; and carrying out data change on target data in the target distributed database according to the SQL statement. According to the embodiment, the CDC data without the main key and the CDC data with the main key can be translated into SQL executable by the target distributed database, the value of the whole field of the data before the CDC data is changed is used as a filtering condition (where sub statement), only the first piece of data meeting the condition is updated/deleted, and the consistency and compatibility of the data in the CDC scene without the main key and the CDC scene with the main key can be ensured.

Description

Distributed database data changing method and device, electronic equipment and medium
Technical Field
Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a method, an apparatus, an electronic device, and a computer readable medium for changing data in a distributed database.
Background
Information push, also known as "web broadcast", is a technology that reduces information overload by pushing information required by users over the internet, through a certain technical standard or protocol. The information pushing technology can reduce the time spent by the user searching on the network by actively changing the data of the distributed database to the user.
The related information pushing mode is generally to directly load various distributed database data changes on the web page, wherein the distributed database data changes are obviously different from the content of the web page.
Disclosure of Invention
The disclosure is in part intended to introduce concepts in a simplified form that are further described below in the detailed description. The disclosure is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
Some embodiments of the present disclosure propose a distributed database data modification method, apparatus, electronic device, and computer readable medium to solve the technical problems mentioned in the background section above.
In a first aspect, some embodiments of the present disclosure provide a distributed database data modification method, the method comprising: in response to detecting that the target source data has data change, obtaining change data of the target source data; generating SQL sentences according to the change data; and carrying out data change on target data in the target distributed database according to the SQL statement.
In a second aspect, some embodiments of the present disclosure provide a distributed database data altering apparatus, the apparatus comprising: an acquisition unit configured to acquire change data of target source data in response to detection of the presence of data change of the target source data; a generation unit configured to generate an SQL sentence from the change data; and the changing unit is configured to change the data of the target data in the target distributed database according to the SQL statement.
In a third aspect, an embodiment of the present application provides an electronic device, including: one or more processors; a storage means for storing one or more programs; the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method as described in any of the implementations of the first aspect.
In a fourth aspect, embodiments of the present application provide a computer readable medium having stored thereon a computer program which, when executed by a processor, implements a method as described in any of the implementations of the first aspect.
One of the above embodiments of the present disclosure has the following advantageous effects: the CDC data without the main key and the CDC data with the main key can be translated into SQL executable by the target distributed database, the value of the whole field of the data before the CDC data is changed is used as a filtering condition (where sub statement), and only the first piece of data meeting the condition is updated/deleted, so that the consistency and compatibility of the data under the CDC scene without the main key and the CDC scene with the main key can be ensured.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
FIG. 1 is a flow chart of some embodiments of a distributed database data change method according to the present disclosure;
FIG. 2 is a schematic diagram of the architecture of some embodiments of a distributed database data altering apparatus according to the present disclosure;
Fig. 3 is a schematic structural diagram of an electronic device suitable for use in implementing some embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings. Embodiments of the present disclosure and features of embodiments may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Referring to fig. 1, a flow 100 of some embodiments of a distributed database data altering method according to the present disclosure is shown. The distributed database data changing method comprises the following steps:
Step 101, in response to detecting that there is a data change in the target source data, obtaining changed data of the target source data.
In some embodiments, in response to detecting that there is a data change to the target source data, an executing entity (e.g., a server) of the distributed database data change method may obtain the change data of the target source data through a wired connection manner or a wireless connection manner.
Here, the target data source generally refers to a data source that needs to be consistent with the distributed database, and the change data generally refers to change data generated by deleting, adding, modifying, or the like in the target data source.
As an example, if the target source data is a database, it is update xxx set column 4=6where column 1= 'a'; in the target source data modification process, 3 lines are modified, and the execution subject can collect 3 CDC data as change data through a data change Capture mode (CDC, change Data Capture).
It should be noted that the wireless connection may include, but is not limited to, 3G/4G connection, wiFi connection, bluetooth connection, wiMAX connection, zigbee connection, UWB (ultra wideband) connection, and other now known or later developed wireless connection.
It should be understood that the distributed database data changing method may be performed by a terminal device, or may be performed by a server, and the main body of the method may include a device formed by integrating the terminal device and the server through a network, or may be performed by various software programs. The terminal device may be, among other things, various electronic devices with information processing capabilities including, but not limited to, smartphones, tablet computers, electronic book readers, laptop and desktop computers, and the like. The execution body may also be embodied as a server, software, or the like. When the execution subject is software, the execution subject can be installed in the electronic device enumerated above. It may be implemented as a plurality of software or software modules, for example, for providing distributed services, or as a single software or software module. The present invention is not particularly limited herein.
In some alternative implementations of some embodiments, the altering data includes: data change operation, data before change, data after change.
And 102, generating an SQL sentence according to the change data.
In some embodiments, the execution body (e.g., server) may generate an SQL statement based on the change data obtained in step 101.
As an example, the execution body may translate CDC data as a destination SQL statement using old values of all fields as filtering conditions: "update table1 set column 4=6 where column 1= 'a' and column 2= 'b' and column 3= 'c' and column 4=2".
And step 103, carrying out data change on target data in the target distributed database according to the SQL statement.
In some embodiments, the execution body may perform data modification on the target data in the target distributed database according to the SQL statement.
In some optional implementations of some embodiments, in response to determining that the target source data is primary key data, the execution body may determine, according to the SQL statement, target data in the target database that conforms to the SQL statement, to obtain a target data set; and carrying out data change on all target data in the target data set according to the SQL statement.
In some optional implementations of some embodiments, in response to determining that the target source data is keyless data, the execution body may determine, according to the SQL statement, target data in the target database that conforms to the SQL statement, to obtain a target data set; and carrying out data change on the first piece of data in the target data set according to the SQL statement.
One of the above embodiments of the present disclosure has the following advantageous effects: the CDC data without the main key and the CDC data with the main key can be translated into SQL executable by the target distributed database, and the value of the whole field of the data before the CDC data is changed is used as a filtering condition (where sub statement), so that the consistency and compatibility of the data in the CDC scene without the main key and the CDC scene with the main key can be ensured.
With further reference to fig. 2, as an implementation of the method shown in the above figures, the present disclosure provides some embodiments of a distributed database data altering apparatus, which correspond to those method embodiments shown in fig. 2, and which are particularly applicable in various electronic devices.
As shown in fig. 2, the distributed database data altering apparatus 200 of some embodiments includes: acquisition unit 201, generation unit 202, and modification unit 203. Wherein, the obtaining unit 201 is configured to obtain the changed data of the target source data in response to detecting that the target source data has data change; a generating unit 202 configured to generate an SQL statement from the above-described change data; and a changing unit 203 configured to change the data of the target data in the target distributed database according to the SQL statement.
In an alternative implementation of some embodiments, the above change data includes: data change operation, data before change, data after change.
In an alternative implementation of some embodiments, the above-mentioned altering unit is further configured to: determining target data which accords with the SQL statement in the target database according to the SQL statement to obtain a target data set in response to determining that the target source data is primary key data; and carrying out data change on all target data in the target data set according to the SQL statement.
In an alternative implementation of some embodiments, the above-mentioned altering unit is further configured to: determining target data conforming to the SQL statement in the target database according to the SQL statement to obtain a target data set in response to determining that the target source data is non-primary key data; and carrying out data change on the first piece of data in the target data set according to the SQL statement.
It will be appreciated that the elements described in the apparatus 200 correspond to the various steps in the method described with reference to fig. 1. Thus, the operations, features and resulting benefits described above for the method are equally applicable to the apparatus 200 and the units contained therein, and are not described in detail herein.
One of the above embodiments of the present disclosure has the following advantageous effects: the CDC data without the main key and the CDC data with the main key can be translated into SQL executable by the target distributed database, and the value of the whole field of the data before the CDC data is changed is used as a filtering condition (where sub statement), so that the consistency and compatibility of the data in the CDC scene without the main key and the CDC scene with the main key can be ensured.
Referring now to fig. 3, a schematic diagram of an architecture of an electronic device (e.g., an execution body server of a distributed database data change method) 300 suitable for use in implementing some embodiments of the present disclosure is shown. The electronic device shown in fig. 3 is merely an example and should not impose any limitations on the functionality and scope of use of embodiments of the present disclosure.
As shown in fig. 3, the electronic device 300 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 301 that may perform various suitable actions and processes in accordance with a program stored in a Read Only Memory (ROM) 302 or a program loaded from a storage means 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic apparatus 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
In general, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 307 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 308 including, for example, magnetic tape, hard disk, etc.; and communication means 309. The communication means 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. While fig. 3 shows an electronic device 300 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead. Each block shown in fig. 3 may represent one device or a plurality of devices as needed.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via communications device 309, or from storage device 308, or from ROM 302. The above-described functions defined in the methods of some embodiments of the present disclosure are performed when the computer program is executed by the processing means 301.
It should be noted that, in some embodiments of the present disclosure, the computer readable medium may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having 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.
In some embodiments of the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, the computer-readable signal medium may comprise a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing.
A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: in response to detecting that the target source data has data change, obtaining change data of the target source data; generating SQL sentences according to the change data; and carrying out data change on target data in the target distributed database according to the SQL statement.
Computer program code for carrying out operations for some embodiments of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The described units may also be provided in a processor, for example, described as: a processor includes an acquisition unit, a generation unit, and a modification unit. The names of these units do not constitute a limitation of the unit itself in some cases, and for example, the acquisition unit may also be described as "a unit that acquires change data of target source data in response to detecting that the target source data has a data change".
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above technical features, but encompasses other technical features formed by any combination of the above technical features or their equivalents without departing from the spirit of the invention. Such as the above-described features, are mutually substituted with (but not limited to) the features having similar functions disclosed in the embodiments of the present disclosure.

Claims (10)

1. A distributed database data change method, comprising:
in response to detecting that the target source data has data change, obtaining change data of the target source data;
generating an SQL statement according to the change data;
and carrying out data change on target data in the target distributed database according to the SQL statement.
2. The method of claim 1, wherein the change data comprises:
Data change operation, data before change, data after change.
3. The method of claim 1, wherein the performing data changes on the target data in the target distributed database according to the SQL statement comprises:
Determining target data conforming to the SQL statement in the target database according to the SQL statement to obtain a target data set in response to determining that the target source data is primary key data;
And carrying out data change on all target data in the target data set according to the SQL statement.
4. The method of claim 1, wherein the performing data changes on the target data in the target distributed database according to the SQL statement comprises:
determining target data conforming to the SQL statement in the target database according to the SQL statement to obtain a target data set in response to determining that the target source data is non-primary key data;
And carrying out data change on the first piece of data in the target data set according to the SQL statement.
5. An apparatus for distributed database data modification, comprising:
an acquisition unit configured to acquire change data of target source data in response to detection of the presence of a data change of the target source data;
a generation unit configured to generate an SQL statement from the change data;
and the changing unit is configured to change the data of the target data in the target distributed database according to the SQL statement.
6. The apparatus of claim 1, wherein the change data comprises:
Data change operation, data before change, data after change.
7. The apparatus of claim 1, wherein the altering unit is further configured to:
Determining target data conforming to the SQL statement in the target database according to the SQL statement to obtain a target data set in response to determining that the target source data is primary key data;
And carrying out data change on all target data in the target data set according to the SQL statement.
8. The apparatus of claim 1, wherein the altering unit is further configured to:
determining target data conforming to the SQL statement in the target database according to the SQL statement to obtain a target data set in response to determining that the target source data is non-primary key data;
And carrying out data change on the first piece of data in the target data set according to the SQL statement.
9. An electronic device, comprising:
One or more processors;
A storage device having one or more programs stored thereon,
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-4.
10. A computer readable medium having stored thereon a computer program, wherein the program when executed by a processor implements the method of any of claims 1-4.
CN202410064662.9A 2024-01-16 2024-01-16 Distributed database data changing method and device, electronic equipment and medium Pending CN118069758A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410064662.9A CN118069758A (en) 2024-01-16 2024-01-16 Distributed database data changing method and device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410064662.9A CN118069758A (en) 2024-01-16 2024-01-16 Distributed database data changing method and device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN118069758A true CN118069758A (en) 2024-05-24

Family

ID=91104677

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410064662.9A Pending CN118069758A (en) 2024-01-16 2024-01-16 Distributed database data changing method and device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN118069758A (en)

Similar Documents

Publication Publication Date Title
CN111581563B (en) Page response method and device, storage medium and electronic equipment
CN111930534A (en) Data calling method and device and electronic equipment
CN111459364B (en) Icon updating method and device and electronic equipment
CN110909521A (en) Synchronous processing method and device for online document information and electronic equipment
CN115757400B (en) Data table processing method, device, electronic equipment and computer readable medium
CN111857720B (en) User interface state information generation method and device, electronic equipment and medium
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN111338944B (en) Remote Procedure Call (RPC) interface testing method, device, medium and equipment
CN111694629A (en) Information display method and device and electronic equipment
CN112416303B (en) Software development kit hot repair method and device and electronic equipment
CN112464039B (en) Tree-structured data display method and device, electronic equipment and medium
CN111355784B (en) Method, device, medium and electronic equipment for processing request information
CN113220281A (en) Information generation method and device, terminal equipment and storage medium
CN110990038B (en) Method, apparatus, electronic device and medium for applying local update
CN112558933A (en) Component rendering method and device, readable medium and electronic equipment
CN111752644A (en) Interface simulation method, device, equipment and storage medium
CN116860286A (en) Page dynamic update method, device, electronic equipment and computer readable medium
CN115102992B (en) Data publishing method and device, electronic equipment and computer readable medium
CN112507676B (en) Method and device for generating energy report, electronic equipment and computer readable medium
CN116226189A (en) Cache data query method, device, electronic equipment and computer readable medium
CN111460020B (en) Method, device, electronic equipment and medium for resolving message
CN110941683B (en) Method, device, medium and electronic equipment for acquiring object attribute information in space
CN118069758A (en) Distributed database data changing method and device, electronic equipment and medium
CN112230986A (en) Project file generation method and device, electronic equipment and computer readable medium
CN111580890A (en) Method, apparatus, electronic device, and computer-readable medium for processing features

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