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]: Display templated/prepared insert into command in any table #3817

Open
Andersama opened this issue Dec 8, 2024 · 3 comments
Open
Assignees
Labels
enhancement Feature requests.

Comments

@Andersama
Copy link

Describe the new feature

Currently there is a very handy feature to copy an insert command which represents a row in a table with the shortcut CTRL+ALT+C

image

However in an empty table, the prompt appears:
image

Which would suggest it "does" something, but nothing occurs.

It would be very useful to have a shortcut and or context menu item which creates a prepared insert command. IE not one pre-filled with data from the row, but rather the insert command you'd actually use in your applications.

For example in my non-empty table using the shortcut I might get:
INSERT INTO "main"."items" ("uuid", "item_name") VALUES ('35d94866-392d-4aab-86dc-098cd8b07511', 'an_item');

We might imagine having these presented from any table:
INSERT INTO "main"."items" ("uuid", "item_name") VALUES (@uuid, @item_name);
INSERT INTO "main"."items" ("uuid", "item_name") VALUES (:uuid, :item_name);
INSERT INTO "main"."items" ("uuid", "item_name") VALUES ($uuid, $item_name);

This could also appear in the "Add New Record" prompt:
image

Does this feature exist in another product or project? Please provide a link

No response

Do you have a screenshot? Please add screenshots to help explain your idea.

No response

@Andersama Andersama changed the title [Feature]: Display templated insert into command in empty tables [Feature]: Display templated/prepated insert into command in any table Dec 8, 2024
@Andersama Andersama changed the title [Feature]: Display templated/prepated insert into command in any table [Feature]: Display templated/prepared insert into command in any table Dec 8, 2024
@mgrojo mgrojo self-assigned this Dec 12, 2024
@mgrojo
Copy link
Member

mgrojo commented Dec 13, 2024

Good idea, but I've implemented it in a slightly different way. There was already drag and drop support in the DB Schema dock for building select queries. I've added support for choosing insert statement too. Also for copying to the clipboard, and not only for drag and drop, but with the same text. You can try it in the latest nightly. There's a problem I still have to fix, though, related with saving the user election as settings.

mgrojo added a commit that referenced this issue Dec 13, 2024
Put all the drag+drop/copy options in a submenu.

See issue #3817
@mgrojo
Copy link
Member

mgrojo commented Dec 13, 2024

I've fixed the problem with the settings and restructured the contextual menu. @Andersama, the next nightly build will be ready for testing.

@mgrojo mgrojo added the enhancement Feature requests. label Dec 13, 2024
@Andersama
Copy link
Author

Took me a bit to figure out where the edit was. I was thinking more in the table browsing tab because at the moment you can select columns to create an insert command, but its prefilled with data from the row.

It may be worth making it its own shortcut, I don't deal with UI much, but I'd find it confusing that the behavior of CTRL+C changes based on a dropdown.

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

No branches or pull requests

2 participants