1
0
Fork 0
Commit Graph

1257 Commits

Author SHA1 Message Date
Daniele Varrazzo 25eb9f541b
Add some comments about porting from psycopg 2 to 3 (#1318) 2022-02-22 09:02:16 -08:00
Irina Truong 02134daad7 Releasing version 3.4.0 2022-02-21 12:28:32 -08:00
Bruno Inec 54f0cc9ddd
ssh tunnels: allow configuring auto matches (#1302) 2022-02-21 10:20:11 -08:00
Bruno Inec ed9d123073
Add SSH tunnel support (#1301)
* Add initial sshtunnel support

* Force CI to rerun.

* Fix unit test for 3.6.

* Black.

Co-authored-by: Irina Truong <i.chernyavska@gmail.com>
2022-02-18 14:57:42 -08:00
Amjith Ramanujam 78843ac30f Releasing version 3.3.1 2022-01-18 12:58:45 -08:00
Amjith Ramanujam 338ea2186e Change the order for password prompt and keychain. 2022-01-13 09:27:47 -08:00
Amjith Ramanujam 6d719b628d Releasing version 3.3.0 2022-01-11 08:37:41 -08:00
Edoardo Ceccarelli 5811515a96
no need to strip_comments (#1296) 2021-11-18 11:58:38 -08:00
Saif Hakim 123e00a086
Re-run last query with bare `\watch` (#1283)
* Re-run last query with bare `\watch`

* add test

* clean up post test refactor

* lint

* rerun tests
2021-09-30 12:00:31 -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
Amjith Ramanujam 0f54b126b3 Releasing version 3.2.0 2021-08-23 09:02:03 -07:00
Irina Truong e0a4c18c4a
Another attempt to fix pgbouncer error (1093.) (#1097)
* Another attempt to fix pgbouncer error (1093.)

* Fixes for various pgbouncer problems.

* different approach with custom cursor.

* Fix rebase.

* Missed this.

* Fix completion refresher test.

* Black.

* Unused import.

* Changelog.

* Fix race condition in test.

* Switch from is_pgbouncer to more generic is_virtual_database, and duck-type it. Add very dumb unit test for virtual cursor.

* Remove debugger code.
2021-05-21 15:32:34 -07:00
Amjith Ramanujam 6309dd4f93 Blacken. 2021-05-06 21:20:12 -07:00
Amjith Ramanujam 1d2570f462 Include functions from search_path in completion. 2021-05-06 21:12:48 -07:00
Amjith Ramanujam 3a95530677
Merge branch 'master' into func-pr 2021-05-06 08:12:31 -07:00
Paweł Sacawa 26bdc4e759 Add missing function literals 2021-05-06 05:15:05 -04:00
Amjith Ramanujam 2fe94c38b4 Black formatting. 2021-05-05 21:01:12 -07:00
Paweł Sacawa 8de796c59c Fix: ANSI escape codes in first line make the cli choose expanded output incorrectly...
The format_output chooses to output as a table or in the expanded
format on the basis of the length of the first line of the table
formatter (`len`). However, this first line contains a lot of ANSI
excape codes, so this comparison is wrong, and the expanded mode
is used either way. This patch strips these escape codes before the
comparison.
2021-05-02 18:18:35 -04:00
Irina Truong 954b8c3902
Use configured pager if table format is csv. (#1260)
* Use configured pager if table format is csv.

* Changelog.

* Simplify.
2021-03-12 14:14:09 -08:00
Georgy Frolov a017fa96bf
fix IPython magic (#1253) 2021-03-12 10:16:14 -08:00
Georgy Frolov e009995e9f
Merge pull request #1258 from ERYoung11/fix_test_main_windows_error
skipping initial comments in pgconfig file did not work on Windows.
2021-03-11 08:24:13 +03:00
Georgy Frolov 8aa3f92666
fix import (#1252) 2021-03-10 16:59:48 -08:00
ERYoung11 bca1d94f39 skipping initial comments in pgconfig file did not work on Windows. 2021-03-10 13:15:58 -06:00
Irina Truong 291878bb31 Black. 2021-02-26 12:44:04 -08:00
Irina Truong d67272214c Preserve comments when writing to config file. 2021-02-26 12:41:04 -08:00
Georgy Frolov c9fd72449e
skip initial comment in pg_session file (#1245)
* skip initial comment in pg_session file

* add test
2021-02-22 14:55:55 -08:00
Georgy Frolov 30212c6fc6
fixed unknown symbol REPLACE_SINGLE in prompt_toolkit < 3.0.6 (#1246)
* fixed unknown symbol REPLACE_SINGLE in prompt_toolkit < 3.0.6

* changelog
2021-02-22 14:54:23 -08:00
Irina Truong 0679757d43
Remove gitter links, update build status badge. (#1244) 2021-02-17 16:54:29 -08: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
Miroslav Šedivý 762fb4b8da
Modernize code to Python 3.6+ (#1229)
1. `class A(object)` can be written as `class A:`
2. replace `dict([…])` and `set([…])` with `{…}`
3. use f-strings or compact `.format`
4. use `yield from` instead of `yield` in a `for` loop
5. import `mock` from `unittest`
6. expect `OSError` instead of `IOError` or `select` error
7. use Python3 defaults for file reading or `super()`
8. remove redundant parenthesis (keep those in tuples though)
9. shorten set intersection instead of creating lists
10. backslashes in strings do not have to be escaped if prepended with `r`
2021-02-12 21:34:56 +02: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
Irina Truong baea7690b0 Releasing version 3.1.0 2020-12-11 15:34:43 -08:00
Kevin Marsh 34d6e080ff
dependencies: add support for sqlparse 0.4.x (#1224) 2020-12-01 16:03:38 -08:00
laixintao 13bd678ccd
format code using black. 2020-09-14 10:27:46 +08:00
Jan Brun Rasmussen 352ed41980
Add schema suggestion for functions (#1206)
* Add schema suggestion for functions

- Update sqlcompletion.py
- Update metadata files

* Move autocomletion for function under condition

- Make sure suggestion are only added under drop, alter etc.
2020-09-08 10:02:25 -07:00
bitkeen d9adca7d5e
Add Token.Prompt/Continuation (#1207) 2020-09-06 21:52:12 -07:00
bitkeen e9c97072af
Use InputMode.REPLACE_SINGLE (#1208)
InputMode.REPLACE_SINGLE was added to prompt-toolkit.
This fixes Exception <InputMode.REPLACE_SINGLE: 'vi-replace-single'>
in single-char replace mode when using prompt_toolkit>=3.0.6.
2020-09-05 14:30:46 -07:00
Tom Caruso 223015a1fa
More explicit error message when DSN alias is not found (#1198)
* add a specific error message when DSN with provided alias is not found

* update changelog & authors file
2020-07-31 10:25:06 -07:00
Sky.G.Uieen df1b40ca22
Update suggestion literals (#1195)
* Updated all data types literals

* Updated sql functions literals

* Updated changelog and auther

* Updated test code

* Added datatype test case
2020-07-31 10:21:58 -07:00
Tom Caruso 8f7e314508
Move from humanize to pendulum library for displaying query durations (#1199) 2020-07-28 23:08:19 -07: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
Irina Truong 106c6c7bf8 Fix for #1193 list index out of range on sql comment. 2020-06-26 14:01:24 -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
Irina Truong 901ef31fd1
Fix bug introduced in #1102. (#1178) 2020-05-07 16:41:23 -07:00
pmav99 bcb0c8bce7
Add support for using pspg as the pager. (#1173)
* Stop printing "status" when table_format is "csv"

* Use the "unix" dialect on *nix for CSV output.

* Use a pager when `pspg` has been configured with CSV "table_format".

Fix #1102
2020-04-23 10:17:40 -07:00
Amjith Ramanujam 64c0b3553d
Merge pull request #1171 from dbcli/bugfix/no-new-line
bugfix: don't echo a newline when output is empty.
2020-04-18 19:06:25 -07:00
laixintao 94718efc35
bugfix: don't echo a newline when output is empty. 2020-04-18 14:05:34 +08: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
g.denis f3ac559844
Add pg_service.conf handling (#1155)
* add parse_service_info

* added tests

* changelog + AUTHORS

* py35
2020-04-17 14:52:19 -07:00
Irina Truong 005fd2fcee Releasing version 3.0.0 2020-04-10 15:16:44 -07:00
Amjith Ramanujam 2a28399c3f
Add an example for how to use the colored prompt. (#1163) 2020-03-30 09:32:00 +08:00
Georgy Frolov 61c81b05f5 removed py2-related stuff 2020-03-14 10:53:43 +08:00
g.denis 0f3d4602ef
Fix: Unable to drop previously connected-to database (#1152)
* close connections + added to authors + changelog

* check conn exists
2020-03-12 13:45:59 -07:00
赖信涛 bc7a5d0100
Drop Python3.5. (#1154)
* Drop Python3.5.

* delete 3.5 from setup.py

* fix black format. Using python3.7 for development now.

* black target to py36
2020-03-11 13:58:13 -07:00
赖信涛 fd77549754
Deprecate Python2.7. (#1153)
* deprecate Python2.7.

So we can use latest version of prompt-toolit.
Relate: https://github.com/dbcli/pgcli/pull/1149

* black format, remove 2.7 support.

* using version py35 for black.

* Revert "black format, remove 2.7 support."

This reverts commit 4b6d0496cc.

* deprecated py27 using black.

* remove 2.7 from travis.

* update setup.py: delete python 2.7 support.
2020-03-09 20:14:51 -07:00
lazydba247 91263c37b9
Add Support for partitioned tables. (#1145)
* partitioned tables: add support

Starting from 9.6+ relkind has new members (more info here: https://www.postgresql.org/docs/12/catalog-pg-class.html)

* Update AUTHORS

* Update changelog.rst

* foreign tables: add support

Starting from 9.6+ relkind has new members (more info here: https://www.postgresql.org/docs/12/catalog-pg-class.html)
2020-02-13 14:24:37 -08:00
George Thomas 77a361966a Fix warning raised for using `is not` to compare string literal (#1139)
Using `is not` for comparing string literals raises warning that != should be
used.

Fixes #1138
2020-01-14 20:56:07 -08:00
Jonas Jelten bc66b85730 add main file to allow python3 -m pgcli execution 2019-12-19 00:18:14 +01:00
Amjith Ramanujam 901812a7bf
Merge pull request #1122 from TheJJ/prompt-colors
support ansi escape sequences for prompt colors
2019-12-08 19:19:43 -08:00
Tim Gates 8456dcb18f
Fix simple typo: thows -> throws
Closes #1128
2019-12-05 08:35:22 +11:00
Irina Truong be04f1fc5e Releasing version 2.2.0 2019-12-04 09:25:02 -08:00
Jonas Jelten 36605174a4 support ansi escape sequences for prompt colors 2019-11-25 22:51:15 +01:00
Martin Matějek 6b2e8df8bd
run black again 2019-10-29 17:47:18 +01:00
Martin Matějek 01520ac728
Fix logging-format-interpolation 2019-10-29 02:57:00 +01:00
Martin Matějek a192255d7e
black formating 2019-10-29 02:56:28 +01:00
Amjith Ramanujam f3dc23a94b
Merge pull request #1112 from dbcli/j-bennet/pqconninfo-1110
[WIP] Fix for PQconninfo not available.
2019-10-28 10:08:59 -07:00
Amjith Ramanujam 43e79d0027 Use libpq version instead of psycopg2 version. 2019-10-26 19:45:02 -07:00
Irina Truong 270e1ce7a2 Log message. 2019-10-26 13:21:23 -07:00
Owen Stephens 995e7a9deb Disable escape-enter keybinding in vi mode
Escape then enter intended as two separate key presses is a very common
sequence when using vi mode - returning to normal mode from insert mode
(escape) and then submitting the query (enter). The presence of the
escape-enter key binding overrides this behaviour by inserting
undesirable newlines (newline is be easily inserted when in insert mode
by pressing enter) or by introducing a noticable delay/lag before enter
can be pressed after escape, due to prompt toolkit not being able to
recognise escape immediately (since it may form part of an escape-enter
sequence).
2019-10-23 23:12:54 +01:00
Amjith Ramanujam f25e49555a Fix the condition for <enter> key. (#1114)
* Fix the condition for <enter> key.

* Improve the debug message and remove debug statement.
2019-10-23 22:11:44 +01:00
Irina Truong 4f0c4d5a38 Fix for PQconninfo not available. 2019-10-19 11:36:38 -07:00
Amjith Ramanujam a713b5d08b
Merge pull request #1107 from owst/function_arg_completions_with_alias
Take account of table aliases when completing function args (#1048)
2019-10-16 20:57:19 -07:00
Owen Stephens e9b18f9e84 fixup! fixup! Take account of table aliases when completing function args (#1048) 2019-10-16 23:33:43 +01:00
Owen Stephens 629a931aed fixup! fixup! Handle a multi-line query on Enter key-press (fixes #1031) 2019-10-16 22:26:25 +01:00
Owen Stephens 6763433a68 fixup! Handle a multi-line query on Enter key-press (fixes #1031) 2019-10-13 13:50:36 +01:00
Owen Stephens 7f44748149 Handle a multi-line query on Enter key-press (fixes #1031)
Use a (conditional) Enter key-binding to force-handle a multi-line
buffer, rather than doing so by (conditionally) disabling the multiline
mode of prompt_toolkit.

This has the benefit of being more efficient (the multiline Condition
filter is called very often, which (due to the repeated query parsing)
causes editing to become slow with a large buffer that ends in a
semicolon), clearer in intent (we want to force-handle the query, rather
than (temporarily) disable multiline mode which indirectly forces the
buffer to be handled) and avoids a bug in multi-line history search
(issue #1031)
2019-10-13 01:07:57 +01:00
Owen Stephens b401b16d9a Take account of table aliases when completing function args (#1048) 2019-10-12 16:19:15 +01:00
Christopher Harrington 7a77eda241
rm Google Group from main.py 2019-09-29 14:16:55 -05:00
Irina Truong 04a74fce2c Get server params, such as is_superuser and server_version, without extra queries. 2019-08-28 08:26:24 -07: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
Pedro Ferrari 19c3e0eeb8 Add key bindings to consistently move up and down in history (#1084) 2019-07-29 13:00:33 -07:00
Sebastian Janko f85642da67 Issue 1019 stacktrace on empty query (#1078)
* Added changes to skip empty queries

Empty queries consist of one or more semicolons

* Reformatted with black

* Added contribution to changelog and name to AUTHORS

* Black.
2019-07-12 17:24:39 -07:00
Irina Truong 10cc4ce2b9 Partial fix for #1058. (#1068) 2019-06-09 17:05:28 +02:00
Amjith Ramanujam f27ac1c110
Merge pull request #1064 from dbcli/amjith/slash-G
Add \G as a temporary way to use expanded mode.
2019-06-03 17:12:38 -07:00
Pablo 6d6ab3dab7 Add keybinding for alt-enter to introduce a line break (#1065)
* Add keybinding for alt-enter to introduce a line break.

* Update changelog.

* Added myself to AUTHORS file

* Fixed quote issue by pre-commit
2019-06-02 19:15:16 -07:00
Amjith Ramanujam 9abb4f8560 Run black. 2019-06-02 18:02:02 -07:00
Amjith Ramanujam 3a45620731 Add \G as a temporary way to use expanded mode.
This is similar to mycli.
2019-06-02 17:57:36 -07:00
Irina Truong 77bd30dc95 Releasing version 2.1.1 2019-05-30 17:11:03 -07:00
Irina Truong 8cb7009bcd
black all the things. (#1049)
* added black to develop guide

* no need for pep8radius.

* changelog.

* Add pre-commit checkbox.

* Add pre-commit to dev reqs.

* Add pyproject.toml for black.

* Pre-commit config.

* Add black to travis and dev reqs.

* Install and run black in travis.

* Remove black from dev reqs.

* Lower black target version.

* Re-format with black.
2019-05-25 13:08:56 -07:00
Irina Truong d661f63eec pep8. 2019-05-21 20:28:05 -07:00
Amjith Ramanujam 5177c9922e Add a behave test with spaces in password. 2019-05-15 23:40:21 -07:00
Amjith Ramanujam a45c67acf0 Handle password with spaces. 2019-05-13 15:13:15 -07:00
Irina Truong 300febccdd Dsn parameters not always present. (#1054)
* Dsn parameters not always present.
2019-05-11 07:57:45 +02:00
Amjith Ramanujam fe1b202c55
Merge branch 'master' into pr1047 2019-05-06 11:11:47 -07:00
Amjith Ramanujam 1908142adb Upgrade to sqlparse 0.3.0. 2019-05-06 09:05:56 -07:00
Amjith Ramanujam a6d44df4a7 Merge branch 'master' into pr1035 2019-05-06 07:18:46 -07:00
Amjith Ramanujam e5501cb83c Check if dsn and password values are passed in. 2019-05-06 06:34:24 -07:00
zzl 6d1b653e24 lazy load keyring. (#1046)
fix issue: https://github.com/dbcli/pgcli/issues/1041
2019-05-01 08:53:55 -07:00
Irina Truong 3fd91012f2
More intelligent dsn format (#1045)
* Psycopg2 already has a method to format a dsn. We should use it. Fix for #1043.

* Changelog.

* pep8.
2019-04-28 15:06:01 -07:00