thewca / thewca/statistics

[Feature Request] Autocomplete for database queries

Open
#110 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
15
Forks
16
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the database query page and the example implementation on the linked feature/code-editor branch first. Assess the proposed React CodeMirror integration, the Java-side schema generation after database imports, and whether a toggle can preserve the existing textbox. Done means query autocomplete uses current schema data while the previous input option remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, react, sql
Domain
backend, databases, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.