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

[Feature Request] Autocomplete for database queries #110

Open
simonkellly opened this issue Jun 20, 2024 · 0 comments
Open

[Feature Request] Autocomplete for database queries #110

simonkellly opened this issue Jun 20, 2024 · 0 comments

Comments

@simonkellly
Copy link
Member

simonkellly commented Jun 20, 2024

It would be cool to have a code editor with autocomplete on the database query page, as I frequently find myself writing queries within the ruby mine console and copying them over.

This could be accomplished a number of ways, but the easiest appears to be a library called CodeMirror (which has a react wrapper https://uiwjs.github.io/react-codemirror/#/).

It might be an idea to do maybe a toggle to allow users to choose if they want to use the code editor or the previous textbox setup.

Schema definitions could be generated after each db import into a static json file from the java server using a sql query which looks something like this

SELECT CONCAT('"', TABLE_NAME, '": ', '[', GROUP_CONCAT(CONCAT('"', COLUMNS.COLUMN_NAME, '"'), ''), '],')
FROM   COLUMNS
WHERE TABLE_SCHEMA='wca_development'
GROUP BY TABLE_NAME

I made a quick example implementation (without the dynamic generation of the schema) on my fork https://github.com/simonkellly/statistics/tree/feature/code-editor which is based on the vite changes branch.

image image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant