How to view queries executed internally from dbeaver - mysql

When trying to DELETE, INSERT or UPDATE one more table rows inside Table editor (or by using the add, duplicate and delete buttons), i know that dbeaver executes some queries.
Is there a way to view these queries?
I tried the "query manager" button but it doesn't show them.

My question might be a duplicate because it was fairly simple to find it.
For anyone that doesn't know how to do it (although there are explicit directions how to do it in the documentation under the topic "Query Manager")
(Yup i didn't knew):
Go to "Window" in options bar
Click "Preferences"
Go to "Database"->"Query Manager"
Finally under "Query Types" check the option "Utility functions" and press "Apply"

To use the Utility function in DBeaver after 21.3.4 onwards you can find it here as below.

Related

Pentaho Kettle insert Error Handling of step

I am new to GeoKettle (Spoon) of Pentaho and I am currently rows from an Excel-file into my database. Now I want to avoid duplicates in my databasetable. That is why I want to insert only those rows into my database table which aren't there yet (to have only unique records in my database table).
And as far as I know, there are two ways to realize that. The first way I tried was with the Insert/Update step (I have disabled the Update functionality) and defined all the columns which have to be equal in order to insert the record or not. But it does not work. All records are still inserted into the database.
That is why I am trying to do the (according to pentaho) much faster option which is a "Table Output" with an "Update" error handling step as shown in the picture.
As shown in the picture, the arrow which is pointing from "table output" to "update" is black. But I need a red dotted one for error handling of step . But I do not know how to create this. In tutorials I often see that there pops up a little window with 2 options like in the picture:
But I do not get that popup. If I want to create a hop, I will have to mark both steps and do a right-click on one of them.
So in which possible ways can I create such a red dotted arrow? In the end, it has to look like this:
Thank you so much in advance!!
You have a problem with your setup. Or with your version of the PDI. The functionality of an error step was introduced in V4 but fully implemented for all steps around V6.
Download a fresh PDI from SourceForge. V7.1 is really a robust and stable edition. Unzip and test.
By the way, what you want to achieve is know as the CRUD pattern. CRUD for Create, Read, Update, Delete. The step doing this the Merge Rows (diff) (in the Joins family). You tell the steps which columns to check, and it produce a new column with the value identical, changed, new, or deleted. You can them redirect the flow in a Switch / Case to do the appropriate action. Further information here (V4).

How do I automatically clear output in MySQL workbench?

I'm trying to find the preference settings to have the output clear every time my statement or set of statements are executed. I would prefer this option instead of right clicking and clearing the output every time I want to. I just can't find it and I'm not sure it exists as an option.
There's no such thing like auto-clearing. If you want that implemented file a feature request in the MySQL bug system (http://bugs.mysql.com).

MySQL for Excel Add-In, failing to append

I am using the MySQL for Excel add-in. I have been using this for months to highlight a set of data and load it into my database.
I added a new table last week, and was successfully loading data into it using the same method. It stopped working. When I attempt to Append data, I get an error dialogue box that says "Cannot Find Column 30"...which happens to be the number (and therefore) last column in my table.
Some more information:
- If I highlight this same set of data and try to write it to another table, it will allow me to (even though I don't confirm and do it). I get past the error dialogue box to the Mapping dialogue box.
- I tried writing data from the previous table to this new problem table. I got the same error dialogue box.
This tells me that the problem is not with the data set. It is with the table.
I then deleted the table, all the connections and redid it from scratch. Still the same problem.
Where is this failing? Thank you.
ya even i had the same problem, even i tried the same way u did, like deleted the table recreated everything, it did not work, finally i tried to append some random table and went to "Advanced Options" at the bottom of the append pop up
in this u will see some "Stored Column mappings" and some mappings in it, now delete all of them and hit "Accept" now u can append the table
it will work
I know this is super old but I have a solution because it just happened to me.
Try append on different table. When box pops up click 'Advanced Options'
Then under column mapping uncheck both:
(Automatically store the column mapping for the given table) AND
(Reload stored column mapping for the select table automatically)
Then goto the Stored mappings tab and delete all the stored mappings
Click Accept and then rejoice you are free of that error for life.
best -J
If Excel does not show you the "Stored Column mappings" then connect to a MySQL table not used before in Excel, then retry the Append, the mapping will be shown. Then you can follow the answer provided by user3611272.
Problem will be resolved by doing below steps:
Select any table from Table other than your target table.
Click on Append Data
Press "Advanced Options"
Select tab "Stored Mappings"
Delete your target table mapping and Accept.
it will solve the issue.

Is there a way to view past mysql queries with phpmyadmin?

I'm trying to track down a bug that's deleting rows in a mysql table.
For the life of me I can't track it down in my PHP code, so I'd like to work backwards by finding the actual mysql query that's removing the rows.
I logged in to phpmyadmin, but can't find a way to view the history of past sql operations.
Is there a way to view them in phpmyadmin?
Ok, so I actually stumbled across the answer.
phpMyAdmin does offer a brief history. If you click on the 'sql' icon just underneath the 'phpMyAdmin' logo, it'll open a new window. In the new window, just click on the 'history' tab.
That will give you the last twenty or so SQL operations.
There is a Console tab at the bottom of the SQL (query) screen. By default it is not expanded, but once clicked on it should expose tabs for Options, History and Clear. Click on history.
The Query history length is set from within Page Related Settings which found by clicking on the gear wheel at the top right of screen.
This is correct for PHP version 4.5.1-1
You just need to click on console at the bottom of the screen in phpMyAdmin and you will get the Executed history:
To view the past queries simply run this query in phpMyAdmin.
SELECT * FROM `mysql`.`general_log`
if it is not enabled, run the following two queries before running it.
SET GLOBAL log_output = 'TABLE';
SET GLOBAL general_log = 'ON';
I don't think phpMyAdmin lets you do that, but I'd like to hear I'm wrong.
On the other hand you can enable query logging in MySQL: The General Query Log
Yes, you can log queries to a special phpMyAdmin DB table.
See SQL_history.
I am using phpMyAdmin Server version: 5.1.41.
It offers possibility for view sql history through phpmyadmin.pma_history table.
You can search your query in this table.
pma_history table has below structure:
You have to click on query window just below the phpMyAdmin logo, a new window will open.
Just click on SQL History tab. There you can see history of SQL Queries.
OK so I know I'm a little late and some of the above answers are great stuff.
As little extra though, while in any PHPMyAdmin page:
Click SQL tab
Click 'Get auto saved query'
this will then show your last entered query.
I may be wrong, but I believe I've seen a list of previous SQL queries in the session file for phpmyadmin sessions
Here is a trick that some may find useful:
For Select queries (only), you can create Views, especially where you find yourself running the same select queries over and over e.g. in production support scenarios.
The main advantages of creating Views are:
they are resident within the database and therefore permanent
they can be shared across sessions and users
they provide all the usual benefits of working with tables
they can be queried further, just like tables e.g. to filter down the results further
as they are stored as queries under the hood, they do not add any overheads.
You can create a view easily by simply clicking the "Create view" link at the bottom of the results table display.
you can run your past mysql with run /PATH_PAST_MYSQL/bin/mysqld.exe
it run your last mysql and you can see it in phpmyadmin and other section of your system.
notice: stop your current mysql version.
S F My English.
why dont you use export, then click 'Custom - display all possible options' radio button, then choose your database, then go to Output and choose 'View output as text' just scroll down and Go. Voila!
There is a tool called Adminer which is capable of doing all phpmyadmin job packed in single tiny php file.
http://www.techinfobit.com/how-to-import-export-database-without-any-extra-installation/

How can I edit a view using phpMyAdmin 3.2.4?

I need to simply edit a very complicated view in phpMyAdmin 3.2.4 but I cannot figure how to do that. Any suggestions?
Thanks!
To expand one what CheeseConQueso is saying, here are the entire steps to update a view using PHPMyAdmin:
Run the following query: SHOW CREATE VIEW your_view_name
Expand the options and choose Full Texts
Press Go
Copy entire contents of the Create View column.
Make changes to the query in the editor of your choice
Run the query directly (without the CREATE VIEW... syntax) to make sure it runs as you expect it to.
Once you're satisfied, click on your view in the list on the left to browse its data and then scroll all the way to the bottom where you'll see a CREATE VIEW link. Click that.
Place a check in the OR REPLACE field.
In the VIEW name put the name of the view you are going to update.
In the AS field put the contents of the query that you ran while testing (without the CREATE VIEW... syntax).
Press Go
Special thanks to CheesConQueso for their insightful answer.
In your database table list it should show View in Type column.
To edit View:
Click on your View in table list
Click on Structure tab
Click on Edit View under Check All
Hope this help
update: in PHPMyAdmin 4.x, it doesn't show View in Type, but you can still recognize it:
In Row column: It had zero Row
In Action column: It had greyed empty button
Of course it may be just an empty table, but when you open the structure, you will know whether it's a table or a view.
try running SHOW CREATE VIEW my_view_name in the sql portion of phpmyadmin and you will have a better idea of what is inside the view
Just export you view and you will have all SQL need to make some change on it.
Just need to add your change in SQL query for the view and change :
CREATE for CREATE OR REPLACE
Select your view in Bookmarked SQL query section then select Delete then click Go button.