If you’re not familiar with importing data using DBeaver, then I encourage you to view my previous blog here:
This time I will show you how to update data using a csv file inside DBeaver.
Connecting to the csv File
Right-click your database connection (or anywhere if your connections are empty), click Create and then click Connection.
Make sure the All tab is select on the left and scroll down to CSV. Click Next.
Click Browse… and select the folder where your csv file is that you saved from Excel. You’re selecting a folder here, not a file. The connection will load ALL csv files in that folder. Click Finish.
You will now see a new connection; this connection is set up exactly like a regular connection. Each csv file in your folder will be set up as a table with columns.
The data in the current PostgreSQL table looks like this:
Our csv file data looks like this:
Create Staging Table
We’ll need to create a staging table to perform our updates from using the csv data. You can right-click your PostgreSQL table, click Generate SQL and then click DDL. Copy the create statement, change the table name, and execute.
Import Stage Data
Now we can import the stage data for our update, right-click your stage table, click Import Data, select Table and click Next. Change the source to your CSV connection table and click Next.
Check that the mapping is existing and click next, next again on the transfer settings and then click Finish to start the import.
Now we can use generic sql to update the data.
We can now see that the table has been updated.
If you’re looking for other ways to import files into DBeaver, check out my other blog: