SQL generation implementation method, device and equipment based on DSL conversion engine

Through the DSL conversion engine parsing and generating SQL scripts, it solves the problem that users find it difficult to edit SQL statements, and achieves fast and accurate user data acquisition.

CN120277085APending Publication Date: 2025-07-08HANGZHOU SHUYUN INFORMATION TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510769243.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-10
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

When users only master language scripts in specific fields and do not understand SQL scripts, it is difficult to edit SQL statements quickly and accurately, resulting in inefficient acquisition of data from the database.

Method used

Through the DSL conversion engine, the initial DSL script is obtained based on user data filtering instructions, and the preset DSL parsing strategy is used to parse and generate target SQL scripts to achieve rapid acquisition of user data.

Benefits of technology

It realizes the rapid and accurate acquisition of target user data in the user database, improving the efficiency and accuracy of data acquisition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120277085A_ABST
    Figure CN120277085A_ABST
Patent Text Reader

Abstract

The invention discloses an SQL generation implementation method, device and equipment based on a DSL conversion engine, and the method comprises the steps: obtaining an initial DSL script corresponding to a user data screening instruction in response to the user data screening instruction; based on a DSL analysis strategy preset in a DSL conversion engine, analyzing the initial DSL script and generating an SQL statement to obtain a target SQL script; acquiring corresponding target user data in a local user database according to the target SQL script; and if a target user data acquisition request sent by the user terminal is detected, sending the target user data to the user terminal. According to the embodiment of the invention, the initial DSL script which at least comprises the user behavior condition and the user feature data can be quickly converted into the target SQL script which can be automatically executed and is used for carrying out user data query in the local user database, so that the target user data can be quickly and accurately obtained and related data application is carried out.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of big data processing, and particularly to a method, device and equipment for implementing SQL generation based on a DSL conversion engine. Background Art

[0002] Currently, when enterprises carry out their own business, they accumulate a large amount of user data and store it in a local database. If a user needs to obtain the required user data, they need to first edit an SQL statement (SQL statement is a structured query language statement) based on professional knowledge, and then execute the SQL statement to obtain the corresponding user data. By querying data in the above way of editing SQL statements, the user needs to clearly understand the data structure of the database in order to quickly edit the corresponding SQL statement according to the requirements. When the user only masters a specific domain language script and does not understand the SQL script, it is very difficult to quickly and accurately edit the SQL statement for specific use, resulting in low efficiency in obtaining data from the database. Summary of the Invention

[0003] Embodiments of the present invention provide a method, device and equipment for implementing SQL generation based on a DSL conversion engine, aiming to solve the problem in the prior art that when a user only masters a specific domain language script and does not understand the SQL script, it is very difficult to quickly and accurately edit the SQL statement for specific use, resulting in low efficiency in obtaining data from the database.

[0004] In a first aspect, embodiments of the present invention provide a method for implementing SQL generation based on a DSL conversion engine, which includes: In response to a user data filtering instruction, obtain an initial DSL script corresponding to the user data filtering instruction; wherein, the initial DSL script is an initial specific domain language script, and at least includes user behavior conditions, user feature data, time windows and logical operators in the initial DSL script; Based on a preset DSL parsing strategy in the DSL conversion engine, parse the initial DSL script and generate an SQL statement to obtain a target SQL script; wherein, the target SQL script is a target structured query language script; Obtain corresponding target user data in the local user database according to the target SQL script; If a target user data acquisition request sent by a user terminal is detected, send the target user data to the user terminal.

[0005] In a second aspect, embodiments of the present invention further provide a device for implementing SQL generation based on a DSL conversion engine, which includes: An initial DSL script acquisition unit, configured to acquire an initial DSL script corresponding to the user data filtering instruction in response to the user data filtering instruction; wherein, the initial DSL script is an initial domain-specific language script, and at least includes user behavior conditions, user feature data, a time window, and logical operators in the initial DSL script; A target SQL script generation unit, configured to parse the initial DSL script and generate SQL statements based on a preset DSL parsing strategy in the DSL conversion engine to obtain a target SQL script; wherein, the target SQL script is a target structured query language script; A target user data acquisition unit, configured to acquire corresponding target user data in a local user database according to the target SQL script; A data sending unit, configured to send the target user data to the user terminal if a target user data acquisition request sent by the user terminal is detected.

[0006] In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, and a computer program is stored on the memory, and when the processor executes the computer program, the method described in the first aspect above is implemented.

[0007] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, and the computer storage medium stores a computer program, and the computer program includes program instructions, and when the program instructions are executed by a processor, the method described in the first aspect above can be implemented.

[0008] An embodiment of the present invention provides a method, device, and equipment for implementing SQL generation based on a DSL conversion engine. The method includes: acquiring an initial DSL script corresponding to a user data filtering instruction in response to the user data filtering instruction; parsing the initial DSL script and generating SQL statements based on a preset DSL parsing strategy in the DSL conversion engine to obtain a target SQL script; acquiring corresponding target user data in a local user database according to the target SQL script; and sending the target user data to the user terminal if a target user data acquisition request sent by the user terminal is detected. The embodiment of the present invention can quickly convert an initial DSL script including at least user behavior conditions and user feature data into a target SQL script that can be automatically executed and query user data in a local user database, so as to quickly and accurately acquire target user data and perform related data applications. Description of the Drawings

[0009] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0010] Figure 1 Schematic diagram of the application scenario of the SQL generation implementation method based on the DSL conversion engine provided by the embodiment of the present invention; Figure 2 Schematic diagram of the process of the SQL generation implementation method based on the DSL conversion engine provided by the embodiment of the present invention; Figure 3 Schematic diagram of the sub-process of the SQL generation implementation method based on the DSL conversion engine provided by the embodiment of the present invention; Figure 4 Another schematic diagram of the process of the SQL generation implementation method based on the DSL conversion engine provided by the embodiment of the present invention; Figure 5 Schematic block diagram of the SQL generation implementation device based on the DSL conversion engine provided by the embodiment of the present invention; Figure 6 Schematic block diagram of the computer device provided by the embodiment of the present invention. Detailed implementation manners

[0011] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.

[0012] It should be understood that when used in this specification and the appended claims, the terms "comprises" and "comprising" indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.

[0013] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in this specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms.

[0014] It should also be further understood that the term "and / or" used in the specification and appended claims of the present invention refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0015] Please refer to Figure 1 and Figure 2 simultaneously, where Figure 1 is a schematic diagram of a scenario of the SQL generation implementation method based on a DSL conversion engine according to an embodiment of the present invention, Figure 2 and is a schematic flowchart of the SQL generation implementation method based on a DSL conversion engine provided by an embodiment of the present invention. As Figure 1 shown, the SQL generation implementation method based on a DSL conversion engine provided by an embodiment of the present invention is applied to the server 10, and the server 10 is communicatively connected to the user terminal 20. As Figure 2 shown, the method includes the following steps S110-S140.

[0016] S110. In response to a user data filtering instruction, obtain an initial DSL script corresponding to the user data filtering instruction.

[0017] Wherein, the initial DSL script is an initial domain-specific language script, and at least includes user behavior conditions, user characteristic data, a time window, and logical operators in the initial DSL script.

[0018] In this embodiment, the technical solution is described with the server as the execution subject. A user data query platform is deployed in the server, and a DSL conversion engine is embedded and deployed in the user data query platform. After the user logs in to the user data query platform using the user terminal, the user can upload a user data filtering instruction and the corresponding initial DSL script on the user interaction interface of the user data query platform, or the user directly edits the initial DSL script in the specified script editing area (such as the dialog box area in the user interaction interface) of the user interaction interface, and then performs subsequent user data query and acquisition through the initial DSL script.

[0019] In one embodiment, before step S110, it further includes: Sending a DSL script template to the user terminal so that the user of the user terminal edits user behavior conditions, user characteristic data, a time window, and logical operators based on the DSL script template; Step S110 includes: If it is detected that the user terminal sends a user data filtering instruction, obtain the initial DSL script that at least includes user behavior conditions, user characteristic data, a time window, and logical operators sent by the user terminal based on the DSL script template.

[0020] In this embodiment, in order to facilitate the user to send the initial DSL script to the user data query platform in the server more quickly, the server can first send the DSL script template to the user terminal for the user to refer to when editing the initial DSL script; alternatively, a large language model can be deployed in the server, and the large language model can be based on the text entered by the user into the input box corresponding to the large language model (for example, how to write an initial DSL script for querying user data with XX user behavior), and the large language model can feedback the DSL script template to the user terminal based on the input text.

[0021] When the user refers to the DSL script template, he can edit the initial DSL script including user behavior conditions, user feature data, time window and logical operators. After completing the initial DSL script, he can click the start query virtual button in the user data query platform to trigger the generation of user data filtering instructions, and send the initial DSL script corresponding to the DSL script template to the server for subsequent user data query.

[0022] Among them, the user behavior conditions at least define specific field descriptions or field values ​​for data fields such as browsing behavior, clicking behavior, purchasing behavior, and payment behavior; the user characteristic data at least include data fields such as age, gender, region, level (such as user membership level) and the field values ​​corresponding to each field; the time window at least includes time types such as absolute time or relative time; the logical operators at least include AND (and operation), OR (or operation), NOT (negative operation), etc.

[0023] S120: Parse the initial DSL script and generate SQL statements based on a DSL parsing strategy preset in the DSL conversion engine to obtain a target SQL script.

[0024] The target SQL script is a target structured query language script.

[0025] In this embodiment, since the initial DSL script is a domain-specific language script, it is not possible to directly query user data in the local user database of the server according to the initial DSL script, so it is necessary to parse the initial DSL script and generate SQL statements according to the DSL parsing strategy in the DSL conversion engine pre-deployed by the user data query platform of the server to obtain a target SQL script. After the obtained target SQL script is executed, user data can be obtained from the user database.

[0026] In one embodiment, step S120 includes: Perform DSL deserialization parsing, DSL task splitting, DSL subtask parsing, and DSL subtask SQL conversion on the initial DSL script in sequence based on the DSL parsing strategy in the DSL conversion engine to obtain the target SQL script.

