PyCharm Professional ships with some .groovy
scripts as database extensions. This repo adds additional ones to these (mainly just tweaking the existing scripts!).
The official documentation for PyCharm's database extensions can be found at:
The aggregators and extractors are documented, respectively, at:
In the project view, you can find the database extensions under Scratches and Consoles:
New scripts can be added here directly and will automatically be available in the IDE -- across all projects!
Please refer to the official aggregator and extractor documentation:
- https://www.jetbrains.com/help/pycharm/table-editor.html#aggregate-view
- https://www.jetbrains.com/help/pycharm/data-extractors.html
This repo adds the following extensions:
- Aggregators
- Extractors
Details will be added below with the following example table:
id | name | date_of_birth | surname_ipa |
---|---|---|---|
1 | William Shatner | 1931-03-22 | <null> |
2 | Leonard Nimoy | 1931-03-26 | /ˈniːmɔɪ/ |
3 | Nichelle Nichols | 1932-12-28 | /nɪˈʃɛl/ |
Count the total number of characters across the selection. Intended to be used on a single cell at a time to quickly determine the length of its contents, but can be used on many cells to get the total number of characters over them.
Count the number of distinct cells in the selection. Note that null values are not ignored and will count as a distinct value.
Count the number of cells that have a null value.
Count the number of cells (not the number of characters) that have at least one "bad character". As an English speaker, a "good character" is any character between a space (
, U+0020) and a tilde (~
, U+0126) on the ASCII/unicode scale, and a "bad character" is any character that is not a "good character". Null values are not counted (but the null character, U+0000, is).
Format the cells appropriately for Jira Server. This is a modified version of the Markdown-Groovy extractor, but tweaked to return Atlassian server's wiki markup instead of Markdown.
Like the build-in Markdown extractor, this has different outputs depending on whether the result set is transposed or not.
Copy:
Paste:
|| ID || NAME || DATE_OF_BIRTH || SURNAME_IPA ||
| 1 | William Shatner | 1931-03-22 | null |
| 2 | Leonard Nimoy | 1931-03-26 | /ˈniːmɔɪ/ |
| 3 | Nichelle Nichols | 1932-12-28 | /nɪˈʃɛl/ |
Copy:
Paste:
|| || || || |
| ID | 1 | 2 | 3 |
| NAME | William Shatner | Leonard Nimoy | Nichelle Nichols |
| DATE_OF_BIRTH | 1931-03-22 | 1931-03-26 | 1932-12-28 |
| SURNAME_IPA | null | /ˈniːmɔɪ/ | /nɪˈʃɛl/ |
Simply join the selected cells (values only) using a comma and space as a separator, quoting the values if needed. Handy for copying values to put inside an IN
statement.
Copy:
Paste:
1, 'William Shatner', 2, 'Leonard Nimoy'
Join the selected cells' values with the column names ready to be pasted into a WHERE
clause. Intended to be used for a single row at a time, but can be used on many.
Copy:
Paste:
WHERE 1=1
AND id = 1
AND name = 'William Shatner'
AND id = 2
AND name = 'Leonard Nimoy'