PyCharm 2022.1 Help

Import File dialog

The Import "file_name" File dialog appears when you import CSV, TSV, or any other text files that contain delimiter-separated values.

Import delimiter-separated values into a database

Settings for files with delimiter-separated values

Item

Description

Formats

Select a template that successfully converts the file data into a table. You can change settings of predefined templates or add a new template. To add a template, click Add Format button (the Add Format button).

To save changes, click the Save icon the Save icon and select one of the following options:

  • Save Changes: save changed settings of the current template are saved.

  • Save As: create a new template and save settings of the new template.

  • Save All: save changes in all templates.

UseApp general add,App general remove, App actions previous occurence and App actions next occurence to create, delete and reorder the formats; App actions copy to create a copy of the selected format.

Value separator

Select or type the character that you want to use as a separator for values.

Row separator

Select or type the character that you want to use as a separator for rows.

Null value text

Select or type the text that you want to use if a cell contains the NULL value.

Add row prefix/suffix

Click the link and type a row prefix and suffix. Prefix and suffix are character sequences which in addition to the row separator indicate the beginning and end of a row.

Quotation

Each line in the area under Quotation is a quotation pattern. A quotation pattern includes:

  • Left: a quotation character that is inserted before a value.

  • Right: a quotation character that is inserted after a value.

  • Escape: an escape method or character for the cases when the quotation character is part of a value. The <duplicate> value means that if a quotation character occurs within a value, it is doubled. You can specify your own escape character.

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

UseApp general add,App general remove, App actions previous occurence and App actions next occurence to create, delete and reorder the patterns.

Quote values

Select when you want to enclose values within quotation characters.

  • Never: do not quote values.

  • When needed: quote a value if it contains the value or the row separator.

  • Always: quote all the values.

Trim whitespaces

Ignore or remove whitespace characters. If this checkbox is cleared, the whitespace characters are treated as parts of the corresponding values.

First row is header

Treat the first row as a row that contains column names.

property bundle="messages.DatabaseBundle" key="csv.format.settings.first.column.is.header" product="!mps,ws"/>

Treat the first column as a column that contains row names.

Table name, structure and data mappings

Item

Description

Target schema

Schema in which you want to create or to copy a table. You can select schemas in other data source.

Table

Name of a new table or an existing table in case you want to add data to the existing table.

Comment

Comment to a table.

Columns | Keys | Indexes | Foreign Keys

Data mappings and definitions of columns, keys, and indexes. Double-click the line to start editing.

The Mapped to field specifies relation of a data column from the file and the corresponding column in the database. If you clear this field, no data is added to the target column in the database.

To remove a column, select the corresponding line and click the Remove button the Remove button.

Data and DDL previews

Item

Description

Data Preview

The generated preview of how your data will be imported to the database.

DDL Preview

A statement or statements that PyCharm will run to create a table. You can edit the statements in the DDL preview field.

Encoding, errors, and logs

Item

Description

Encoding

Select the character encoding for your data in the source file.

Write errors to file

Write errors that occur during the import in a text file.

Insert inconvertible values as null

Insert the NULL value into the table instead of the data that cannot be converted.

Disable indexes and triggers, lock table (may be faster)

Disable indexes and triggers during the import. Note that if you selected this option, it might lead to a situation when a trigger does not fire and fails to pass its results. Though it might improve the performance of the importing process. The option is available only when the target table (to which you copy values) has indexes or triggers.

Last modified: 18 November 2021