Don't let people connect to `{file}`
richb-hanover opened this issue · 6 comments
OK. I figured out how I got into such a bad state (#47). Here's my thought process that led me to the bad state.
- Server -> Add Server... "Hmmm... It's not really a server. But I think I know what qstudio means."
- Sever Ty... "Hmmm... I don't know what a 'KDB' is, but look! There's SQLite. I'll choose that."
- Connect By: "I dunno...
- "It's not a host on the network: it's just a SQLite file. So I won't click Host"
- "I guess it must be a URL. But that seems like it would have to be on the network as well. Well, the default is usually safe.
jdbc:sqlite:{file}
"I don't know what that means, either. I'll leave it alone"
- Name: "I guess I need to type the name of the file to open"
- "I'll just leave all the rest empty/as-is"
- Blammo! qstudio creates the blank
{file}
file, and life stinks.
To refresh my memory of how this looks on my Mac, I posted a video. It's at: https://youtu.be/sw9nZXIRzZo
Suggestions:
- SQLite databases are odd: they wrap everything into a single file. If I select "SQLite", maybe qstudio could display a file picker for the "Connect By" section?
- If someone leaves the choice as
jdbc:sqlite:{file}
, it would be good to give an error, saying to enter a file name not "{file}"
Hi Rich,
THanks for reporting these and the video, is really helps.. I've reworked the "File->Open" mene and toolbar option.
Now if you either:
- Double-Click a file in windows.
- Drag a drop a file onto qStudio
- Go File-Open
It will
- Check for .duckdb/parquet/db/sqlite file extension and open it as a database.
- Otherwise open it as a text editor.
I'm not confident of safely making your other suggested changes, The file picker or {file} check right now as given the 30+ database possibilities it's very hard to add logic in that area for 1-2 databases without breaking some of the others. I would like to first see if "File->Open" works for most users. Any remaining users that go to add server will hopefully be small in number and for very advanced cases.
Example: https://youtu.be/tAqVW67PWRk
Cool! Let me know when I can play with the updated version
Excellent! It looks as if you have implemented drag and drop in 3.05. Two observations:
- Dragging a ".sqlite" file to the Server Tree opened/connected to the SQLite as desired.
- Dragging that file to the Documents pane seemed to open the database as a text file. (I saw "SQLite" in the first line).
Perhaps you could special case ".sqlite" and always treat it as a SQLite database, no matter where it was dragged into the qStudio window? (That interpretation would also work well if the file were dragged to the qStudio icon in the dock...) Thanks as always
Hmmm... I dragged the .sqlite file to the top half of the "Server Tree" pane, but nothing happened. I dragged the file to the bottom half, and the database opened as expected.
I'll push my luck, and ask that a drop of a database file (such as ".sqlite") anywhere in the qStudio window be treated as a request to connect to that database file.
I will quickly admit that I have no idea how other DBMS systems handle their files, so I can't give any further guidance to you. Thanks again.
As I re-read this, I also want to say that I was misled by the {file}
name in the URL field. I've seen enough software tools where stuff in { ... }
is magic notation, so I figured that entering the name of the file in the Name: field would do the trick. (Clicking "Add" created an empty file named {file} which led to all sorts of problems.)
To avoid that mistake, perhaps you could:
- Change the prompt to
jdbc:sqlite:path-to-your-database-file
- Don't let people choose that string: give an error if they haven't changed it when they press Add
Thanks.