RubyMine 2020.1 Help

Import

To import data from a script file, you can run the file as it is described in Run database code. In addition to script files, you can import a CSV, TSV, or any other text file that contains delimiter-separated values.

Import data to a database

  1. In the Database tool window (View | Tool Windows | Database), right-click a data source.

  2. Select Run SQL Script.

  3. In the Select Path window, navigate to the SQL file that you want to apply.

    Run an SQL file

Import delimiter-separated values into a database

  1. In the Database tool window (View | Tool Windows | Database), right-click a schema or a table and select Import Data from File.

  2. Navigate to the file that contains delimiter-separated values and press Open.

  3. In the Import <file_name> File dialog, specify the data conversion settings and click Import.

    Import delimiter-separated values into a database

Restore a full data dump for MySQL and PostgreSQL

You can restore data dumps by means of the mysql client utility for MySQL, or pg_restore or psql for PostgreSQL. The pg_restore option is used for custom-format pg_dump -Fc or directory-format pg_dump -Fd dumps. The psql option is used for SQL-format dumps.

If you see no restore options in the context menu, verify that you use a correct JDBC URL for the data source.

  1. In the Database tool window (View | Tool Windows | Database), right-click a schema or a database and navigate to:

    • Restore with "mysql": for MySQL data sources. In the Path to mysql field, specify the path to the MySQL executable (for example, C:\Soft\mysql-8.0.19-winx64\bin\mysql.exe).

    • Restore with "pg_restore": for PostgreSQL data sources. The pg_restore option is available for the most of database objects except for the data source level.

    • Restore with "psql": for PostgreSQL data sources. The psql option is available for the most of database objects except for table and schema levels.

    • Restore: for PostgreSQL data sources. Includes two tabs: pg_restore and psql.

  2. In the Restore with <dump_tool> dialog, specify the path to the restore tool executable in the Path to <dump_tool> field.

    (Optional) Edit the command-line options in the lower part of the dialog.

  3. Click Run.

Import data source settings

You can import data source settings from the settings.zip file that you exported earlier.

  1. Click File | Import Settings.

  2. In the Import File Location window, locate the settings.zip file that you exported, and double-click it.

  3. In the Select Components to Import window, select Database: drivers, Database: settings, and Database: global sources.

  4. Click OK.

  5. In the Restart Needed window, click OK to restart your IDE.

  6. Open the Data sources and drivers window, enter necessary connection credentials in the data source properties. If the data source is on a local or network drive, ensure that the path to this data source is correct.

  7. To ensure that the connection to the data source is successful, click Test Connection.

Last modified: 29 May 2020