Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upFeature request: add autocompletion for columns names in the Execute SQL window #1242
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Interestingly, if the table contains a space (as in my example) then selecting the entry doesn't correctly insert the field name - only up to (not including) the first space. Edit: Thinking abotu it (OK, it took a while...) it wouldn't make valid SQL, but DB4S should still select the table to give the user an opportunity to put quotes around it. additionally, if I type |
chrisjlocke
added
the
bug
label
Nov 23, 2017
This comment has been minimized.
This comment has been minimized.
Hello @chrisjlocke , Thanks a lot indeed for your reply ! :-)
I would have never ever suspected this was possible indeed because this feature has never worked for me on Windows 7 - 10 (x64.exe installers ) :-) Just take a look at this video recorded tonight on Windows 10 (64 bit). Here is my video recording: |
SilvioGrosso
closed this
Nov 23, 2017
SilvioGrosso
reopened this
Nov 23, 2017
This comment has been minimized.
This comment has been minimized.
Could be a language thing. |
This comment has been minimized.
This comment has been minimized.
Hello @chrisjlocke !
Sure :-) Encoding is UTF-8 (Italian is my native language, BTW). This same table (INDUFF_2017) works fine with DBeaver (Windows 10 - 64 bit) Thanks a lot indeed for your help ! |
This comment has been minimized.
This comment has been minimized.
This sounds similar to #1194 where DB4S was struggling with different languages/encoding. |
This comment has been minimized.
This comment has been minimized.
Hello @chrisjlocke , Thanks a lot for your reply and help : it is much appreciated ! :-) I always work with nightly builds (x64.exe) on Windows 10 - 64 bit. I have just downloaded today's build (x64.exe) and it doesn't work as regards the autocompletion name for columns. Only commands (SELECT, FROM etc) and the names of the tables are proposed. Just tried, with today's build (x64.exe on Windows 10) this SQL code: CREATE TABLE users ( INSERT INTO users VALUES When I try, in the Execute SQL window, to SELECT these data (TABLE users) the autocomplete option for columns never works (only commands and name of tables are proposed). |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hello @chrisjlocke , As you suggested, whenever I type my table name with a period I am indeed able to choose my column name later on However, this is far from being perfect because with tables with long names I end up with very long SQL code because of this... On top of this, for colums names autocompletion, it also looks like Sqlite Browser does not accept alias for tables' names. This being said, THANKS a bunch for your help : it has been extremely useful. |
This comment has been minimized.
This comment has been minimized.
Ahhh. I guess we'd need to populate the list of autocompletion choices a bit differently, so typing just the first few letter of a column name displays the list of potential names from all tables. That's not a part of the code I've personally ever touched. @MKleusberg has though, so might be able to guess how doable that is. |
justinclift
added
the
response requested
label
Nov 28, 2017
This comment has been minimized.
This comment has been minimized.
That should be no problem at all. I think the only reason why we're not doing this already is because it might result in a very long list of very confusing names especially when different tables have similar column names. The only way we could avoid that is by parsing the SELECT statement which we currently can't do (that would also fix @SilvioGrosso's use case of So what do you all think? Leave it as-is or always suggest all column names? |
This comment has been minimized.
This comment has been minimized.
Would we know from what table is the column? If not, it would be a bit confusing to have completion for all the columns in the database without knowing the context. Another option to improve the situation is implementing the feature requested in issue #119. It might be easier to implement than an intelligent completion for any column name. Although it has some challenges too By the way, I'm not getting any Table completion when I open the database or project from the command line. That might be worth of its own issue |
mgrojo
added
enhancement
and removed
bug
labels
Dec 3, 2017
This comment has been minimized.
This comment has been minimized.
@mgrojo Hmmm, kind of thinking that it's probably better to add all the columns from all the tables in the list, even without knowing the context. All it's doing is providing a drop down list of options, and doing it this way provides the list sooner rather than later. Not seeing a downside... in concept anyway. |
This comment has been minimized.
This comment has been minimized.
Yeah, you're probably right. Anyway, it would be great to have more information than just the name and the icon. Don't know if that is feasible. |
mgrojo
self-assigned this
Jan 18, 2018
This comment has been minimized.
This comment has been minimized.
I've made the change and I'm now convinced that having all the columns is an improvement. I tried to add the table information to the completion tooltip but it is not elegant. QScintilla is not thought for that and the possible hacks are ugly. So I will commit the change to complete all table fields in isolation, if you all don't mind. |
This comment has been minimized.
This comment has been minimized.
Sure, go for it. |
This comment has been minimized.
This comment has been minimized.
@SilvioGrosso The auto-completion is now suggesting all the column names in isolation, without writing first the table name. Could you give it a try in the next nightly build and provide some feedback? |
This comment has been minimized.
This comment has been minimized.
@mgrojo Was it pushed? Just asking because the commit history for today doesn't seem to include auto-completion things. |
added a commit
that referenced
this issue
Jan 18, 2018
This comment has been minimized.
This comment has been minimized.
@justinclift No, it wasn't |
This comment has been minimized.
This comment has been minimized.
Hello everyone, I have downloaded the 32.exe installer to run it on Windows Xp (professional). Afterwards, I have installed the 64.exe installer on Windows 10 (64 bit): my personal computer. On both versions (32 - 64 bit) I have tested also the dragging of columns into the Execute SQL window (from the DB Schema window) and everything works nice as well ! THANKS a lot for these last improvements :-) |
This comment has been minimized.
This comment has been minimized.
Awesome @SilvioGrosso, thanks for testing and letting us know. Good stuff @mgrojo! Another solid win. |
justinclift
closed this
Jan 19, 2018
justinclift
removed
the
response requested
label
Jan 19, 2018
justinclift
added this to the 3.11.0 - Where we take over the world! :D milestone
Jan 19, 2018
This comment has been minimized.
This comment has been minimized.
bk322
commented
Feb 14, 2019
Autocompleting table names with spaces doesn't work on Linux in 3.11.0. |
This comment has been minimized.
This comment has been minimized.
@bk322 - The final version of 3.11.0 or one of the earlier betas? This works in Windows. I can't see why this would vary depending on the operating system. Can you list the tables and their schema (don't need any data, obviously) |
This comment has been minimized.
This comment has been minimized.
The betas were only made for macOS and Windows, so guessing this is either a custom compiled thing or the Linux package repositories have been updated. @bk322 Which version of Qt was it compiled with? It should say in the Help -> About dialog for our application. |
This comment has been minimized.
This comment has been minimized.
bk322
commented
Feb 14, 2019
@justinclift I compiled it today from github release. "About" dialog says:
Maybe I should compile the master? |
This comment has been minimized.
This comment has been minimized.
bk322
commented
Feb 14, 2019
•
@chrisjlocke I just tried it for tables. Previously I tried it for fields. The browser suggests the correct name, but if I press enter -- only first word gets entered: |
This comment has been minimized.
This comment has been minimized.
Hmm.... the commit which should have made this work is in both the To me, it sounds like this is just not yet working 100% after all, and needs a bit of adjusting so to correctly handle things like "white space in table names" (etc) too. |
This comment has been minimized.
This comment has been minimized.
Aah, sorry - thought you'd put, "Autocompleting table names with spaces doesn't work ", which is why I tried it with tables. Yes, pressing Enter or Tab on a selection with spaces doesn't select the whole selection. Additionally, don't forget even if it did, you'd need quotation marks around 'this table'.
While it is an issue (SQLite obviously supports tables with spaces) from a DBA point of view, its a logistical nightmare, so I would personally avoid tables and fields with spaces in them. I'd either use underscores (this_is_a_table) or my personal preference, camelCase (thisIsATable). Its not only easier to read, but causes far less issues in the long run. |
chrisjlocke
added
the
bug
label
Feb 14, 2019
chrisjlocke
reopened this
Feb 14, 2019
This comment has been minimized.
This comment has been minimized.
bk322
commented
Feb 14, 2019
@chrisjlocke I mostly work with CSV files, and these are made of Excel files. The headings there most of time contain spaces. I'm dreaming of a completion that would put the whole field in double quotes. |
This comment has been minimized.
This comment has been minimized.
I asked for completing identifiers with embedded spaces in the QScintilla mailing list. The answer was:
So it's possible, but not very straightforward. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Thanks @mgrojo, that's very well done. Something for a future time maybe. |
SilvioGrosso commentedNov 23, 2017
Hello everyone,
Please, add the autocompletion for columns names in the Execute SQL window.
This is especially handy with Sqlite tables with huge amounts of columns :-)
In essence, whenever you type your SQL code in the Execute SQL window, it would be useful to get automatically the option to choose, by pressing enter on your keyboard, the name of your column.
With PostgreSQL, I have worked with pgcli in the past [1] with the autocompletion nicely implemented.
As regards, open source softwares, Dbeaver implements this feature beautifully [2] as well.
Here is a short video I have recorded to show this option with Dbeaver (on Windows 10) together with Sqlite databases:
https://www.dropbox.com/s/r1vmzjfw05ifhi2/DBEAVER_AUTOCOMPLETION_COLUMNS_NAMES-SQLITE_TABLE.mp4?dl=0
P.s: YEP, I am aware this is a geeky teachie request: bear with me :-)
[1] https://github.com/dbcli/pgcli
[2] https://dbeaver.jkiss.org/