PyCharm 2017.1 Help

Import File Dialog

This dialog opens when importing delimiter-separated values (e.g. CSV, TSV) into a database.


In the left-hand part, specify how your delimiter-separated values should be converted into table format. In the right-hand part, specify the settings for the target table in your database.

Conversion settings

When working on the conversion settings, use the table preview in the right-hand part of the dialog underneath the table settings.

ItemDescription
Formats Select your file format and check the table preview. If you haven't achieved the desired result yet, adjust the settings.

/help/img/idea/2017.1/iconSaveOptions.png If you have changed the settings and want to save the changes, click this icon and select one of the following:

  • Save Changes. The settings are saved "under the same name", without creating a new format. (A format, in fact, is a named set of settings.)
  • Save As. The settings are saved "under a different name": a new format is created and you can specify the name for that new format.

Value separator Select or type the character used for separating individual values.
Row separator Select or type the character that should be treated as a row separator.
Null value text The text to be used as a value if a cell contains null (an unknown value).
Add row prefix/suffix Row prefix and suffix are character sequences which in addition to the row separator indicate the beginning and end of a row.

If necessary, click the link and specify the row prefix and suffix in the fields that appear.

Quotation Each line in the area under Quotation is a quotation pattern (see Quote values). A quotation pattern includes:
  • The left quotation character, the one inserted before a value.
  • The right quotation character, the one inserted after a value; usually, the same as the left quotation character.
  • An escape method or character for the cases when the quotation character is part of a value. E.g. Escape: duplicate means that if a quotation character occurs within a value, it is doubled. (You can specify your own escape character instead.)

If there is more than one pattern, the first of the patterns is used.

Use /help/img/idea/2017.1/new.png, /help/img/idea/2017.1/delete.png, /help/img/idea/2017.1/arrowUp.png and /help/img/idea/2017.1/arrowDown.png to create, delete and reorder the patterns.

To start editing an existing pattern, just click the pattern of interest.

Quote values Specify in which cases the values should be quoted (i.e. enclosed within quotation characters).
  • When needed. A value is quoted only if it contains the value and/or the row separator.
  • Always. Any value is quoted in its text representation.
Trim whitespaces If this check box is not selected, the Unicode whitespace characters that precede and follow the value separators are treated as parts of the corresponding values. If this check box is selected, the corresponding whitespace characters are ignored or removed.
First row is header If this check box is selected, the first row is treated as containing column names. The settings that appear under Header Format have the same meanings as the ones above but are applied to the first row.
First column is header If this check box is selected, the first column is treated as containing row names.

Table name, structure and data mappings

ItemDescription
Table The name of the table.
Comment The table comment.
Columns / Keys etc. Data mappings for columns, and the definitions of the columns, constraints and indexes.
  • To start editing the information for a column, double-click the corresponding line in the list of columns.

    Note the Mapped to field. This field lets you specify which data column in the file being imported should be used as a source of data for the corresponding column in the database. If you clear this field, no data will be added to the target column in the database.

  • To remove a column, select the corresponding line and click /help/img/idea/2017.1/delete.png.

Data and DDL previews

ItemDescription
Data previewThe preview of data you are about to import.
DDL previewThe statement or statements that will be run. You can edit the statements right in the preview pane.

Encoding, Write errors to file and Insert inconvertible values as null

ItemDescription
EncodingThe character encoding for your data in the source file.
Write errors to fileIf you select the check box, the lines that cannot be imported are written to the specified text file.
Insert inconvertible values as nullIf you select the check box, NULLs will be inserted into the table for the data that cannot be converted.

See Also

Last modified: 26 July 2017