1
0
Fork 0
Commit Graph

85 Commits

Author SHA1 Message Date
Andrew 8cc22b9d3a
Add verbose_errors config and special command (#1455)
* Add verbose_errors config

* Update changelog

* Add special command

* Blackify
2024-03-26 15:31:38 -07:00
Damien Baty 5050f01abc
pgclirc: Clarify description of `destructive_warning_restarts_connection` option (#1437) 2023-11-06 14:10:47 +08:00
Rob Berry 97a1fd6c16
Allow defining a json file with preferred aliases (#1382)
* fix psycopg.sql.Identifier in \ev handling (#1384)

* Allow defining a json file with preferred aliases

At $WORK we have a lot of tables with names like `foo_noun_verb` or
`foo_noun_related-noun_verb` and so while the default aliasing is very
helpful for shortening unwieldy names we do end up with lots of aliases
like `LEFT JOIN fnv on fnv2.id = fnv.fnv2_id`

This change will allow defining a json file of preferred aliases

```
> cat ~/.config/pgcli/aliases.json
{
    "foo_user": "user",
    "foo_user_group": "user_group"
}
```

so the alias suggestion for `SELECT * FROM foo_user` will be `SELECT * FROM foo_user AS user`
instead of the default `SELECT * FROM foo_user AS fu`

* When cannot open or parse alias_map_file raise error

Raise a (hopefully) helpful exception when the alias_map_file cannot be
parsed or does not exist

* Add tests for load_alias_map_file

* Add tests for generate_alias

* Update AUTHORS file

* Remove comment.

Discussed this on the PR with a project maintainer

---------

Co-authored-by: Andy Schoenberger <akschoenberger@gmail.com>
Co-authored-by: Rob B <rob@example.com>
Co-authored-by: Irina Truong <i.chernyavska@gmail.com>
2023-10-06 16:13:28 -07:00
Damien Baty f4dc796941 Add config option to require a transaction for destructive statements
When this option is on, any statement that is deemed destructive
(through the use of the `destructive_warning` config option) will
not be executed unless a transaction has been started.
2023-03-08 09:42:43 +01:00
Andy Schoenberger 0a502accfc
add comment to pgclirc pager section on default LESS (#1395) 2023-02-27 14:14:48 -08:00
Andy Schoenberger 141873f86d
Add config option to always run with a single connection (#1386)
Co-authored-by: Irina Truong <i.chernyavska@gmail.com>
2023-01-03 13:52:31 -08:00
Andy Schoenberger d6ca4c3464
Add config option to not automatically restart connection on destructive warning abort; defaults to not restarting. (#1379) 2022-11-17 20:13:05 -08:00
Andy Schoenberger 431c256567
Add config option to not automatically retry connections with operational errors (#1380) 2022-11-11 09:36:41 -08:00
Rodrigo Neri (Rigo) 1726ff5397
Changed destructive_warning to take a list of destructive commands (#1328)
* Changed destructive_warning to take a list of destructive commands and added the dsn_alias as part of the destructive command warning

* Updated parse_destructive_warning to handle None

* Reverted auto formatted change to AUTHORS

* Reverted auto formatted change to AUTHORS
2022-10-13 14:42:22 -07:00
astroshot c0e1081405
Feature: Add new formatter to export data to sql like mycli (#1366)
* Sub: Add new formatter to export data to sql like mycli

Body: New formatter is added, we can export query result to sql
insertion like mycli

==== End ====

* Sub: Install black and reformat code

Body:

==== End ====

* Sub: Add unit tests for new formatter

Body:

==== End ====

* Sub: Add new formatter to pgclirc
2022-09-14 17:41:40 -07:00
Irina Truong c65495716d
Add setting in config to control truncating field values. (#1285)
* Add setting in config to truncate field value.

* Black.

* Changelog.

* Fix tests.
2021-09-03 16:58:03 -07:00
Irina Truong a3287c4ab2
Finer control over destructive warning. (#1242)
* Finer control over destructive warning.

* Review feedback.

* Changelog.

* Run integration tests with --warn=moderate.

* Fix typo.

* Black.
2021-02-12 21:09:38 -08:00
Eero Ruohola 87ffae295e
Fix issue where `syntax_style` config value would not have any effect (#1241)
These config properties got introduced in 41dd24e8 as a means to have
more granular control over the syntax highlighting. The problem is that
these cannot be in the default config file since `get_config()` always
reads both the default config file and the user specified one, and there
is no way to unset these variables in the user specified config file to
restore their default behavior. Even if there would be a way, it
wouldn't be intuitive at all to be required to unset some random
settings under the `[colors]` section just to be able to use the well
documented `syntax_style` setting.

Note that one *can* still set these three lines in their user config
file if they want to utilize them.

Resolves #1212
2021-02-10 15:06:19 -08:00
Sky.G.Uieen 41dd24e8da
Add custom color (#1196)
* Updated author, changelog for supporting color of string, number, keyword

* Added string, number, keyword custom color
2020-07-07 20:19:22 -07:00
laixintao 0c24e8bda2
Support style for missing value. (#1186)
* Support style for missing value.

* update changelog.

* upgrade minimal version of cli_helpers, in order to use style for null.
2020-05-28 15:29:50 -07:00
anthonydb a9ef523eb3 Minor typo fixes in pgclirc 2020-05-26 09:08:14 -04:00
Stephano Paraskeva 936475258d
show_bottom_toolbar - Feature to Show/Hide Toolbar (#1170)
* adds ternary to decide whether bottom_toolbar is shown based on config value

* runs black format

* adds name to authors

* modifies changelog.rst

* removes change in changelog.rst

* formats config

* removes unused variable, adds change to changelog

* changes default back to true

* removed reference to var
2020-04-17 22:58:13 -07:00
Amjith Ramanujam 2a28399c3f
Add an example for how to use the colored prompt. (#1163) 2020-03-30 09:32:00 +08:00
Jonas Jelten 36605174a4 support ansi escape sequences for prompt colors 2019-11-25 22:51:15 +01:00
Irina Truong b2ebe0e95c
Issue 1018 display first 1k rows (#1092)
* Added changes to remove the prompt on >1000 rows queries

* Reformatted with black

* Changed comment on row_limit parameter

* Added contribution to changelog and name to AUTHORS

* Refactored test to reflect new functionality

* Removed argument

* Removed debug echo statement

* Reformatted with black

* Added changes to remove the prompt on >1000 rows queries

* Reformatted with black

* Changed comment on row_limit parameter

* Added contribution to changelog and name to AUTHORS

* Refactored test to reflect new functionality

* Removed argument

* Removed debug echo statement

* Reformatted with black

* Added missing issue numbers in changelog

* Reformatted code using black
2019-08-23 13:44:36 -07:00
Amjith Ramanujam 83e17e825f Remove the expand_tab option from pgclirc. 2019-03-16 14:09:39 -07:00
Artur Balabanov f897ea466e Merge branch 'master' into tab-on-line-start 2018-10-01 10:25:13 +01:00
Irina Truong 392491a74d
Cherry-picked prompt-toolkit 2.0 changes. (#930)
* Cherry-picked prompt-toolkit 2.0 changes.

* Increase help timeout.

* Missed one.

* Fixes editor command.

* Expect exact to fix named query error.

* Unicode is non-optional with ptk 2.0.

* Unicode literals all the things (almost).

* PEP8.

* Change how we swap completers.

* By default, bottom toolbar styles are reversed. We don't want that.

* Adapt styles to 2.0.

* The future is now. Switch to ptk 2.0 style names.

* PEP8.

* Flag for enable_open_in_editor.

* add class:prompt to prompt

* Removed workaround for #668. Some renaming.

* use pgcli.completer instead of app.current_buffer.completer

* enable_system_prompt=True like old prompt toolkit

* keep search_ignore_case enabled (was ignore_case)

* fix closing parenthese

* keep marking class:continuation token for continuation

* capture KeyboardInterrupt manually

AbortAction has been removed in Prompt_toolkit 2.0

* replace C-J with enter, add more comments

* reversed ([...]) to [(...)] (oops)

* pep8 fixes

* Does Vi mode have to be applied to session every time?

* (workaround) also enable vi_mode after edit command

* Fixed test errors after rebasing on master.
2018-09-28 14:18:40 -07:00
Artur Balabanov 676b5e6ff6 Add a config option -- expand_tab. If set, \t character will be replaced by 4 spaces when a <Tab> key is pressed on an empty line 2018-07-27 17:07:18 +01:00
Dick Marinus 868b81aa98 make keyring optional 2018-07-22 07:34:56 +02:00
Dan Clark 8fce953a8c ported the desctructive warning from mycli 2018-05-17 05:54:50 -04:00
Irina Truong dd0c721ad5 Merged master into branch. 2018-03-31 13:09:23 -07:00
Andrew Kuchling d0e68d0617 #858: fix comment in pgclirc 2018-03-28 16:27:41 -04:00
fraoustin 344317df34 explicit sample in pgclirc 2018-03-23 23:24:35 +01:00
fraoustin ade6142ef8 add color for table 2018-03-04 11:05:50 +01:00
fraoustin 64a683cae7
Update pgclirc 2018-01-17 12:48:36 +01:00
fraoustin 57cc451f06 manage pset pager 2018-01-06 11:58:59 +01:00
Chris Vaughn cc4854214e correct typo in pgclirc comment 2017-12-23 07:07:01 -06:00
Marcin Sztolcman 54f0b7f02c removed setting prompt_dsn from config, just allow for it in cli options 2017-12-11 04:48:24 +01:00
Marcin Sztolcman e4ec94a4c2 typos 2017-12-11 04:24:55 +01:00
Marcin Sztolcman ba4836652e use other prompt when connecting using --dsn parameter 2017-12-11 04:24:43 +01:00
Thomas Roten 70db642c4b Add null_string to config file. 2017-08-09 12:53:42 -05:00
Amjith Ramanujam 1301b7ad7b Change the continuation char to empty string. 2017-07-24 10:32:37 -07:00
Amjith Ramanujam 2c80a8c98f Change the casing default to 'auto'. 2017-07-16 20:26:43 -07:00
Thomas Roten 61f0d63013 Initial work on using CLI Helpers. 2017-06-11 21:07:40 -05:00
Amjith Ramanujam edf40d052b Merge branch 'master' into koljonen/case_column_titles 2017-04-21 07:38:14 -07:00
Owen Stephens e5d3d5d63f Allow configurable multiline continuation char 2017-03-30 11:12:25 +01:00
Joakim Koljonen 49ba6b4001
Casing for column headers (based on casing file)
```
koljonen@localhost:koljonen> SELECT transferid, parenttransferid, amount from transfers
╒══════════════╤════════════════════╤══════════╕
│ TransferID   │ ParentTransferID   │ Amount   │
╞══════════════╪════════════════════╪══════════╡
...
...
...
```
2017-03-18 18:51:56 +01:00
Joakim Koljonen bdf2a0e26a
Start suggesting tables/functions/views/types not in search_path
And schema-qualifying them, of course, so that for `SELECT * FROM bar`
we might suggest `buildings.barns` and for `select dopi` we might
suggest `maintenance.delete_old_personal_info()`, for example.

Controlled by a config setting, `search_path_filter`, in case anyone
prefers the old behaviour.
2017-03-05 02:21:31 +01:00
Darik Gamble fe44cd4b37 Add a config option for the number of menu lines to reserve 2017-02-25 09:18:54 -05:00
AGhost-7 81aad79cab Per #298, make expand modes configurable.
This makes it possible to enable through the configuration the always
expand and automatic expansion modes in pgcli.
2017-01-21 12:51:12 -05:00
Amjith Ramanujam 17d3f05d56 Set default data_formatting to nothing. 2017-01-06 09:47:32 -08:00
Irina Truong 4edd124c0d Merge pull request #621 from dbcli/koljonen/show_transaction_status
Add transaction status to toolbar
2016-12-12 15:06:51 -08:00
Joakim Koljonen 466b8e74be
Better status-bar transaction-status colors 2016-12-10 05:13:29 +01:00
Joakim Koljonen f8b1647ae8
Add transaction status to toolbar 2016-12-07 04:39:03 +01:00