[0027] In this embodiment, when processing the initial DSL script through the DSL parsing strategy in the DSL conversion engine pre-deployed in the user data query platform of the server for converting it into an SQL script, it is at least necessary to perform DSL deserialization parsing, DSL task splitting, DSL subtask parsing, and DSL subtask SQL conversion on the initial DSL script in sequence, so as to obtain the target SQL script. It can be seen that through the above processing, the conversion of the DSL script to the SQL script can be quickly achieved through the DSL conversion engine.

[0028] In one embodiment, as Figure 3 shown, the performing DSL deserialization parsing, DSL task splitting, DSL subtask parsing, and DSL subtask SQL conversion on the initial DSL script in sequence based on the DSL parsing strategy in the DSL conversion engine to obtain the target SQL script includes: S121. Obtain the first sub-strategy in the DSL parsing strategy, and perform DSL deserialization parsing on the initial DSL script based on the first sub-strategy to obtain first parsing data; S122. Obtain the second sub-strategy in the DSL parsing strategy, and perform DSL task splitting on the first parsing data based on the second sub-strategy to obtain multiple DSL subtasks; S123. Obtain the third sub-strategy in the DSL parsing strategy, and perform parsing on each DSL subtask in the multiple DSL subtasks based on the third sub-strategy to obtain multiple DSL parsing subtasks corresponding to the multiple DSL subtasks; S124. Obtain the fourth sub-strategy in the DSL parsing strategy, and perform SQL conversion on each DSL parsing subtask in the multiple DSL parsing subtasks based on the fourth sub-strategy to obtain multiple sub-SQL scripts corresponding to the multiple DSL parsing subtasks, and form the target SQL script from the multiple sub-SQL scripts.

[0029] In this embodiment, performing DSL deserialization parsing on the initial DSL script through the first sub-strategy in the DSL parsing strategy to obtain the first parsing data is to extract key data in the initial DSL script to form a kind of structured data, such as extracting core data information such as user behavior conditions, user feature data, time windows, and logical operators in the initial DSL script, and finally forming the structured first parsing data.

[0030] The first parsed data is split into multiple DSL subtasks through the second sub-strategy in the DSL parsing strategy. The purpose is to split the first parsed data into multiple DSL subtasks to facilitate subsequent parallel execution and improve the efficiency of result acquisition. Moreover, when splitting the first parsed data into DSL subtasks through the second sub-strategy, specific task splitting can be performed by combining the task splitting strategy set in the first parsed data or the task splitting strategy preset in the server.

[0031] When each DSL subtask among multiple DSL subtasks is parsed through the third sub-strategy in the DSL parsing strategy, for example, each DSL subtask is in the JSON data format, and most of the information in it is not the information necessary for generating SQL. At this time, after extracting the key information required for generating SQL statements, multiple DSL parsing subtasks corresponding to the multiple DSL subtasks can be obtained.

[0032] Each DSL parsing subtask among multiple DSL parsing subtasks is subjected to SQL conversion through the fourth sub-strategy in the DSL parsing strategy. Specifically, an SQL script that can be directly executed in the server later is generated, and each SQL script includes corresponding SQL statements to perform corresponding data processing tasks (such as data query tasks). After completing multiple sub-SQL scripts, they can be aggregated to form the target SQL script. It can be seen that through the DSL conversion engine of the server, the automatic conversion of the DSL script is realized, and the final target SQL script that can be automatically executed is quickly obtained.

[0033] In one embodiment, step S121 includes: The initial DSL script is subjected to DSL deserialization parsing through the first sub-strategy, and user behavior conditions, the first logical operator for the user behavior conditions, user feature data, the second logical operator for the user feature data, time window, the third logical operator for the time window, and task splitting rule data are extracted and combined to form the first parsed data.

[0034] In this embodiment, before describing the specific process of the server specifically performing DSL deserialization parsing on the initial DSL script through the first sub-strategy, some important rules in the DSL rule types included in the DSL conversion engine are introduced in detail as follows: A1. The DSL rule type is COMMON_RULE, and the domain model is CommonExpression. The Chinese name corresponding to this DSL rule type is the general rule expression; A2. The DSL rule type is FIELD_RULE, the domain model is ModelExpression, and the corresponding Chinese name for this DSL rule type is attribute rule.

[0035] Among them, the query model corresponding to FIELD_RULE is fqn: data.prctvmkt.brand1.Member. For example, in its filtering conditions, the fieldName is memberName, the logical relationship is operator: EQ, and the value is value: sy, which means filtering the people in the member model whose name is equal to sy.

[0036] Another example, the rule type corresponding to COMMON_RULE is ruleType: COMMON_RULE, which also includes the FIELD_RULE as in the above example, but the filtering conditions are slightly different (such as setting the first fieldName to memberName, the logical relationship to operator: EQ, and the value to value: sy; the second fieldName to sex, the logical relationship to operator: EQ, and the value to value: male;), and the logical relationship is operator: AND, which means filtering the people in the member model whose name is equal to sy and whose gender is male.

[0037] Of course, only some important rules are listed among the above DSL rule types, and there are other rules that can be preset according to user needs.

[0038] After the above DSL rules are preset in the DSL conversion engine, users can edit DSL scripts based on the DSL rules without referring to the editing logic of SQL. Moreover, the logical operators between the above DSL rules at least include AND (AND), OR (OR), NOT (NOT), EQ (EQUAL TO), NE (NOT EQUAL TO), GT (GREATER THAN), GE (GREATER THAN OR EQUAL TO), LT (LESS THAN), LE (LESS THAN OR EQUAL TO), GT_LT (GREATER THAN AND LESS THAN), GT_LE (GREATER THAN AND LESS THAN OR EQUAL TO), GE_LT (GREATER THAN OR EQUAL TO AND LESS THAN), GE_LE (GREATER THAN OR EQUAL TO AND LESS THAN OR EQUAL TO), IN (BELONG TO), NOT_IN (NOT BELONG TO), INCLUDE_ANY (INCLUDE ANY VALUE), EXCLUDE_ALL (EXCLUDE ALL VALUES), L_LIKE (PREFIX MATCH), R_LIKE (SUFFIX MATCH), LIKE (FUZZY MATCH), NOT_LIKE (DO NOT MATCH), COUNT (COUNT), DISTINCT_COUNT (REMOVE DUPLICATES AND COUNT), SUM (SUM), MIN (MINIMUM VALUE), M (MAXIMUM VALUE), AVG (AVERAGE VALUE), AVG_PERIOD (AVERAGE PERIOD), FIRST (FIRST), LAST (LAST), ADD (ADDITION), SUB (SUBTRACTION), MUL (MULTIPLICATION), DIVIDE (DIVISION), DIV (INTEGER DIVISION), MOD (MODULUS), and DATE_FORMAT (DATE FORMAT).

[0039] The corresponding cycle time units in the DSL rules at least include YEAR (YEAR), WEEK (WEEK), SECOND (SECOND), QUARTER (QUARTER), MONTH (MONTH), MINUTE (MINUTE), HOUR (HOUR), FISCAL_YEAR (FISCAL YEAR), and DAY (DAY).

[0040] For example, the initial DSL script is represented in JSON data format as follows: {"ruleType": "COMMON_RULE", "rules": { "ruleType": "COMMON_RULE", "rules": { "ruleType": "FIELD", "fieldName": "age" }, { "ruleType": "CONSTANT", "value": 5 } , "operator": "GT" }, { "ruleType": "COMMON_RULE", "rules": { "ruleType": "FIELD", "fieldName": "city" }, { "ruleType": "CONSTANT", "value": ["North", "Shanghai", "Guangzhou", "Shenzhen"] } , "operator": "IN" } , "operator": "OR" } When performing DSL deserialization parsing on the initial DSL script through the first sub-strategy, two common rule expressions (COMMON_RULE) can be obtained. The first COMMON_RULE includes FIELD (attribute) and CONSTANT (constant), where the FIELD is defined as age and the value of CONSTANT is 2, and the logical operator between the above FIELD and CONSTANT is defined as GT (greater than). The actual purpose of the first COMMON_RULE is to filter out user data where the age is greater than 5. The second COMMON_RULE includes FIELD (attribute) and CONSTANT (constant), where the FIELD is defined as city and the values of CONSTANT are "North", "Shanghai", "Guangzhou", and "Shenzhen", and the logical operator between the above FIELD and CONSTANT is defined as IN (belong to). The actual purpose of the second COMMON_RULE is to filter out user data where the city where the user is located is "North", "Shanghai", "Guangzhou", or "Shenzhen". Finally, the user data filtered out by the two COMMON_RULEs are logically operated based on the logical operator OR (or) to obtain the user data filtering condition. Of course, only a DSL script including a small number of rules and logical operators is shown in the above example. In actual implementation, the DSL script can include more rules and logical operators to meet the user's data filtering requirements.

[0041] In one embodiment, step S122 includes: Obtain the task splitting rule data in the first parsed data, and perform DSL task splitting on the first parsed data based on the task splitting rule data to obtain multiple DSL subtasks.

[0042] In this embodiment, if the task splitting rule data is also included in the first parsed data, then specifically according to the task splitting rule data (such as the splitting rule corresponding to SPLIT_RULE), the first parsed data can be subjected to DSL task splitting through the task splitting rule data to obtain multiple DSL subtasks, thereby realizing fast task splitting.

[0043] S130. Obtain corresponding target user data in the local user database according to the target SQL script.

[0044] In this embodiment, when the acquisition of the target SQL script is completed, the target SQL script is automatically executed, so as to obtain corresponding target user data from the local user database, realizing the accurate screening and acquisition of the target user data.

[0045] In one embodiment, as Figure 4 shown, step S130 includes: S131. Obtain multiple sub-SQL scripts included in the target SQL script, and execute the multiple sub-SQL scripts to obtain corresponding target sub-user data from the user database; S132. Aggregate the target sub-user data corresponding to the multiple sub-SQL scripts respectively to form the target user data.

[0046] In this embodiment, since multiple sub-SQL scripts included in the target SQL script are obtained before, the multiple sub-SQL scripts are executed in parallel at this time, so as to respectively obtain the target sub-user data corresponding to each sub-SQL script. After that, the target sub-user data corresponding to the multiple sub-SQL scripts are aggregated respectively, so that the target user data corresponding to the initial DSL script and the target SQL script can be obtained, and the obtained target user data can be used for operations such as user data analysis and user behavior feature extraction on the server local.

[0047] S140. If a target user data acquisition request sent by the user terminal is detected, send the target user data to the user terminal.

[0048] In this embodiment, after the target user data corresponding to the initial DSL script and the target SQL script is obtained in the server, in addition to being able to use the data locally, it can also be sent to other terminals such as user terminals for data use. Specifically, when the server detects a target user data acquisition request sent by the user terminal and determines that the target user data acquisition request is for acquiring the target user data, the target user data is sent to the user terminal, thereby realizing cross-terminal transmission and use of user data.

[0049] It can be seen that the embodiment implementing this method can quickly convert an initial DSL script based on at least user behavior conditions and user feature data into a target SQL script that can be automatically executed and query user data in the local user database, thereby quickly and accurately obtaining the target user data and performing related data applications.

[0050] Figure 5 It is a schematic block diagram of an SQL generation implementation device based on a DSL conversion engine provided by an embodiment of the present invention. As Figure 5 shown, corresponding to the above SQL generation implementation method based on a DSL conversion engine, the present invention also provides an SQL generation implementation device 100 based on a DSL conversion engine. The SQL generation implementation device 100 based on a DSL conversion engine includes units for executing the above SQL generation implementation method based on a DSL conversion engine. Please refer to Figure 5 , the SQL generation implementation device 100 based on a DSL conversion engine includes: an initial DSL script acquisition unit 110, a target SQL script generation unit 120, a target user data acquisition unit 130, and a data sending unit 140.

[0051] The initial DSL script acquisition unit 110 is configured to acquire an initial DSL script corresponding to the user data screening instruction in response to the user data screening instruction.

[0052] Wherein, the initial DSL script is an initial specific domain language script, and at least user behavior conditions, user feature data, a time window, and logical operators are included in the initial DSL script.

[0053] In this embodiment, the technical solution is described with the server as the execution entity. A user data query platform is deployed in the server, and a DSL conversion engine is embedded and deployed in the user data query platform. After the user logs in to the user data query platform using the user terminal, on the user interaction interface of the user data query platform, the user can upload a user data screening instruction and the corresponding initial DSL script, or the user can directly edit the initial DSL script in the specified script editing area of the user interaction interface (such as the dialog box area in the user interaction interface), and then perform subsequent user data query and acquisition through the initial DSL script.

[0054] In one embodiment, the SQL generation implementation device 100 based on the DSL conversion engine further includes: A DSL script template sending unit, configured to send the DSL script template to the user terminal, so that the user of the user terminal can edit the user behavior condition, user feature data, time window, and logical operator based on the DSL script template; The initial DSL script obtaining unit 110 is specifically configured to: If a user data screening instruction sent by the user terminal is detected, obtain the initial DSL script that at least includes the user behavior condition, user feature data, time window, and logical operator sent by the user terminal based on the DSL script template.

[0055] In this embodiment, in order to facilitate the user to send the initial DSL script to the user data query platform in the server more quickly, first, the server can send the DSL script template to the user terminal for the user to refer to when editing the initial DSL script; alternatively, a large language model can also be deployed in the server, and the large language model can, according to the text input by the user into the input box corresponding to the large language model (such as how to write an initial DSL script for querying user data with XX user behavior), feedback the DSL script template to the user terminal based on the input text.

[0056] When the user refers to the DSL script template, the user can correspondingly edit the initial DSL script including the user behavior condition, user feature data, time window, and logical operator, and when the initial DSL script is completed, the user can click the start query virtual button in the user data query platform, thereby triggering the generation of a user data screening instruction and sending the initial DSL script corresponding to the DSL script template to the server for subsequent user data query.

[0057] Among them, the user behavior conditions at least define specific field descriptions or field values ​​for data fields such as browsing behavior, clicking behavior, purchasing behavior, and payment behavior; the user characteristic data at least include data fields such as age, gender, region, level (such as user membership level) and the field values ​​corresponding to each field; the time window at least includes time types such as absolute time or relative time; the logical operators at least include AND (and operation), OR (or operation), NOT (negative operation), etc.

[0058] The target SQL script generating unit 120 is used to parse the initial DSL script and generate SQL statements based on the DSL parsing strategy preset in the DSL conversion engine to obtain a target SQL script.

[0059] The target SQL script is a target structured query language script.

[0060] In this embodiment, since the initial DSL script is a domain-specific language script, it is not possible to directly query user data in the local user database of the server according to the initial DSL script, so it is necessary to parse the initial DSL script and generate SQL statements according to the DSL parsing strategy in the DSL conversion engine pre-deployed by the user data query platform of the server to obtain a target SQL script. After the obtained target SQL script is executed, user data can be obtained from the user database.

[0061] In one embodiment, the target SQL script generating unit 120 is specifically used for: Based on the DSL parsing strategy in the DSL conversion engine, the initial DSL script is sequentially subjected to DSL deserialization parsing, DSL task splitting, DSL subtask parsing and DSL subtask SQL conversion to obtain the target SQL script.

[0062] In this embodiment, when the DSL parsing strategy in the DSL conversion engine pre-deployed by the user data query platform of the server processes the initial DSL script to convert it into an SQL script, at least the initial DSL script needs to be sequentially subjected to DSL deserialization parsing, DSL task splitting, DSL subtask parsing, and DSL subtask SQL conversion, so as to obtain the target SQL script. It can be seen that through the above processing, the conversion of the DSL script to the SQL script can be quickly realized through the DSL conversion engine.

[0063] In one embodiment, the target SQL script generating unit 120 is specifically used for: Acquire a first sub-strategy in the DSL parsing strategy, and perform DSL deserialization parsing on the initial DSL script based on the first sub-strategy to obtain first parsed data; Obtain the second sub-strategy in the DSL parsing strategy, and perform DSL task splitting on the first parsed data based on the second sub-strategy to obtain multiple DSL sub-tasks; Obtain the third sub-strategy in the DSL parsing strategy, and perform parsing on each DSL sub-task among the multiple DSL sub-tasks based on the third sub-strategy to obtain multiple DSL parsing sub-tasks corresponding to the multiple DSL sub-tasks; Obtain the fourth sub-strategy in the DSL parsing strategy, and perform SQL conversion on each DSL parsing sub-task among the multiple DSL parsing sub-tasks based on the fourth sub-strategy to obtain multiple sub-SQL scripts corresponding to the multiple DSL parsing sub-tasks, and form the target SQL script with the multiple sub-SQL scripts.

[0064] In this embodiment, performing DSL deserialization parsing on the initial DSL script through the first sub-strategy in the DSL parsing strategy to obtain the first parsed data is to extract key data in the initial DSL script to form a structured data, such as extracting core data information such as user behavior conditions, user feature data, time window, and logical operators in the initial DSL script, and finally forming the structured first parsed data.

[0065] Performing DSL task splitting on the first parsed data through the second sub-strategy in the DSL parsing strategy to obtain multiple DSL sub-tasks, the purpose is to split the first parsed data into multiple DSL sub-tasks to facilitate subsequent parallel execution to improve the result acquisition efficiency. Moreover, when performing DSL task splitting on the first parsed data through the second sub-strategy, specific task splitting can be carried out by combining the task splitting strategy set in the first parsed data or the preset task splitting strategy in the server.

[0066] When performing parsing on each DSL sub-task among the multiple DSL sub-tasks through the third sub-strategy in the DSL parsing strategy, for example, each DSL sub-task is in the JSON data format, and most of the information in it is not the information necessary for generating SQL. At this time, after extracting the key information required for generating SQL statements from it, multiple DSL parsing sub-tasks corresponding to the multiple DSL sub-tasks can be obtained.

[0067] Perform SQL conversion on each DSL parsing subtask through the fourth sub-strategy in the DSL parsing strategy. Specifically, generate SQL scripts that can be directly executed on the server subsequently, and each SQL script includes corresponding SQL statements to perform corresponding data processing tasks (such as data query tasks). After completing multiple sub-SQL scripts, they can be aggregated to form the target SQL script. It can be seen that the automatic conversion of the DSL script is achieved through the DSL conversion engine of the server, and the final target SQL script that can be automatically executed is quickly obtained.

[0068] In one embodiment, obtaining the first sub-strategy in the DSL parsing strategy and performing DSL deserialization parsing on the initial DSL script based on the first sub-strategy to obtain first parsing data includes: Perform DSL deserialization parsing on the initial DSL script through the first sub-strategy, extract user behavior conditions, the first logical operator for the user behavior conditions, user feature data, the second logical operator for the user feature data, time window, the third logical operator for the time window, and task splitting rule data, and form the first parsing data.

[0069] In this embodiment, before describing the specific process of performing DSL deserialization parsing on the initial DSL script through the first sub-strategy in the server in detail, a detailed introduction to the DSL rule types included in the DSL conversion engine is provided. For specific reference, please refer to the method embodiment part above, and details will not be elaborated here.

[0070] In one embodiment, obtaining the second sub-strategy in the DSL parsing strategy and performing DSL task splitting on the first parsing data based on the second sub-strategy to obtain multiple DSL subtasks includes: Obtain the task splitting rule data in the first parsing data, and perform DSL task splitting on the first parsing data based on the task splitting rule data to obtain multiple DSL subtasks.

[0071] In this embodiment, if the task splitting rule data is further included in the first parsing data, then specifically according to the task splitting rule data (such as the splitting rule corresponding to SPLIT_RULE), the first parsing data can be subjected to DSL task splitting through the task splitting rule data to obtain multiple DSL subtasks, thereby achieving fast task splitting.

[0072] The target user data acquisition unit 130 is used to acquire corresponding target user data in the local user database according to the target SQL script.

[0073] In this embodiment, after obtaining the target SQL script, the target SQL script is automatically executed, so as to obtain the corresponding target user data from the local user database, realizing the accurate screening and acquisition of the target user data.

[0074] In one embodiment, the target user data acquisition unit 130 is specifically configured to: Obtain multiple sub-SQL scripts included in the target SQL script, and execute the multiple sub-SQL scripts to obtain corresponding target sub-user data from the user database; Summarize the target sub-user data corresponding to the multiple sub-SQL scripts respectively to form the target user data.

