Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat]: The dynamic SQL statement support #762

Open
hellomyheart opened this issue Mar 18, 2024 · 1 comment
Open

[Feat]: The dynamic SQL statement support #762

hellomyheart opened this issue Mar 18, 2024 · 1 comment
Assignees
Labels
API-Service Backend Java Spring for the Lowcoder API Enhancement New feature or request Help wanted Extra attention is needed

Comments

@hellomyheart
Copy link

hellomyheart commented Mar 18, 2024

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

The dynamic SQL statement support. The current SQL only supports inserting variables, but many queries are very complex. If the data volume is small, the SELECT * method can be used, along with the filtering function of the table component. However, when dealing with a large amount of data, SELECT * is obviously not feasible. In this case, manual SQL writing is required for data filtering. In the current SQL, if a variable {{a}} is injected, this line of code cannot be reduced. If there are three optional query parameters, in order to ensure that the SQL does not throw an error, it is necessary to manually write 8 SQL statements, which is obviously too complex and not maintainable. If the SQL supports dynamic conditional judgment like MyBatis, this problem can be solved.

Using something like:

  SELECT * FROM a
WHERE
      <if test="corpName != null">
        corp_name = {{corp_name}}
      </if>

This method of generating SQL can meet this requirement. Of course, it would be even better if it supports advanced syntax such as looping, choosing, and setting as in MyBatis.

This is the first solution, using SQL templates similar to MyBatis. Another solution is to enhance the capability of JavaScript and provide a JavaScript API to query the database, so that the dynamic nature of JavaScript code can solve this problem.

These two methods are not mutually exclusive and can coexist. Of course, if there is a third method that can solve the problem of dynamic SQL, that would also be acceptable.

@FalkWolsky FalkWolsky self-assigned this Apr 19, 2024
@FalkWolsky FalkWolsky added Enhancement New feature or request Help wanted Extra attention is needed API-Service Backend Java Spring for the Lowcoder API labels Apr 19, 2024
@FalkWolsky
Copy link
Contributor

We agree. That would be a truly helpful feature! We think to via XML, but via JavaScript / JSON Notation.
As it goes deep into the mechanics of the Backend, this is not an easy task. But an important one.
We try to get this done for v2.5. But it will take us time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API-Service Backend Java Spring for the Lowcoder API Enhancement New feature or request Help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants