PyCharm 3.1.0 Web Help

File | Settings | Database
Ctrl+Alt+SCtrl+Alt+SCtrl+Alt+SCtrl+Alt+SCtrl+Alt+SAlt+F7Ctrl+Alt+SCtrl+Alt+SCommand CommaCommand CommaCommand Comma  | Database
settings on the main toolbar  | Database
settings in the Database console and the Table Editor


Use this page to view and edit the settings related to working with databases. The settings include those for the Database console, the Table Editor and the Database tool window.

Data view

Specify how table data should be shown in the Database console and the Table Editor.

Item Description
Result set page size The number of table rows to be shown at a time, on one "page". Here is an example when this number is set to 2:

PageSize2

If you don't want to limit the number of rows displayed simultaneously, specify zero (0).

Show query results in new tab You can select to view query results on individual tabs, or on one and the same tab.

If the check box is selected, a new tab with the query result will open each time you run a query (SELECT). In this way, you can keep the results of all the queries that you have run.

ShowResultsInNewTabON

If this check box is not selected, the same tab is used to show your query results. When you run a query, the information on the tab is updated to show the result, and a new tab doesn't open.

ShowResultsInNewTabOFF

In this case, when you get the result that you want to keep, you can pin the tab to the tool window. The corresponding command can be found in the context menu available for the tab.

ShowResultsInNewTabOFFPinTab

Console

The settings in this section relate to showing error notifications, separating SQL statements and recognizing statement parameters in the Database console.

Item Description
Show error notifications in editor If this check box is not selected, the information about the errors is shown only in the output pane. If, in addition, you want the error notification bar to appear in the input pane, select the check box.

The error notification bar may be particularly useful when running sequences of SQL statements. If an error occurs in such cases, the error notification bar lets you select how to react.

For more information, see Using the error notification bar.

Use explicit parameter patterns in SQL If the check box is not selected, the rules of the corresponding SQL dialect are used to recognize parameters within statements.

If this and the Enable explicit parameter patterns check boxes are both selected, the SQL rules for detecting parameters are ignored. Instead, the parameter patterns in the list underneath are used.

Enable explicit parameter patterns (RegExp) If the check box is selected and the Database console is run in the plain-text mode, the parameter patterns in the list underneath are used for detecting parameters in the input pane. A string sequence that matches any one of the patterns is treated as a statement parameter.

If, at the same time, the Use explicit parameter patterns in SQL check box is selected, the patterns are used instead of the rules of the corresponding SQL dialect.

If this check box is not selected, the parameter patterns are not used even if the Use explicit parameter patterns in SQL check box is selected.

Parameter patterns The parameter patterns are specified using regular expressions. The patterns available initially have the following meanings:
  • \?\d* - a question mark, either on its own or followed by a sequence of digits, e.g. ?, ?1, ?69.
  • \:\w+ - a colon followed by one or more word characters, e.g. :x, :value, :parameter_1.
  • \@\w+ - @ followed by one or more word characters, e.g. @value, @field_2.
  • \$\{[^$\{\}]*\} - $, then {, then any character except $, { or } zero or more times, then }, e.g. ${}, ${value}.
  • \$\w+\$ - $, then one or more word characters, then $ again, e.g. $x1$.
  • \#\w+\# - #, then one or more word characters, then # again, e.g. #field_3#.

Use add, delete, edit1, arrowUp and arrowDown to add, delete, edit and reorder the patterns.

add or Alt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+Insert or Ctrl+NAlt+InsertCommand N or Control EnterControl N or Control EnterCommand N or Control Enter Use this icon or shortcut to create a new pattern. In the dialog that opens, specify the regular expression for the new pattern and click OK.
delete or Alt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteCommand Delete or Command BackspaceCommand DeleteCommand Delete or Command Backspace Use this icon or shortcut to delete the selected pattern or patterns.
edit1 or EnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnter Use this icon or shortcut to edit the selected pattern. In the dialog that opens, edit the pattern as necessary and click OK.
arrowUp or Alt+UpAlt+UpAlt+UpAlt+UpAlt+Up or Ctrl+Alt+AAlt+UpCtrl+Alt+UpCtrl+Shift+UpControl UpControl UpControl Alt Up Use this icon or shortcut to move the selected pattern or patterns one line up in the list.
arrowDown or Alt+DownAlt+DownAlt+DownAlt+DownAlt+Down or Ctrl+Alt+EAlt+DownCtrl+Alt+DownCtrl+Shift+DownControl DownControl DownControl Alt Down Use this icon or shortcut to move the selected selected pattern or patterns one line down in the list.
Plain-text statement separator If the Database console is run in the plain-text mode, the character or sequence of characters specified in this field is treated as a separator of individual SQL statements.

Data Extractors

Use this section to manage data extractors and their settings.

A data extractor is a named set of settings that define how to convert table data into CSV, TSV and other formats.

Data extractors are applied when you use the Copy All To Clipboard or Save All To File command in the Database console, the Table Editor, or in the Database tool window.

Note that for certain formats (CSV, TSV, HTML and custom formats), it may be useful to define more than one data extractor - each with different settings.

When you select an extractor in the list, you can view and edit the extractor settings in the area to the right.

Use add, delete, arrowUp and arrowDown to create, delete, and reorder the extractors.

Item Description
List of data extractors and examples
See an example for: Initially, each item in the list corresponds to a different target format. Format names are self-explanatory. Below, each of the formats is illustrated with an example. To generate the examples, the following table was used as a source.

TableByronNames

Where appropriate, the Include columns names option was on, while the Include row numbers option was off.

Comma-separated Values (CSV)
id,name

1,George
2,Gordon
                        
Tab-separated Values (TSV)
id	name

1	George
2	Gordon
                        
HTML Table
<!DOCTYPE html>
<html>
<head>
  <title></title>
</head>
<body>
<table border="1" style="border-collapse:collapse">
<tr><th>id</th><th>name</th></tr>

<tr><td>1</td><td>George</td></tr>
<tr><td>2</td><td>Gordon</td></tr></table>
</body>
</html>
                        
SQL Insert Statements
INSERT INTO test.byron_names (id, name) VALUES (1, 'George');
INSERT INTO test.byron_names (id, name) VALUES (2, 'Gordon');
                        
SQL Update Statements
UPDATE test.byron_names SET id = 1, name = 'George' WHERE id = 1;
UPDATE test.byron_names SET id = 2, name = 'Gordon' WHERE id = 2;
                        
XML
<?xml version="1.0" encoding="UTF-8"?>
<data>
 <row>
  <id>1</id>
  <name>George</name>
 </row>
 <row>
  <id>2</id>
  <name>Gordon</name>
 </row>
</data>
                        
JSON
[,
 {
  "id": 1,
  "name": "George"
 },
 {
  "id": 2,
  "name": "Gordon"
 }
]
                        
Custom-separated Values
||	id	|	name	||

||	1	|	George	||
||	2	|	Gordon	||
                        

When generating this example the following settings were used (\t stands for a tab character, \n - for a new line):

Value separator: \t|\t    Line separator: \n

Line prefix: ||\t    Line suffix: \t||

Value quotation: " and "

Value quotation policy: As needed

Note

Initially, there are no custom formats. To add one, click add and select Custom-separated Values.

Creating, deleting and reordering the extractors
add or Alt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+Insert or Ctrl+NAlt+InsertCommand N or Control EnterControl N or Control EnterCommand N or Control Enter Use this icon or shortcut to create a new data extractor. Select the target format from the list that is shown.
delete or Alt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteCommand Delete or Command BackspaceCommand DeleteCommand Delete or Command Backspace Use this icon or shortcut to delete the selected extractor or extractors.
arrowUp or Alt+UpAlt+UpAlt+UpAlt+UpAlt+Up or Ctrl+Alt+AAlt+UpCtrl+Alt+UpCtrl+Shift+UpControl UpControl UpControl Alt Up Use this icon or shortcut to move the selected extractor or extractors one line up in the list. (The order of the extractors in the list corresponds to that of the options in corresponding menus.)
arrowDown or Alt+DownAlt+DownAlt+DownAlt+DownAlt+Down or Ctrl+Alt+EAlt+DownCtrl+Alt+DownCtrl+Shift+DownControl DownControl DownControl Alt Down Use this icon or shortcut to move the selected extractor or extractors one line down in the list.
Extractor settings
Title The name of the extractor. Corresponds to the name of the option in corresponding menus.
Include column names Select this check box if you want the column names to be included.
Include row numbers Select this check box if you want the row numbers to be included.
Value / line separator For custom formats: a character or characters to be inserted between the values and at the end of a line (a table row).
Line prefix / suffix For custom formats: a character or characters to be added at the beginning and the end of a line (a table row). The suffix is inserted before the line separator.
Value quotation For custom formats: a character or characters to be added before and after a value.
Value quotation policy For custom formats: specify conditions for value quotation:
  • Always. All the values are quoted.
  • As needed. A value is quoted only if it contains Unicode whitespace characters and/or value separators.

See Also

Reference:

Web Resources: