* 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>
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.
* 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
* 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
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
* 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
* 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
* 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.
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.