WO2020211657A1 - 一种数据表的创建方法和装置 - Google Patents

一种数据表的创建方法和装置 Download PDF

Info

Publication number
WO2020211657A1
WO2020211657A1 PCT/CN2020/083092 CN2020083092W WO2020211657A1 WO 2020211657 A1 WO2020211657 A1 WO 2020211657A1 CN 2020083092 W CN2020083092 W CN 2020083092W WO 2020211657 A1 WO2020211657 A1 WO 2020211657A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
data source
database
target data
target
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.)
Ceased
Application number
PCT/CN2020/083092
Other languages
English (en)
French (fr)
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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Publication of WO2020211657A1 publication Critical patent/WO2020211657A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/28Databases characterised by their database models, e.g. relational or object models
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/283Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP

Definitions

  • the present disclosure relates to the field of computer technology, and in particular to a method and device for creating a data table.
  • the present disclosure proposes a method and device for creating a data table, which can avoid the user from manually inputting fields, thereby improving the efficiency of table creation.
  • a method for creating a data table including: receiving a data table creation instruction input by a user, the data table creation instruction including a data source identifier; and determining a target indicated by the data source identifier The data structure information in the data source; according to the data structure information in the target data source, a table building statement of the target data source is generated, and the table building statement is used to create a data table corresponding to the target data source.
  • determining the data structure information in the target data source indicated by the data source identifier includes: extracting at least one data record stored in the target data source; according to the at least one data record, Determine the data structure information in the target data source.
  • determining the data structure information in the target data source indicated by the data source identifier includes: determining each data item in the target data source and the first data corresponding to any data item The type identification is used as the data structure information.
  • generating the table creation statement of the target data source according to the data structure information in the target data source includes: determining the creation statement according to each data item in the target data source At least one field in the table sentence; according to the first data type identifier corresponding to any data item, the second data type identifier of the field corresponding to the data item is determined, wherein the data indicated by the first data type identifier The type is the same as the data type indicated by the second data type identifier.
  • the second data type identifiers determined according to the first data type identifiers indicating the same data type are the same.
  • the target data source includes at least one of the following: a database, and a storage service with a data storage function.
  • the target data source includes at least one of the following: object storage service OSS, table storage service OTS, database MySQL, database SQL Server, database Postgres, relational database PolarDB, distributed document storage The database MangoDB, and the database Redis.
  • a device for creating a data table including: a receiving module for receiving a data table creation instruction input by a user, the data table creation instruction including a data source identifier; a determining module, To determine the data structure information in the target data source indicated by the data source identifier; a creation module, configured to generate a table building statement for the target data source according to the data structure information in the target data source, the table building The statement is used to create a data table corresponding to the target data source.
  • the determining module includes: an extraction sub-module, configured to extract at least one data record stored in the target data source; a first determining sub-module, configured based on the at least one data record To determine the data structure information in the target data source.
  • the determining module is specifically configured to determine each data item in the target data source, and a first data type identifier corresponding to any data item as the data structure information.
  • the creation module includes: a second determination sub-module, configured to determine at least one field in the table creation statement according to each data item in the target data source; and a third determination The sub-module is used to determine the second data type identifier of the field corresponding to the data item according to the first data type identifier corresponding to any data item, wherein the data type indicated by the first data type identifier and the data type The data types indicated by the second data type identifiers are the same.
  • the second data type identifiers determined according to the first data type identifiers indicating the same data type are the same.
  • the target data source includes at least one of the following: a database, and a storage service with a data storage function.
  • the target data source includes at least one of the following: object storage service OSS, table storage service OTS, database MySQL, database SQL Server, database Postgres, relational database PolarDB, distributed document storage The database MangoDB, and the database Redis.
  • an apparatus for creating a data table including: a processor; a memory for storing executable instructions of the processor; wherein the processor is configured to execute the above-mentioned first aspect The creation method of the data table.
  • a non-volatile computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the above-mentioned first aspect How to create a data table.
  • the data structure information in the target data source indicated by the data source identifier is determined, and then the data structure information in the target data source is automatically generated for creating the target data source.
  • FIG. 1 shows a schematic flowchart of a method for creating a data table according to an embodiment of the present disclosure
  • FIG. 2 shows a schematic diagram of a method for creating a data table according to an embodiment of the present disclosure
  • FIG. 3 shows a schematic structural diagram of an apparatus for creating a data table according to an embodiment of the present disclosure
  • Fig. 4 shows a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
  • the data lake is a new type of data warehouse solution.
  • the data lake itself does not store data, but reads data from the underlying data storage when users need it.
  • the data lake obtains original data from multiple data sources in the enterprise, and for different purposes, the same original data may also have multiple data copies that meet a specific internal model format. Therefore, the data processed in the data lake may be Structured data may also be unstructured data.
  • creating a data table of a data source requires the user to manually enter each field in the data table.
  • the data source for example, the business database of an enterprise
  • the data source includes more fields
  • Manual entry of fields leads to low efficiency in table building.
  • the method for creating a data table provided by the present disclosure can be applied to data table creation scenarios in the field of data lakes to realize automatic generation of table building statements, avoid manual input of fields by users, and improve table building efficiency.
  • the following takes the data lake field as an example to introduce in detail the method for creating the data table provided by the present disclosure.
  • the data lake field is only an example of an application scenario of the present disclosure, and does not constitute a limitation of the present disclosure.
  • the method for creating a data table provided by the present disclosure may also be applied to other application scenarios.
  • FIG. 1 shows a schematic flowchart of a method for creating a data table according to an embodiment of the present disclosure. As shown in Figure 1, the method may include:
  • Step S11 Receive a data table creation instruction input by a user, and the data table creation instruction includes a data source identifier.
  • Step S12 Determine the data structure information in the target data source indicated by the data source identifier.
  • Step S13 According to the data structure information in the target data source, a table building statement of the target data source is generated, and the table building statement is used to create a data table corresponding to the target data source.
  • a user wants to create a data table for a target data source, he inputs a data table creation instruction including the data source identifier to the data lake, and then the data lake determines the data structure in the target data source indicated by the data source identifier, so that the data structure information can be used to:
  • the table creation statement used to create the data table corresponding to the target data source is automatically generated in the data lake to avoid the user from manually inputting the fields in the data table and improve the efficiency of table creation.
  • the target data source includes at least one of the following: a database, and a storage service with a data storage function.
  • the target data source may be a database for storing structured data, a storage service with a data storage function for storing unstructured data, or other data storage, which is not specifically limited in the present disclosure.
  • the target data source includes at least one of the following: object storage service OSS, table storage service OTS, database MySQL, database SQL Server, database Postgres, relational database PolarDB, distributed document storage database MangoDB , And the database Redis.
  • Fig. 2 shows a schematic flowchart of a method for creating a data table according to an embodiment of the present disclosure.
  • the underlying data sources include object storage service OSS, table storage service OTS, database MySQL, database SQL Server, database Postgres, relational database PolarDB, distributed document storage database MangoDB, and database Redis.
  • the data lake can be The underlying data source creates a data table, so that the data in the underlying data source can be queried and read based on the data table.
  • the data table creation instruction is a structured query language (SQL, Structured Query Language).
  • 'mongodb_collection' is the data source identifier, which is used to indicate the target data source MangoDB.
  • the user when the user wants to create a data table for the object storage service OSS (target data source), the user enters a data table creation instruction into the data lake:
  • //test-bucket/my-file' is the data source identifier, which is used to indicate the target data source OSS.
  • mysql_table' is the data source identifier, used to indicate the target data source MySQL.
  • the grammatical format of the data table creation instruction can be changed according to actual conditions, and the present disclosure does not specifically limit this.
  • the data table creation instruction can be: create external table data_lake_table like mapping mongodb_collection; or create external table data_lake_table like underlying mongodb_collection.
  • determining the data structure information in the target data source indicated by the data source identifier includes: determining each data item in the target data source and the first data type identifier corresponding to any data item, as Data structure information.
  • the engine of the data lake can automatically analyze and derive the data structure in the target data source indicated by the data source identifier to determine the data structure information in the target data source : Each data item, and the first data type identifier corresponding to any data item.
  • determining the data structure information in the target data source indicated by the data source identifier includes: extracting at least one data record stored in the target data source; and determining the target data source according to the at least one data record The data structure information.
  • Data Lake receives the data table creation instruction input by the user: create external table data_lake_table like mapping('mongodb_collection'), Data Lake extracts a data record from the distributed document storage database MangoDB for analysis and deduction , Determine the data structure information in the distributed document storage database MangoDB.
  • the data lake analysis deduces that the distributed document storage database MangoDB includes four data items: age, creation time creat_time, identification id and name name; among them, age is The corresponding first data type identifier is double, and the data type used for indication is double-precision floating point type; the first data type identifier corresponding to the creation time creat_time is timestamp, and the data type used for indication is timestamp character sequence type; The first data type identifier corresponding to id is double, and the data type used to indicate is a double-precision floating point type; the first data type identifier corresponding to name name is varchar, and the data type used to indicate is a string type.
  • generating the table building statement of the data source according to the data structure information in the target data source includes: determining at least one field in the table building statement according to each data item in the target data source; The first data type identifier corresponding to any data item determines the second data type identifier of the field corresponding to the data item, where the data type indicated by the first data type identifier and the data type indicated by the second data type identifier are the same.
  • the second data type identifiers determined according to the first data type identifiers indicating the same data type are the same.
  • the first data type identifiers indicating the same data type may be different.
  • the first data type indicating the string type is identified as string
  • the first data type indicating the string type is identified as varchar.
  • different first data type identifiers indicating the same data type are uniformly mapped, that is, according to the first data type identifier corresponding to any data item, the second data type identifier of the field corresponding to the data item is determined according to the instruction
  • the second data type identifiers determined by the first data type identifiers of the same data type are the same.
  • the second data type indicating the string type is identified as varchar.
  • the data table corresponding to the distributed document storage database MangoDB For the data item whose first data type is identified as string (used to indicate the string type) in the distributed document storage database MangoDB, determine the second of the field corresponding to the data item The data type is identified as varchar; when creating the data table corresponding to the database MySQL, for the data item whose first data type is identified as varchar (used to indicate the string type) in the database MySQL, determine the second data type of the field corresponding to the data item The identity is still varchar.
  • the table creation statement used to create the data table corresponding to the distributed document storage database MangoDB is automatically generated based on the data structure information .
  • the table creation statement used to create the data table corresponding to the distributed document storage database MangoDB is:
  • the data type is the time stamp character sequence type
  • the data type is double precision floating point type
  • the data lake creates a data table corresponding to the target data source based on the table creation statement, and then users can query the data in the target data source based on the data table in the data lake.
  • the data lake after the data lake automatically generates a table creation statement for creating a data table corresponding to the distributed document storage database MangoDB, it creates a data table corresponding to the distributed document storage database MangoDB based on the table creation statement.
  • the data lake receives the data query instruction for the distributed document storage database MangoDB input by the user, the data lake can query the data in the distributed document storage database MangoDB based on the data table.
  • the data structure information in the target data source indicated by the data source identifier is determined, and then the data structure information in the target data source is automatically generated for creating the target data source.
  • Fig. 3 shows a schematic structural diagram of an apparatus for creating a data table according to an embodiment of the present disclosure.
  • the device 30 shown in FIG. 3 may be used to perform the steps of the method embodiment shown in FIG. 1, and the device 30 includes:
  • the receiving module 31 is configured to receive a data table creation instruction input by a user, and the data table creation instruction includes a data source identifier;
  • the determining module 32 is used to determine the data structure information in the target data source indicated by the data source identifier;
  • the creation module 33 is configured to generate a table creation statement of the target data source according to the data structure information in the target data source, and the table creation statement is used to create a data table corresponding to the target data source.
  • the determining module 32 includes:
  • the extraction sub-module is used to extract at least one data record stored in the target data source
  • the first determining submodule is configured to determine the data structure information in the target data source according to the at least one data record.
  • the determining module 32 is specifically configured to:
  • the creation module 33 includes:
  • the second determining sub-module is used to determine at least one field in the table building statement according to each data item in the target data source;
  • the third determining submodule is used to determine the second data type identifier of the field corresponding to any data item according to the first data type identifier corresponding to the data item, wherein the data type indicated by the first data type identifier and the second data The data type indicated by the type identifier is the same.
  • the second data type identifiers determined according to the first data type identifiers indicating the same data type are the same.
  • the target data source includes at least one of the following:
  • Database storage service with data storage function.
  • the target data source includes at least one of the following:
  • Object storage service OSS table storage service OTS, database MySQL, database SQL Server, database Postgres, relational database PolarDB, distributed document storage database MangoDB, and database Redis.
  • the device 30 provided by the present disclosure can implement each step in the method embodiment shown in FIG. 1 and achieve the same technical effect. To avoid repetition, details are not described herein again.
  • Fig. 4 shows a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
  • the electronic device includes a processor, and optionally an internal bus, a network interface, and a memory.
  • the memory may include memory, such as high-speed random access memory (Random-Access Memory, RAM), and may also include non-volatile memory (non-volatile memory), such as at least one disk storage.
  • RAM random access memory
  • non-volatile memory such as at least one disk storage.
  • the electronic device may also include hardware required for other services.
  • the processor, network interface, and memory can be connected to each other through an internal bus.
  • the internal bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect, peripheral component interconnection standard) bus or an EISA (Extended) bus. Industry Standard Architecture, extended industry standard structure) bus, etc.
  • the bus can be divided into address bus, data bus, control bus, etc. For ease of presentation, only one bidirectional arrow is used to indicate in FIG. 4, but it does not mean that there is only one bus or one type of bus.
  • the program may include program code, and the program code includes computer operation instructions.
  • the memory may include memory and non-volatile memory, and provide instructions and data to the processor.
  • the processor reads the corresponding computer program from the non-volatile memory to the memory and then runs it to form a data table creation device on the logical level.
  • the processor executes the program stored in the memory, and specifically executes: receives the data table creation instruction input by the user, the data table creation instruction includes the data source identifier; determines the data structure information in the target data source indicated by the data source identifier; The data structure information in the data source generates a table building statement of the target data source, and the table building statement is used to create a data table corresponding to the target data source.
  • the processor is specifically configured to execute: extract at least one data record stored in the target data source; and determine the data structure information in the target data source according to the at least one data record.
  • the processor is specifically configured to execute: determine each data item in the target data source, and the first data type identifier corresponding to any data item, as data structure information.
  • the processor is specifically configured to execute: according to each data item in the target data source, determine at least one field in the table creation statement; according to the first data type identifier corresponding to any data item, Determine the second data type identifier of the field corresponding to the data item, where the data type indicated by the first data type identifier and the data type indicated by the second data type identifier are the same.
  • the second data type identifiers determined according to the first data type identifiers indicating the same data type are the same.
  • the target data source includes at least one of the following: a database, and a storage service with a data storage function.
  • the target data source includes at least one of the following: object storage service OSS, table storage service OTS, database MySQL, database SQL Server, database Postgres, relational database PolarDB, distributed document storage database MangoDB , And the database Redis.
  • the processor may be an integrated circuit chip with signal processing capabilities.
  • the steps of the above method can be completed by hardware integrated logic circuits in the processor or instructions in the form of software.
  • the above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (Network Processor, NP), etc.; it may also be a digital signal processor (DSP), a dedicated Circuits (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • DSP digital signal processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the steps of the method disclosed in the embodiments of this specification can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers.
  • the storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
  • the electronic device can execute the method executed by the method embodiment shown in FIG. 1, and implement the method shown in FIG.
  • the embodiment of this specification also proposes a computer-readable storage medium that stores one or more programs, the one or more programs include instructions, and the instructions are executed by an electronic device that includes multiple application programs.
  • the electronic device can be made to execute the method for creating a data table in the embodiment shown in FIG. 1, and specifically execute the steps of the method embodiment shown in FIG.
  • the present disclosure may be a system, method, and/or computer program product.
  • the computer program product may include a computer-readable storage medium loaded with computer-readable program instructions for enabling a processor to implement various aspects of the present disclosure.
  • the computer-readable storage medium may be a tangible device that can hold and store instructions used by the instruction execution device.
  • the computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing.
  • Computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) Or flash memory), static random access memory (SRAM), portable compact disk read-only memory (CD-ROM), digital versatile disk (DVD), memory stick, floppy disk, mechanical encoding device, such as a printer with instructions stored thereon
  • RAM random access memory
  • ROM read-only memory
  • EPROM erasable programmable read-only memory
  • flash memory flash memory
  • SRAM static random access memory
  • CD-ROM compact disk read-only memory
  • DVD digital versatile disk
  • memory stick floppy disk
  • mechanical encoding device such as a printer with instructions stored thereon
  • the computer-readable storage medium used here is not interpreted as a transient signal itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (for example, light pulses through fiber optic cables), or through wires Transmission of electrical signals.
  • the computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to various computing/processing devices, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and/or a wireless network.
  • the network may include copper transmission cables, optical fiber transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers.
  • the network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network, and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing/processing device .
  • the computer program instructions used to perform the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, status setting data, or in one or more programming languages.
  • Source code or object code written in any combination, the programming language includes object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as "C" language or similar programming languages.
  • Computer-readable program instructions can be executed entirely on the user's computer, partly on the user's computer, executed as a stand-alone software package, partly on the user's computer and partly executed on a remote computer, or entirely on the remote computer or server carried out.
  • the remote computer can 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 it can be connected to an external computer (for example, using an Internet service provider to access the Internet connection).
  • LAN local area network
  • WAN wide area network
  • an electronic circuit such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), can be customized by using the status information of the computer-readable program instructions.
  • the computer-readable program instructions are executed to realize various aspects of the present disclosure.
  • These computer-readable program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine such that when these instructions are executed by the processor of the computer or other programmable data processing device , A device that implements the functions/actions specified in one or more blocks in the flowchart and/or block diagram is produced. It is also possible to store these computer-readable program instructions in a computer-readable storage medium. These instructions make computers, programmable data processing apparatuses, and/or other devices work in a specific manner, so that the computer-readable medium storing instructions includes An article of manufacture, which includes instructions for implementing various aspects of the functions/actions specified in one or more blocks in the flowchart and/or block diagram.
  • each block in the flowchart or block diagram may represent a module, program segment, or part of an instruction, and the module, program segment, or part of an instruction contains one or more functions for implementing the specified logical function.
  • Executable instructions may also occur in a different order from the order marked in the drawings. For example, two consecutive blocks can actually be executed in parallel, or they can sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or actions Or it can be realized by a combination of dedicated hardware and computer instructions.