[0075] In this embodiment, since multiple sub-SQL scripts included in the target SQL script are obtained before, the multiple sub-SQL scripts are executed in parallel at this time, so as to respectively obtain the target sub-user data corresponding to each sub-SQL script. After that, the target sub-user data corresponding to the multiple sub-SQL scripts are summarized respectively, so that the target user data corresponding to the initial DSL script and the target SQL script can be obtained, and the obtained target user data can be used for operations such as user data analysis and user behavior feature extraction locally on the server.

[0076] The data sending unit 140 is configured to send the target user data to the user terminal if a target user data acquisition request sent by the user terminal is detected.

[0077] In this embodiment, after the target user data corresponding to the initial DSL script and the target SQL script is obtained in the server, in addition to being used locally, it can also be sent to other terminals such as the user terminal for data use. Specifically, when the server detects a target user data acquisition request sent by the user terminal and determines that the target user data acquisition request is used to obtain the target user data, the target user data is sent to the user terminal, so as to realize the cross-terminal transmission and use of user data.

[0078] It can be seen that implementing the embodiment of this device can quickly convert an initial DSL script including at least user behavior conditions and user feature data into a target SQL script that can be automatically executed and query user data in the local user database, so as to quickly and accurately obtain the target user data and perform related data applications.

[0079] The above SQL generation implementation device based on the DSL conversion engine can be implemented in the form of a computer program, and the computer program can run on a computer device as shown in Figure 6 shown.

[0080] Please refer to Figure 6 ,Figure 6 It is a schematic block diagram of a computer device provided by an embodiment of the present invention. This computer device integrates any SQL generation implementation device based on a DSL conversion engine provided by the embodiments of the present invention.

[0081] Refer to Figure 6 , the computer device 400 includes a processor 402, a memory, and a network interface 405 connected through a system bus 401. Among them, the memory may include a storage medium 403 and an internal memory 404.

[0082] The storage medium 403 can store an operating system 4031 and a computer program 4032. The computer program 4032 includes program instructions, and when the program instructions are executed, the processor 402 can be made to execute a SQL generation implementation method based on a DSL conversion engine.

[0083] The processor 402 is used to provide computing and control capabilities to support the operation of the entire computer device.

[0084] The internal memory 404 provides an environment for the operation of the computer program 4032 in the storage medium 403. When the computer program 4032 is executed by the processor 402, the processor 402 can be made to execute the above-mentioned SQL generation implementation method based on a DSL conversion engine.

[0085] The network interface 405 is used for network communication with other devices. Those skilled in the art can understand that Figure 6 the structure shown in

[0086] is only a block diagram of some structures related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have a different component layout. In response to an intelligent conversation instruction from a user terminal, obtain the current user conversation data corresponding to the intelligent conversation instruction, and perform intent recognition on the current user conversation data to obtain a current intent recognition result; Based on the current intent recognition result and a preset specific domain language script generation strategy, correspondingly generate a current DSL script; wherein, the current DSL script is a current specific domain language script, and the specific domain language script generation strategy is used to generate a DSL script according to the current intent recognition result and a plurality of pre-configured business models; Based on the current DSL script and a preset script conversion strategy, correspondingly generate a current SQL script; wherein, the current SQL script is a current structured query language script; Obtain the current query result from the local database based on the current SQL script, generate the current display result corresponding to the current query result, and send the current display result to the user terminal.

[0087] It should be understood that in the embodiment of the present invention, the processor 402 may be a central processing unit (CPU), and the processor 402 may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0088] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, and the storage medium is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.

[0089] Therefore, the present invention also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, where the computer program includes program instructions. When the program instructions are executed by a processor, the processor performs the following steps: In response to the intelligent dialogue instruction of the user terminal, obtain the current user dialogue data corresponding to the intelligent dialogue instruction, and perform intention recognition on the current user dialogue data to obtain the current intention recognition result; Based on the current intention recognition result and the preset specific domain language script generation strategy, correspondingly generate the current DSL script; wherein, the current DSL script is the current specific domain language script, and the specific domain language script generation strategy is used to generate the DSL script according to the current intention recognition result and several pre-configured business models; Based on the current DSL script and the preset script conversion strategy, correspondingly generate the current SQL script; wherein, the current SQL script is the current structured query language script; Obtain the current query result in the local database based on the current SQL script, generate the current display result corresponding to the current query result, and send the current display result to the user terminal.

[0090] The storage medium can be various computer-readable storage media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disc, etc., which can store program codes.

[0091] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0092] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of each unit is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0093] The steps in the method embodiments of the present invention can be adjusted, combined, and deleted according to actual needs. The units in the device embodiments of the present invention can be combined, divided, and deleted according to actual needs. In addition, the functional units in each embodiment of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.

[0094] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention.

[0095] As described above, it is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of various equivalent modifications or substitutions, and these modifications or substitutions should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A method for implementing SQL generation based on a DSL conversion engine, characterized in that, Including: In response to a user data filtering instruction, obtain an initial DSL script corresponding to the user data filtering instruction; wherein, the initial DSL script is an initial domain-specific language script, and at least includes user behavior conditions, user characteristic data, a time window, and logical operators in the initial DSL script; Based on a preset DSL parsing strategy in a DSL conversion engine, parse the initial DSL script and generate an SQL statement to obtain a target SQL script; wherein, the target SQL script is a target structured query language script; Obtain corresponding target user data in a local user database according to the target SQL script; If a target user data acquisition request sent by a user terminal is detected, send the target user data to the user terminal.

2. The method according to claim 1, wherein Before the step of obtaining the initial DSL script corresponding to the user data filtering instruction, the method further includes: Send a DSL script template to the user terminal so that a user of the user terminal edits user behavior conditions, user characteristic data, a time window, and logical operators based on the DSL script template; The step of, in response to a user data filtering instruction, obtaining an initial DSL script corresponding to the user data filtering instruction includes: If a user data filtering instruction sent by the user terminal is detected, obtain the initial DSL script that at least includes user behavior conditions, user characteristic data, a time window, and logical operators and is sent by the user terminal based on the DSL script template.

3. The method according to claim 1, characterized in that, The step of, based on a preset DSL parsing strategy in a DSL conversion engine, parsing the initial DSL script and generating an SQL statement to obtain a target SQL script includes: Based on the DSL parsing strategy in the DSL conversion engine, perform DSL deserialization parsing, DSL task splitting, DSL subtask parsing, and DSL subtask SQL conversion on the initial DSL script in sequence to obtain the target SQL script.

4. The method according to claim 3, characterized in that, The step of, based on the DSL parsing strategy in the DSL conversion engine, performing DSL deserialization parsing, DSL task splitting, DSL subtask parsing, and DSL subtask SQL conversion on the initial DSL script in sequence to obtain the target SQL script includes: Obtain a first sub-strategy in the DSL parsing strategy, and perform DSL deserialization parsing on the initial DSL script based on the first sub-strategy to obtain first parsing data; Obtain a second sub-strategy in the DSL parsing strategy, and perform DSL task splitting on the first parsing data based on the second sub-strategy to obtain a plurality of DSL subtasks; Obtain a third sub-strategy in the DSL parsing strategy, and perform parsing on each DSL subtask in the plurality of DSL subtasks based on the third sub-strategy to obtain a plurality of DSL parsing subtasks corresponding to the plurality of DSL subtasks; Obtain the fourth sub-strategy in the DSL parsing strategy, and perform SQL conversion on each DSL parsing sub-task in the multiple DSL parsing sub-tasks based on the fourth sub-strategy to obtain multiple sub-SQL scripts corresponding to the multiple DSL parsing sub-tasks, and form the target SQL script from the multiple sub-SQL scripts.

5. The method according to claim 4, characterized in that, The DSL anti-serial parsing of the initial DSL script based on the first sub-strategy to obtain the first parsed data includes: Perform DSL anti-serial parsing on the initial DSL script through the first sub-strategy, extract user behavior conditions, a first logical operator for the user behavior conditions, user feature data, a second logical operator for the user feature data, a time window, a third logical operator for the time window, and task splitting rule data, and form the first parsed data.

6. The method according to claim 5, wherein The obtaining of the second sub-strategy in the DSL parsing strategy, and performing DSL task splitting on the first parsed data based on the second sub-strategy to obtain multiple DSL sub-tasks includes: Obtain the task splitting rule data in the first parsed data, and perform DSL task splitting on the first parsed data based on the task splitting rule data to obtain multiple DSL sub-tasks.

7. The method according to claim 1, wherein The obtaining of the corresponding target user data in the local user database according to the target SQL script includes: Obtain the multiple sub-SQL scripts included in the target SQL script, and execute the multiple sub-SQL scripts to obtain the corresponding target sub-user data from the user database; Summarize the target sub-user data corresponding to the multiple sub-SQL scripts respectively to form the target user data.

8. An SQL generation implementation device based on a DSL conversion engine, characterized in that, Includes: An initial DSL script obtaining unit, configured to obtain an initial DSL script corresponding to the user data filtering instruction in response to the user data filtering instruction; wherein, the initial DSL script is an initial domain-specific language script, and at least includes user behavior conditions, user feature data, a time window, and a logical operator in the initial DSL script; A target SQL script generating unit, configured to perform parsing and SQL statement generation on the initial DSL script based on a preset DSL parsing strategy in the DSL conversion engine to obtain a target SQL script; wherein, the target SQL script is a target structured query language script; A target user data obtaining unit, configured to obtain corresponding target user data in the local user database according to the target SQL script; A data sending unit, configured to send the target user data to the user terminal if a target user data obtaining request sent by the user terminal is detected.

9. A computer device, characterized in that, The computer device includes a memory and a processor, and a computer program is stored on the memory. When the processor executes the computer program, the SQL generation implementation method based on the DSL conversion engine according to any one of claims 1-7 is implemented.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and the computer program includes program instructions. When the program instructions are executed by a processor, the method for implementing SQL generation based on a DSL conversion engine according to any one of claims 1-7 can be realized.

Citation Information

Patent Citations

  • Data query method and device, electronic equipment and computer readable storage medium

    CN113377805A

  • General DSL query method under RESTful architecture

    CN114356954A

  • Task execution method and device based on domain-specific language, medium and equipment

    CN114625757A

  • JSON-to-SQL method and device, terminal and storage medium

    CN115577032A

  • DSL-based intelligent dialogue implementation method, device and equipment for generating SQL (Structured Query Language)

    CN119293068A