Landscapes

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

Abstract

一种数据表的创建方法和装置。该方法包括:接收用户输入的数据表创建指令,所述数据表创建指令中包括数据源标识(S11);确定所述数据源标识指示的目标数据源中的数据结构信息(S12);根据所述目标数据源中的数据结构信息,生成所述目标数据源的建表语句,所述建表语句用于创建所述目标数据源对应的数据表(S13)。上述方法可以避免用户手动输入字段,从而可以提高建表效率。

Description

一种数据表的创建方法和装置
本申请要求2019年04月17日递交的申请号为201910310499.9、发明名称为“一种数据表的创建方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本公开涉及计算机技术领域,尤其涉及一种数据表的创建方法和装置。
背景技术
目前,一般数据库都会提供建表语句,例如:create table A like B,利用该建表语句可以根据数据库里面已经有的一个数据表A复制出一个同样结构但是不一样表名的新数据表B。但是,在直接根据数据库中存储的原始数据创建新数据表的情况下,则需要用户手动输入新数据表中的各个字段,导致建表效率较低。
发明内容
有鉴于此,本公开提出了一种数据表的创建方法和装置,使得可以避免用户手动输入字段,从而可以提高建表效率。
根据本公开的第一方面,提供了一种数据表的创建方法,包括:接收用户输入的数据表创建指令,所述数据表创建指令中包括数据源标识;确定所述数据源标识指示的目标数据源中的数据结构信息;根据所述目标数据源中的数据结构信息,生成所述目标数据源的建表语句,所述建表语句用于创建所述目标数据源对应的数据表。
在一种可能的实现方式中,确定所述数据源标识指示的目标数据源中的数据结构信息,包括:提取所述目标数据源中存储的至少一条数据记录;根据所述至少一条数据记录,确定所述目标数据源中的数据结构信息。
在一种可能的实现方式中,确定所述数据源标识指示的目标数据源中的数据结构信息,包括:确定所述目标数据源中的各个数据项,以及任一数据项对应的第一数据类型标识,作为所述数据结构信息。
在一种可能的实现方式中,根据所述目标数据源中的数据结构信息,生成所述目标数据源的建表语句,包括:根据所述目标数据源中的各个数据项,确定所述建表语句中的至少一个字段;根据所述任一数据项对应的第一数据类型标识,确定所述数据项对应 的字段的第二数据类型标识,其中,所述第一数据类型标识指示的数据类型和所述第二数据类型标识指示的数据类型相同。
在一种可能的实现方式中,根据指示相同数据类型的第一数据类型标识所确定的第二数据类型标识是相同的。
在一种可能的实现方式中,所述目标数据源包括下述至少一种:数据库、具备数据存储功能的存储服务。
在一种可能的实现方式中,所述目标数据源包括下述至少一种:对象存储服务OSS、表格存储服务OTS、数据库MySQL、数据库SQL Server、数据库Postgres、关系型数据库PolarDB、分布式文档存储数据库MangoDB,和数据库Redis。
根据本公开的第二方面,提供了一种数据表的创建装置,包括:接收模块,用于接收用户输入的数据表创建指令,所述数据表创建指令中包括数据源标识;确定模块,用于确定所述数据源标识指示的目标数据源中的数据结构信息;创建模块,用于根据所述目标数据源中的数据结构信息,生成所述目标数据源的建表语句,所述建表语句用于创建所述目标数据源对应的数据表。
在一种可能的实现方式中,所述确定模块包括:提取子模块,用于提取所述目标数据源中存储的至少一条数据记录;第一确定子模块,用于根据所述至少一条数据记录,确定所述目标数据源中的数据结构信息。
在一种可能的实现方式中,所述确定模块具体用于:确定所述目标数据源中的各个数据项,以及任一数据项对应的第一数据类型标识,作为所述数据结构信息。
在一种可能的实现方式中,所述创建模块包括:第二确定子模块,用于根据所述目标数据源中的各个数据项,确定所述建表语句中的至少一个字段;第三确定子模块,用于根据所述任一数据项对应的第一数据类型标识,确定所述数据项对应的字段的第二数据类型标识,其中,所述第一数据类型标识指示的数据类型和所述第二数据类型标识指示的数据类型相同。
在一种可能的实现方式中,根据指示相同数据类型的第一数据类型标识所确定的第二数据类型标识是相同的。
在一种可能的实现方式中,所述目标数据源包括下述至少一种:数据库、具备数据存储功能的存储服务。
在一种可能的实现方式中,所述目标数据源包括下述至少一种:对象存储服务OSS、表格存储服务OTS、数据库MySQL、数据库SQL Server、数据库Postgres、关系型数据 库PolarDB、分布式文档存储数据库MangoDB,和数据库Redis。
根据本公开的第三方面,提供了一种数据表的创建装置,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为执行上述第一方面所述的数据表的创建方法。
根据本公开的第四方面,提供了一种非易失性计算机可读存储介质,其上存储有计算机程序指令,其中,所述计算机程序指令被处理器执行时实现上述第一方面所述的数据表的创建方法。
通过接收用户输入的包括数据源标识的数据表创建指令,确定该数据源标识指示的目标数据源中的数据结构信息,进而根据目标数据源中的数据结构信息,自动生成用于创建目标数据源对应的数据表的建表语句,使得可以避免用户手动输入字段,从而可以提高建表效率。
根据下面参考附图对示例性实施例的详细说明,本公开的其它特征及方面将变得清楚。
附图说明
包含在说明书中并且构成说明书的一部分的附图与说明书一起示出了本公开的示例性实施例、特征和方面,并且用于解释本公开的原理。
图1示出本公开一实施例的数据表的创建方法的流程示意图;
图2示出本公开一实施例的数据表的创建方法的示意图;
图3示出本公开一实施例的数据表的创建装置的结构示意图;
图4示出本公开一实施例的电子设备的结构示意图。
具体实施方式
以下将参考附图详细说明本公开的各种示例性实施例、特征和方面。附图中相同的附图标记表示功能相同或相似的元件。尽管在附图中示出了实施例的各种方面,但是除非特别指出,不必按比例绘制附图。
在这里专用的词“示例性”意为“用作例子、实施例或说明性”。这里作为“示例性”所说明的任何实施例不必解释为优于或好于其它实施例。
另外,为了更好的说明本公开,在下文的具体实施方式中给出了众多的具体细节。 本领域技术人员应当理解,没有某些具体细节,本公开同样可以实施。在一些实例中,对于本领域技术人员熟知的方法、手段、元件和电路未作详细描述,以便于凸显本公开的主旨。
数据湖是一种新型的数据仓库解决方案,数据湖本身不存储数据,而是在用户需要时,从底层数据存储中读取数据。例如,数据湖从企业的多个数据源获取原始数据,并且针对不同的目的,同一份原始数据还可能有多种满足特定内部模型格式的数据副本,因此,数据湖中被处理的数据可能是结构化数据,也可能是非结构化数据。
目前,在数据湖领域,正如背景技术部分陈述的,创建数据源的数据表需要用户手动输入数据表中的各个字段,但是,由于数据源(例如,企业的业务数据库)中包括的字段较多,手动输入字段导致建表效率较低。
本公开提供的数据表的创建方法可以应用于数据湖领域的数据表创建场景,以实现自动生成建表语句,避免用户手动输入字段,提高建表效率。下面以数据湖领域为例详细介绍本公开提供的数据表的创建方法。本领域技术人员应当理解,数据湖领域仅是本公开的一个应用场景示例,并不构成对本公开的限定,本公开提供的数据表的创建方法还可以应用于其它的应用场景。
图1示出本公开一实施例的数据表的创建方法的流程示意图。如图1所示,该方法可以包括:
步骤S11,接收用户输入的数据表创建指令,数据表创建指令中包括数据源标识。
步骤S12,确定数据源标识指示的目标数据源中的数据结构信息。
步骤S13,根据目标数据源中的数据结构信息,生成目标数据源的建表语句,建表语句用于创建目标数据源对应的数据表。
用户希望针对目标数据源创建数据表时,向数据湖输入包括数据源标识的数据表创建指令,进而数据湖确定数据源标识指示的目标数据源中的数据结构,从而可以根据该数据结构信息,在数据湖中自动生成用于创建目标数据源对应的数据表的建表语句,以避免用户手动输入数据表中的字段,提高建表效率。
在一种可能的实现方式中,目标数据源包括下述至少一种:数据库、具备数据存储功能的存储服务。
目标数据源可以是用于存储结构化数据的数据库,也可以是用于存储非结构化数据的具备数据存储功能的存储服务,还可以是其它数据存储,本公开对此不作具体限定。
在一种可能的实现方式中,目标数据源包括下述至少一种:对象存储服务OSS、表格存储服务OTS、数据库MySQL、数据库SQL Server、数据库Postgres、关系型数据库PolarDB、分布式文档存储数据库MangoDB,和数据库Redis。
图2示出本公开一实施例的数据表的创建方法的流程示意图。如图2所示,底层数据源包括对象存储服务OSS、表格存储服务OTS、数据库MySQL、数据库SQL Server、数据库Postgres、关系型数据库PolarDB、分布式文档存储数据库MangoDB,和数据库Redis,数据湖可以为底层数据源创建数据表,从而可以基于数据表对底层数据源中的数据进行查询读取。
在一示例中,数据表创建指令为结构化查询语言(SQL,Structured Query Language)。
在一示例中,如图2所示,用户希望针对分布式文档存储数据库MangoDB(目标数据源)创建数据表时,用户向数据湖中输入数据表创建指令:
create external table data_lake_table like mapping('mongodb_collection')。
其中,'mongodb_collection'为数据源标识,用于指示目标数据源MangoDB。
在一示例中,用户希望针对对象存储服务OSS(目标数据源)创建数据表时,用户向数据湖中输入数据表创建指令:
create external table data_lake_table like mapping('oss://test-bucket/my-file')。
其中,'oss://test-bucket/my-file'为数据源标识,用于指示目标数据源OSS。
在一示例中,用户希望针对数据库MySQL(目标数据源)创建数据表时,用户向数据湖中输入数据表创建指令:
create external table data_lake_table like mapping('mysql_table')。
其中,'mysql_table'为数据源标识,用于指示目标数据源MySQL。
数据表创建指令的语法格式可以根据实际情况进行改变,本公开对此不作具体限定。
例如,用户希望针对分布式文档存储数据库MangoDB创建数据表时,数据表创建指令除了可以为上述记载之外,还可以为:create external table data_lake_table like mapping mongodb_collection;或create external table data_lake_table like underlying mongodb_collection。
在一种可能的实现方式中,确定数据源标识指示的目标数据源中的数据结构信息,包括:确定目标数据源中的各个数据项,以及任一数据项对应的第一数据类型标识,作为数据结构信息。
数据湖接收到用户输入的包括数据源标识的数据表创建指令之后,数据湖的引擎可以自动对数据源标识指示的目标数据源中的数据结构进行分析推导,确定目标数据源中的数据结构信息:各个数据项,以及任一数据项对应的第一数据类型标识。
在一种可能的实现方式中,确定数据源标识指示的目标数据源中的数据结构信息,包括:提取目标数据源中存储的至少一条数据记录;根据该至少一条数据记录,确定目标数据源中的数据结构信息。
仍以上述图2为例,数据湖接收到用户输入的数据表创建指令:create external table data_lake_table like mapping('mongodb_collection')后,数据湖从分布式文档存储数据库MangoDB中提取一条数据记录进行分析推导,确定分布式文档存储数据库MangoDB中的数据结构信息。
例如,{"_id":"ObjectId("5c134c3f36d9cf6ad7077043")""id":1"name":"james""age":10"create_time":"ISODate("2018-12-14T06:22:54.369Z")"}为提取的数据记录,根据该数据记录,数据湖分析推导确定分布式文档存储数据库MangoDB中包括四个数据项:年龄age、创建时间creat_time、标识id和姓名name;其中,年龄age对应的第一数据类型标识为double,用于指示的数据类型为双精度浮点类型;创建时间creat_time对应的第一数据类型标识为timestamp,用于指示的数据类型为时间戳字符序列类型;标识id对应的第一数据类型标识为double,用于指示的数据类型为双精度浮点类型;姓名name对应的第一数据类型标识为varchar,用于指示的数据类型为字符串类型。
在一种可能的实现方式中,根据目标数据源中的数据结构信息,生成数据源的建表语句,包括:根据目标数据源中的各个数据项,确定建表语句中的至少一个字段;根据任一数据项对应的第一数据类型标识,确定该数据项对应的字段的第二数据类型标识,其中,第一数据类型标识指示的数据类型和第二数据类型标识指示的数据类型相同。
在一种可能的实现方式中,根据指示相同数据类型的第一数据类型标识所确定的第二数据类型标识是相同的。
在不同的数据源中,指示相同数据类型的第一数据类型标识可能不相同。例如,在 分布式文档存储数据库MangoDB中,指示字符串类型的第一数据类型标识为string,而在数据库MySQL中,指示字符串类型的第一数据类型标识为varchar。数据湖中对指示相同数据类型的不同第一数据类型标识进行统一映射,即根据任一数据项对应的第一数据类型标识,确定该数据项对应的字段的第二数据类型标识时,根据指示相同数据类型的第一数据类型标识所确定的第二数据类型标识是相同的。
例如,在数据湖中,指示字符串类型的第二数据类型标识为varchar。创建分布式文档存储数据库MangoDB对应的数据表时,针对分布式文档存储数据库MangoDB中第一数据类型标识为string(用于指示字符串类型)的数据项,确定该数据项对应的字段的第二数据类型标识为varchar;创建数据库MySQL对应的数据表时,针对数据库MySQL中第一数据类型标识为varchar(用于指示字符串类型)的数据项,确定该数据项对应的字段的第二数据类型标识仍为varchar。
仍以上述图2为例,数据湖确定的分布式文档存储数据库MangoDB中的数据结构信息后,根据该数据结构信息,自动生成用于创建分布式文档存储数据库MangoDB对应的数据表的建表语句。
例如,用于创建分布式文档存储数据库MangoDB对应的数据表的建表语句为:
CREATE EXTERNAL TABLE'data_lake_table',//在数据湖中创建数据表;
'age'double NULL COMMENT,//创建一个字段age,数据类型为双精度浮点类型;
'create_time'timestamp NULL COMMENT,//创建一个字段create_time,数据类型为时间戳字符序列类型;
'id'double NULL COMMENT,//创建一个字段id,数据类型为双精度浮点类型;
'name'varchar NULL COMMENT,//创建一个字段name,数据类型为字符串类型;
TBLPROPERTIES(TABLE_MAPPING='mongo_test.mongo_collection')。
数据湖基于建表语句,创建目标数据源对应的数据表,进而用户可以在数据湖中基于该数据表,对目标数据源中的数据进行查询。
仍以上述图2为例,数据湖自动生成用于创建分布式文档存储数据库MangoDB对应的数据表的建表语句之后,基于该建表语句创建分布式文档存储数据库MangoDB对应的数据表。当数据湖接收到用户输入的针对分布式文档存储数据库MangoDB的数据查询指令时,数据湖可以基于该数据表,对分布式文档存储数据库MangoDB中的数据进行查询。
通过接收用户输入的包括数据源标识的数据表创建指令,确定该数据源标识指示的目标数据源中的数据结构信息,进而根据目标数据源中的数据结构信息,自动生成用于创建目标数据源对应的数据表的建表语句,使得可以避免用户手动输入字段,从而可以提高建表效率。
图3示出本公开一实施例的数据表的创建装置的结构示意图。图3所示的装置30可以用于执行图1所示方法实施例的步骤,装置30包括:
接收模块31,用于接收用户输入的数据表创建指令,数据表创建指令中包括数据源标识;
确定模块32,用于确定数据源标识指示的目标数据源中的数据结构信息;
创建模块33,用于根据目标数据源中的数据结构信息,生成目标数据源的建表语句,建表语句用于创建目标数据源对应的数据表。
在一种可能的实现方式中,确定模块32包括:
提取子模块,用于提取目标数据源中存储的至少一条数据记录;
第一确定子模块,用于根据该至少一条数据记录,确定目标数据源中的数据结构信息。
在一种可能的实现方式中,确定模块32具体用于:
确定目标数据源中的各个数据项,以及任一数据项对应的第一数据类型标识,作为数据结构信息。
在一种可能的实现方式中,创建模块33包括:
第二确定子模块,用于根据目标数据源中的各个数据项,确定建表语句中的至少一个字段;
第三确定子模块,用于根据任一数据项对应的第一数据类型标识,确定该数据项对应的字段的第二数据类型标识,其中,第一数据类型标识指示的数据类型和第二数据类型标识指示的数据类型相同。
在一种可能的实现方式中,根据指示相同数据类型的第一数据类型标识所确定的第二数据类型标识是相同的。
在一种可能的实现方式中,目标数据源包括下述至少一种:
数据库、具备数据存储功能的存储服务。
在一种可能的实现方式中,目标数据源包括下述至少一种:
对象存储服务OSS、表格存储服务OTS、数据库MySQL、数据库SQL Server、数据库Postgres、关系型数据库PolarDB、分布式文档存储数据库MangoDB,和数据库Redis。
本公开提供的装置30能够实现图1所示方法实施例中的各个步骤,并实现相同的技术效果,为避免重复,这里不再赘述。
图4示出本公开一实施例的电子设备的结构示意图。如图4所示,在硬件层面,该电子设备包括处理器,可选地还包括内部总线、网络接口、存储器。其中,存储器可能包含内存,例如高速随机存取存储器(Random-Access Memory,RAM),也可能还包括非易失性存储器(non-volatile memory),例如至少1个磁盘存储器等。当然,该电子设备还可能包括其他业务所需要的硬件。
处理器、网络接口和存储器可以通过内部总线相互连接,该内部总线可以是ISA(Industry Standard Architecture,工业标准体系结构)总线、PCI(Peripheral Component Interconnect,外设部件互连标准)总线或EISA(Extended Industry Standard Architecture,扩展工业标准结构)总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图4中仅用一个双向箭头表示,但并不表示仅有一根总线或一种类型的总线。
存储器,存放程序。具体地,程序可以包括程序代码,所述程序代码包括计算机操作指令。存储器可以包括内存和非易失性存储器,并向处理器提供指令和数据。
处理器从非易失性存储器中读取对应的计算机程序到内存中然后运行,在逻辑层面上形成数据表的创建装置。处理器,执行存储器所存放的程序,并具体执行:接收用户输入的数据表创建指令,数据表创建指令中包括数据源标识;确定数据源标识指示的目标数据源中的数据结构信息;根据目标数据源中的数据结构信息,生成目标数据源的建表语句,所述建表语句用于创建所述目标数据源对应的数据表。
在一种可能的实现方式中,处理器被具体配置为执行:提取目标数据源中存储的至少一条数据记录;根据该至少一条数据记录,确定目标数据源中的数据结构信息。
在一种可能的实现方式中,处理器被具体配置为执行:确定目标数据源中的各个数据项,以及任一数据项对应的第一数据类型标识,作为数据结构信息。
在一种可能的实现方式中,处理器被具体配置为执行:根据目标数据源中的各个数 据项,确定建表语句中的至少一个字段;根据任一数据项对应的第一数据类型标识,确定该数据项对应的字段的第二数据类型标识,其中,第一数据类型标识指示的数据类型和第二数据类型标识指示的数据类型相同。
在一种可能的实现方式中,根据指示相同数据类型的第一数据类型标识所确定的第二数据类型标识是相同的。
在一种可能的实现方式中,目标数据源包括下述至少一种:数据库、具备数据存储功能的存储服务。
在一种可能的实现方式中,目标数据源包括下述至少一种:对象存储服务OSS、表格存储服务OTS、数据库MySQL、数据库SQL Server、数据库Postgres、关系型数据库PolarDB、分布式文档存储数据库MangoDB,和数据库Redis。
处理器可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本说明书实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本说明书实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。
该电子设备可执行图1所示方法实施例执行的方法,并实现上述图1所示
方法实施例的功能,本说明书实施例在此不再赘述。
本说明书实施例还提出了一种计算机可读存储介质,该计算机可读存储介质存储一个或多个程序,该一个或多个程序包括指令,该指令当被包括多个应用程序的电子设备执行时,能够使该电子设备执行图1所示实施例中的数据表的创建方法,并具体执行图1所示方法实施例的步骤。
本公开可以是系统、方法和/或计算机程序产品。计算机程序产品可以包括计算机可读存储介质,其上载有用于使处理器实现本公开的各个方面的计算机可读程序指令。
计算机可读存储介质可以是可以保持和存储由指令执行设备使用的指令的有形设备。计算机可读存储介质例如可以是――但不限于――电存储设备、磁存储设备、光存储设备、电磁存储设备、半导体存储设备或者上述的任意合适的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、静态随机存取存储器(SRAM)、便携式压缩盘只读存储器(CD-ROM)、数字多功能盘(DVD)、记忆棒、软盘、机械编码设备、例如其上存储有指令的打孔卡或凹槽内凸起结构、以及上述的任意合适的组合。这里所使用的计算机可读存储介质不被解释为瞬时信号本身,诸如无线电波或者其他自由传播的电磁波、通过波导或其他传输媒介传播的电磁波(例如,通过光纤电缆的光脉冲)、或者通过电线传输的电信号。
这里所描述的计算机可读程序指令可以从计算机可读存储介质下载到各个计算/处理设备,或者通过网络、例如因特网、局域网、广域网和/或无线网下载到外部计算机或外部存储设备。网络可以包括铜传输电缆、光纤传输、无线传输、路由器、防火墙、交换机、网关计算机和/或边缘服务器。每个计算/处理设备中的网络适配卡或者网络接口从网络接收计算机可读程序指令,并转发该计算机可读程序指令,以供存储在各个计算/处理设备中的计算机可读存储介质中。
用于执行本公开操作的计算机程序指令可以是汇编指令、指令集架构(ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码,所述编程语言包括面向对象的编程语言—诸如Smalltalk、C++等,以及常规的过程式编程语言—诸如“C”语言或类似的编程语言。计算机可读程序指令可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络—包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。在一些实施例中,通过利用计算机可读程序指令的状态信息来个性化定制电子电路,例如可编程逻辑电路、现场可编程门阵列(FPGA)或可编程逻辑阵列(PLA),该电子电路可以执行计算机 可读程序指令,从而实现本公开的各个方面。
这里参照根据本公开实施例的方法、装置(系统)和计算机程序产品的流程图和/或框图描述了本公开的各个方面。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机可读程序指令实现。
这些计算机可读程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得计算机、可编程数据处理装置和/或其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的各个方面的指令。
也可以把计算机可读程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其它可编程数据处理装置、或其它设备上执行的指令实现流程图和/或框图中的一个或多个方框中规定的功能/动作。
附图中的流程图和框图显示了根据本公开的多个实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,所述模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
以上已经描述了本公开的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术的技术改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。

Claims (16)

  1. 一种数据表的创建方法,其特征在于,包括:
    接收用户输入的数据表创建指令,所述数据表创建指令中包括数据源标识;
    确定所述数据源标识指示的目标数据源中的数据结构信息;
    根据所述目标数据源中的数据结构信息,生成所述目标数据源的建表语句,所述建表语句用于创建所述目标数据源对应的数据表。
  2. 根据权利要求1所述的方法,其特征在于,确定所述数据源标识指示的目标数据源中的数据结构信息,包括:
    提取所述目标数据源中存储的至少一条数据记录;
    根据所述至少一条数据记录,确定所述目标数据源中的数据结构信息。
  3. 根据权利要求1或2所述的方法,其特征在于,确定所述数据源标识指示的目标数据源中的数据结构信息,包括:
    确定所述目标数据源中的各个数据项,以及任一数据项对应的第一数据类型标识,作为所述数据结构信息。
  4. 根据权利要求3所述的方法,其特征在于,根据所述目标数据源中的数据结构信息,生成所述目标数据源的建表语句,包括:
    根据所述目标数据源中的各个数据项,确定所述建表语句中的至少一个字段;
    根据所述任一数据项对应的第一数据类型标识,确定所述数据项对应的字段的第二数据类型标识,其中,所述第一数据类型标识指示的数据类型和所述第二数据类型标识指示的数据类型相同。
  5. 根据权利要求4所述的方法,其特征在于,根据指示相同数据类型的第一数据类型标识所确定的第二数据类型标识是相同的。
  6. 根据权利要求1所述的方法,其特征在于,所述目标数据源包括下述至少一种:
    数据库、具备数据存储功能的存储服务。
  7. 根据权利要求1所述的方法,其特征在于,所述目标数据源包括下述至少一种:
    对象存储服务OSS、表格存储服务OTS、数据库MySQL、数据库SQL Server、数据库Postgres、关系型数据库PolarDB、分布式文档存储数据库MangoDB,和数据库Redis。
  8. 一种数据表的创建装置,其特征在于,包括:
    接收模块,用于接收用户输入的数据表创建指令,所述数据表创建指令中包括数据源标识;
    确定模块,用于确定所述数据源标识指示的目标数据源中的数据结构信息;
    创建模块,用于根据所述目标数据源中的数据结构信息,生成所述目标数据源的建表语句,所述建表语句用于创建所述目标数据源对应的数据表。
  9. 根据权利要求8所述的装置,其特征在于,所述确定模块包括:
    提取子模块,用于提取所述目标数据源中存储的至少一条数据记录;
    第一确定子模块,用于根据所述至少一条数据记录,确定所述目标数据源中的数据结构信息。
  10. 根据权利要求8或9所述的装置,其特征在于,所述确定模块具体用于:
    确定所述目标数据源中的各个数据项,以及任一数据项对应的第一数据类型标识,作为所述数据结构信息。
  11. 根据权利要求10所述的装置,其特征在于,所述创建模块包括:
    第二确定子模块,用于根据所述目标数据源中的各个数据项,确定所述建表语句中的至少一个字段;
    第三确定子模块,用于根据所述任一数据项对应的第一数据类型标识,确定所述数据项对应的字段的第二数据类型标识,其中,所述第一数据类型标识指示的数据类型和所述第二数据类型标识指示的数据类型相同。
  12. 根据权利要求11所述的装置,其特征在于,根据指示相同数据类型的第一数据类型标识所确定的第二数据类型标识是相同的。
  13. 根据权利要求8所述的装置,其特征在于,所述目标数据源包括下述至少一种:
    数据库、具备数据存储功能的存储服务。
  14. 根据权利要求8所述的装置,其特征在于,所述目标数据源包括下述至少一种:
    对象存储服务OSS、表格存储服务OTS、数据库MySQL、数据库SQL Server、数据库Postgres、关系型数据库PolarDB、分布式文档存储数据库MangoDB,和数据库Redis。
  15. 一种数据表的创建装置,其特征在于,包括:
    处理器;
    用于存储处理器可执行指令的存储器;
    其中,所述处理器被配置为执行权利要求1-7任一项所述的数据表的创建方法。
  16. 一种非易失性计算机可读存储介质,其上存储有计算机程序指令,其特征在于,所述计算机程序指令被处理器执行时实现权利要求1-7任一项所述的数据表的创建方法。
PCT/CN2020/083092 2019-04-17 2020-04-03 一种数据表的创建方法和装置 Ceased WO2020211657A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910310499.9 2019-04-17
CN201910310499.9A CN111831638B (zh) 2019-04-17 2019-04-17 一种数据表的创建方法和装置

Publications (1)

Publication Number Publication Date
WO2020211657A1 true WO2020211657A1 (zh) 2020-10-22

Family

ID=72838062

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/083092 Ceased WO2020211657A1 (zh) 2019-04-17 2020-04-03 一种数据表的创建方法和装置

Country Status (2)

Country Link
CN (1) CN111831638B (zh)
WO (1) WO2020211657A1 (zh)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114116713A (zh) * 2021-11-18 2022-03-01 新华三大数据技术有限公司 数据处理方法、装置、电子设备及计算机可读存储介质
CN114647648A (zh) * 2022-04-12 2022-06-21 深圳市震有软件科技有限公司 关系型数据库的表结构导入方法、系统、装置及存储介质
CN114968613A (zh) * 2022-03-30 2022-08-30 苏州浪潮智能科技有限公司 多源异时数据处理方法、装置、计算机设备及存储介质
CN115237903A (zh) * 2021-04-22 2022-10-25 中国移动通信集团安徽有限公司 宽表的生成方法、装置、设备及存储介质
CN115391619A (zh) * 2022-08-26 2022-11-25 京东方科技集团股份有限公司 数据解析方法、装置、电子设备及存储介质
CN115964412A (zh) * 2022-12-28 2023-04-14 精英数智科技股份有限公司 数据统计处理方法、系统、电子设备及存储介质
CN116263767A (zh) * 2021-12-15 2023-06-16 武汉中仪物联技术股份有限公司 数据库表生成方法及系统
CN116627928A (zh) * 2022-02-14 2023-08-22 腾讯科技(深圳)有限公司 数据库迁移方法、装置、设备和存储介质

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113076320B (zh) * 2021-04-20 2024-08-16 北京沃东天骏信息技术有限公司 配置数据表的方法、装置、设备和计算机可读介质
CN114154469B (zh) * 2021-12-02 2024-12-31 北京字跳网络技术有限公司 一种文档的表格处理方法、装置、设备及介质
CN114385733B (zh) * 2021-12-31 2024-12-24 上海柯林布瑞信息技术有限公司 Etl过程中数据模型统一创建方法和装置
CN115168350B (zh) * 2022-06-30 2025-10-21 南斗六星系统集成有限公司 车联网元数据管理方法、装置、设备及可读存储介质
CN115687349A (zh) * 2022-10-28 2023-02-03 海尔优家智能科技(北京)有限公司 数据库表的生成方法及装置、存储介质及电子装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101661508A (zh) * 2009-09-29 2010-03-03 金蝶软件(中国)有限公司 一种应用于多技术平台的生成表单的方法及装置
CN104899045A (zh) * 2015-06-23 2015-09-09 上海斐讯数据通信技术有限公司 一种通用的软件编码辅助系统及方法
CN105608088A (zh) * 2014-11-19 2016-05-25 中国航空工业集团公司西安飞机设计研究所 一种基于配置文件的数据库自动创建与数据动态记录方法
US20170091234A1 (en) * 2015-09-29 2017-03-30 Zekko Inc. Database cooperating system and database cooperating program
CN108170809A (zh) * 2017-12-28 2018-06-15 平安科技(深圳)有限公司 建表脚本生成方法、装置、设备及计算机可读存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10360236B2 (en) * 2015-09-25 2019-07-23 International Business Machines Corporation Replicating structured query language (SQL) in a heterogeneous replication environment
CN108197091B (zh) * 2016-12-08 2022-12-09 腾讯科技(深圳)有限公司 一种创建数据表的方法、系统及相关设备
CN108241670A (zh) * 2016-12-26 2018-07-03 北京国双科技有限公司 数据库语句生成方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101661508A (zh) * 2009-09-29 2010-03-03 金蝶软件(中国)有限公司 一种应用于多技术平台的生成表单的方法及装置
CN105608088A (zh) * 2014-11-19 2016-05-25 中国航空工业集团公司西安飞机设计研究所 一种基于配置文件的数据库自动创建与数据动态记录方法
CN104899045A (zh) * 2015-06-23 2015-09-09 上海斐讯数据通信技术有限公司 一种通用的软件编码辅助系统及方法
US20170091234A1 (en) * 2015-09-29 2017-03-30 Zekko Inc. Database cooperating system and database cooperating program
CN108170809A (zh) * 2017-12-28 2018-06-15 平安科技(深圳)有限公司 建表脚本生成方法、装置、设备及计算机可读存储介质

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115237903A (zh) * 2021-04-22 2022-10-25 中国移动通信集团安徽有限公司 宽表的生成方法、装置、设备及存储介质
CN114116713A (zh) * 2021-11-18 2022-03-01 新华三大数据技术有限公司 数据处理方法、装置、电子设备及计算机可读存储介质
CN116263767A (zh) * 2021-12-15 2023-06-16 武汉中仪物联技术股份有限公司 数据库表生成方法及系统
CN116627928A (zh) * 2022-02-14 2023-08-22 腾讯科技(深圳)有限公司 数据库迁移方法、装置、设备和存储介质
CN114968613A (zh) * 2022-03-30 2022-08-30 苏州浪潮智能科技有限公司 多源异时数据处理方法、装置、计算机设备及存储介质
CN114647648A (zh) * 2022-04-12 2022-06-21 深圳市震有软件科技有限公司 关系型数据库的表结构导入方法、系统、装置及存储介质
CN115391619A (zh) * 2022-08-26 2022-11-25 京东方科技集团股份有限公司 数据解析方法、装置、电子设备及存储介质
CN115964412A (zh) * 2022-12-28 2023-04-14 精英数智科技股份有限公司 数据统计处理方法、系统、电子设备及存储介质

Also Published As

Publication number Publication date
CN111831638B (zh) 2025-01-10
CN111831638A (zh) 2020-10-27

Similar Documents

Publication Publication Date Title
WO2020211657A1 (zh) 一种数据表的创建方法和装置
US11983640B2 (en) Generating question templates in a knowledge-graph based question and answer system
US11194779B2 (en) Generating an index for a table in a database background
US11200291B2 (en) Automated generation of web API descriptions from usage data
CN111666372B (zh) 解析查询词query的方法、装置、电子设备和可读存储介质
CN111553556A (zh) 业务数据分析方法、装置、计算机设备及存储介质
US9417991B2 (en) Translation verification testing
US10353874B2 (en) Method and apparatus for associating information
CN113779071A (zh) 一种数据库的查询方法、装置、设备及存储介质
CN109977233A (zh) 一种成语知识图谱构建方法及装置
WO2018171289A1 (zh) 向数据库存储数据的方法、设备、中间件设备和服务器
CN111401034A (zh) 文本的语义分析方法、语义分析装置及终端
WO2025139355A1 (zh) 代码分析
CN115061990A (zh) 日志存储方法、日志检索方法、装置、设备及存储介质
CN112989066B (zh) 数据处理方法和装置、电子设备、计算机可读介质
US10073871B2 (en) Database entity analysis
CN111309596A (zh) 数据库测试方法、装置、终端设备及存储介质
CN104572904B (zh) 一种标签关联程度的确定方法及装置
CN119848841A (zh) 一种代码分析方法及相关设备
CN111666278A (zh) 数据存储、检索方法、电子设备及存储介质
US20170124219A1 (en) Determining data field offsets using a document object model representation
CN114443701A (zh) 数据流处理方法、电子设备和计算机程序产品
CN114896269A (zh) 结构化查询语句检测方法、装置、电子设备及存储介质
US20140059011A1 (en) Automated data curation for lists
CN116483735B (zh) 一种代码变更的影响分析方法、装置、存储介质及设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20790504

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20790504

Country of ref document: EP

Kind code of ref document: A1