1
0
Fork 0
Commit Graph

1257 Commits

Author SHA1 Message Date
Lele Gaifax 05ec05c4cb Adapt the query used to get functions metadata to PG11
This fixes #919.
2018-07-25 08:13:17 +02:00
Irina Truong 22d184dc6b Change server version query. 2018-07-24 15:14:53 -07:00
Irina Truong e4f02b247e Releasing version 1.10.2 2018-07-23 17:09:57 -07:00
Dick Marinus 868b81aa98 make keyring optional 2018-07-22 07:34:56 +02:00
Irina Truong 7653ea9c1f Print server version as part of welcome message. 2018-07-20 15:47:40 -07:00
Irina Truong 2fa7b1458a Releasing version 1.10.1 2018-07-20 09:08:18 -07:00
Irina Truong 83b2981a0f Fixes #909. 2018-07-19 18:21:33 -07:00
Kenny Do 408c0329ec pass when no supported keyring backend available 2018-07-19 14:11:27 -07:00
Irina Truong 79e4dbcf11 Releasing version 1.10.0 2018-07-14 12:59:10 -07:00
Irina Truong 5491d288fc
Merge pull request #903 from arturbalabanov/render-tabs-with-spaces
Fixes #346: Tab characters are rendered with spaces instead of "^I" when entered in external editor
2018-07-13 13:24:44 -07:00
Amjith Ramanujam 6eedf1b6e3 Catch the ^D keybinding using EOFError exception. 2018-07-10 22:51:38 -07:00
Artur Balabanov 44d4275eae Prettify the code to keep Travis happy :) 2018-07-06 18:02:52 +01:00
Artur Balabanov 87451b3806 A new input processor has been added that renders tab characters as spaces instead of the ugly '^I' 2018-07-06 17:37:43 +01:00
Saif Hakim 80957c59c5 Fix lint, update AUTHORS, and changelog 2018-07-04 01:36:50 -07:00
Saif Hakim 5cdb151999 Avoid reconnect prompt after error if connection is still valid
Instead of whitelisting all errors that do not require reconnecting, we simply
only reconnect if we detect a disconnect has occurred.

psql notably behaves in a similar way: https://git.io/fbxuc#L1461

Fixes #807
2018-07-03 23:56:26 -07:00
Amjith Ramanujam 4c173fd01f Gurad against missing keyring backend. 2018-06-25 13:55:54 -07:00
Irina Truong 10f190a13a Rebase conflict. 2018-06-17 17:21:03 -07:00
Irina Truong a26b8b92a2 Pep8. 2018-06-17 14:34:20 -07:00
Irina Truong 4b06769002 Can't add tuple and list. 2018-06-17 14:21:30 -07:00
Irina Truong aa58fbf028 Non-existent function will raise a ProgrammingError. 2018-06-16 21:49:28 -07:00
Irina Truong 8ee20aa82e Fix for 'only named arguments may follow *expression' 2018-06-16 21:49:28 -07:00
catherinedevlin 74daa23a45 switched view query to imitating psql 2018-06-16 21:47:18 -07:00
catherinedevlin bb8cbac3de Added \ef 2018-06-16 21:46:31 -07:00
catherinedevlin 675e1dbff2 Moved code to pgexecute 2018-06-16 21:46:31 -07:00
Alexandr Korsak da12182609 Fix formatting for --user 2018-06-15 10:52:28 +03:00
Alexandr Korsak 4963e34c3a add compatible --user like psql command 2018-06-15 09:07:32 +03:00
Matthieu Guilbert f13637aa21 Fix unbound local error when destructive_warning is false 2018-06-10 16:36:51 +08:00
Matthieu Guilbert 1a2421892b fix: not enough values to unpack 2018-06-07 00:43:48 +08:00
Irina Truong b8a6dfd357 Ugh. 2018-06-01 14:00:57 -07:00
Irina Truong 9e54a9ef56 Fix for ipython sql connection. Fixes #891. 2018-06-01 08:18:24 -07:00
Dick Marinus 2ce2a87f37 make keyring optional 2018-05-26 11:26:06 +02:00
Amjith Ramanujam 9ae9df624f
Merge branch 'master' into feature/get-last-sql-query 2018-05-18 21:48:21 -07:00
Amjith Ramanujam 0643fd6534
Merge branch 'master' into master 2018-05-17 05:57:46 -07:00
Dan Clark 8fce953a8c ported the desctructive warning from mycli 2018-05-17 05:54:50 -04:00
Amjith Ramanujam 8e12ea5e0f
Merge pull request #873 from cfournie/remember_passwords
Remember prompted passwords using keyring
2018-05-16 17:49:31 -07:00
Rishi Ramraj f520b2ebb2 Add is_special to the \\o command 2018-05-15 11:57:19 -04:00
Rishi Ramraj b44357dc67 Fix typo 2018-05-15 10:54:07 -04:00
Rishi Ramraj 3425766dea Code review fixes 2018-05-15 10:45:36 -04:00
Amjith Ramanujam 5990e55413 Restrict the offer to reconnect. 2018-05-15 10:06:50 -04:00
Rishi Ramraj 07e54fb69f Fix is_special flag 2018-05-15 01:25:33 -04:00
Rishi Ramraj ca63a54ada Add special flag 2018-05-15 00:51:44 -04:00
Rishi Ramraj a49f5bdd0f Add is_special to run return 2018-05-15 00:35:07 -04:00
Rishi Ramraj 54942ce0d7 Remove unnecesssary parameter 2018-05-14 20:37:16 -04:00
Amjith Ramanujam f8757c6f59
Merge pull request #879 from dbcli/pr877
Fix lint complaints.
2018-05-14 17:33:06 -04:00
Amjith Ramanujam d971e49993
Merge pull request #877 from catherinedevlin/keep_callables
Keep callables
2018-05-14 17:32:11 -04:00
Amjith Ramanujam 740d4f1249 Fix lint complaints. 2018-05-14 17:30:52 -04:00
Jason Ribeiro 9014d96526 Add completion for table formats 2018-05-14 16:54:52 -04:00
catherinedevlin dc74a0acd0 Merge remote-tracking branch 'upstream/master' into keep_callables 2018-05-14 16:31:19 -04:00
catherinedevlin 0d00e38b6d prevent losing saved_callables on error 2018-05-14 16:04:31 -04:00
Amjith Ramanujam 7d0f866afb Fix lint complaints. 2018-05-14 14:58:17 -04:00
Jason Ribeiro f836c3a3a4 Disable pager when using \watch 2018-05-14 14:20:37 -04:00
Irina Truong 5eb0fd5ddc
Merge pull request #875 from jrib/quit-help
Add quit commands to completion
2018-05-14 13:04:55 -04:00
Jason Ribeiro 25d148df1e Add quit commands to completion 2018-05-14 12:14:14 -04:00
Chris Fournier 09a43ccd49 Remember prompted passwords using keyring 2018-05-14 11:30:50 -04:00
Dan Clark e105fda516 Actually port the prompt functions 2018-05-14 10:05:38 -04:00
Chris Fournier b2a3a4b63b Encourage users to use SSL 2018-05-14 09:57:24 -04:00
Dan Clark 938826dbe4 Added prompt_utils from mysql 2018-05-14 09:54:57 -04:00
François Pietka 8cd3309b18
Add application name 2018-04-26 14:24:09 +02:00
Irina Truong b308892606 Releasing version 1.9.1 2018-04-04 08:58:06 -07: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
Andrew Kuchling a91afadccf #858: make \h in prompt return the first part of the hostname; add \H to return whole hostname 2018-03-28 08:06:47 -04:00
fraoustin 344317df34 explicit sample in pgclirc 2018-03-23 23:24:35 +01:00
Баданин Дмитрий ab65d18f56
fix database list option (pgcli -l) 2018-03-22 13:06:06 +03:00
fraoustin 88b12c1e2c move style_factory_output in pgstyle 2018-03-04 11:41:10 +01:00
fraoustin ade6142ef8 add color for table 2018-03-04 11:05:50 +01:00
Irina Truong cde420e271 Releasing version 1.9.0 2018-03-02 15:04:43 -08:00
fraoustin f671d2f922 correction for pep8radius master --docformatter --diff 2018-02-17 22:02:06 +01:00
fraoustin f5eb92bde2 add option list-dsn 2018-02-10 17:00:44 +01:00
Irina Truong 8138ae8e31
Merge pull request #832 from fraoustin/nopager
Nopager
2018-01-27 14:25:29 -08:00
fraoustin b0ca4a9016 add parameter enable_pager with Value True and pep8raidus 2018-01-17 19:57:12 +01:00
fraoustin 0250ab4c39
Update main.py 2018-01-17 12:53:28 +01:00
fraoustin 64a683cae7
Update pgclirc 2018-01-17 12:48:36 +01:00
fraoustin 91ebe135d3
Update main.py 2018-01-17 12:47:43 +01:00
fraoustin 57cc451f06 manage pset pager 2018-01-06 11:58:59 +01:00
Irina Truong cb3cb1bb8c Add a couple missing click option types. 2018-01-05 17:27:51 -08:00
fraoustin 837dc74272 change msg if ValueError 2018-01-03 22:05:45 +01:00
fraoustin f655208654 change command t by T 2018-01-03 21:25:03 +01:00
fraoustin fbe0890b1b add change format 2018-01-03 11:07:04 +01:00
Chris Vaughn cc4854214e correct typo in pgclirc comment 2017-12-23 07:07:01 -06:00
Irina Truong 4153477f8a Releasing version 1.8.2 2017-12-20 21:06:29 -08:00
Bojan Delić 8bd7a7a94f Include username to password prompt. #823
As described in ticket #823, this is useful for matching prompt for
different usernames and auto populating passwords. iTerm2 has password
manager that is capable of doing this, but other terminal managers might
be able to do it as well.
2017-12-20 23:58:53 +01:00
isank e413f0563e ≈Merge branch 'master' of github.com:dbcli/pgcli into 816 2017-12-17 04:38:25 +05:30
Irina Truong df2bb2b997 PEP8. 2017-12-16 14:00:26 -08:00
isank 2c02f56c41 Fixed #816 The --list command line option tries to connect to 'personal' DB 2017-12-16 21:04:10 +05:30
Marcin Sztolcman 7aa8ff8e4b fixed prompt-dsn option description 2017-12-15 08:46:00 +01:00
Marcin Sztolcman 57ee2403b6 fixed description for --prompt-dsn option 2017-12-13 04:46:43 +01: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
Irina Truong 7a4d9a0792 Fix for #805 (partial). 2017-10-21 11:10:45 -07:00
Amjith Ramanujam 614a42f03f Do NOT escape database names. 2017-10-11 12:58:32 -07:00
Dmitry B 0ccf008cf8 look for config in XDG_CONFIG_HOME first 2017-10-03 22:27:24 +03:00
Irina Truong 915ffb70a7 Releasing version 1.8.1 2017-09-19 12:47:47 -07:00
Dick Marinus d81faefa5f Remove shebang and git execute permission from pgcli/main.py. 2017-09-15 20:46:51 +02:00
Irina Truong 31305e5600 Releasing version 1.8.0 2017-09-14 13:02:11 -07:00
Dick Marinus ca88e62a17 Port auto_vertical feature test from mycli to pgcli 2017-09-05 20:39:13 +02:00
Dick Marinus 223eec9d2c use cursor from psycopg in pgcli 2017-08-21 08:50:28 +02:00
Andrew Speed 82d84ec89f Remove OrderedDict workaround for python < 2.7 2017-08-20 14:46:45 +01:00
Dick Marinus d2ecbde849 Preliminary work for a future change in outputting results that uses less memory 2017-08-18 20:40:16 +02:00
Irina Truong 1e77eab21b Merge pull request #773 from dbcli/fpietka/conninfo
Add \conninfo command
2017-08-13 17:21:42 -07:00
François Pietka 902fe94f3c
Fix psycopg2 error code lookup 2017-08-12 13:03:29 +02:00
François Pietka 5194fdc89f
(lint) Fix indentation 2017-08-12 13:03:29 +02:00
François Pietka 104f159aa9
Handle more option for \c 2017-08-12 13:03:29 +02:00
François Pietka 727a123429
Add \conninfo command 2017-08-12 13:03:28 +02:00
François Pietka 9c0304df1f
Get socket directory if no host provided by psycopg2 2017-08-12 13:03:28 +02:00
François Pietka 60f3a50b5c
Add query to get socket directory 2017-08-12 13:03:28 +02:00
Thomas Roten 70db642c4b Add null_string to config file. 2017-08-09 12:53:42 -05:00
Amjith Ramanujam 887a826415 Merge branch 'master' into koljonen/array_formatting 2017-08-06 21:16:08 -06:00
Amjith Ramanujam 99c9040c3d Merge pull request #771 from dbcli/koljonen/reservered_words
Don't quote identifiers that are non-reserved keywords
2017-08-06 21:14:40 -06:00
Amjith Ramanujam 962f53fbf8 Merge branch 'master' into fpietka/drop-column 2017-08-06 21:08:48 -06:00
Joakim Koljonen 4dc68b846b
Make pep8radius happy
I don't know why pep8radius didn't like this line, and I think its suggested
change would have made the code considerably less legible. So here's some
sort of compromise where pep8radius gets its line break and I get indentation
that at least makes some sense.
2017-08-07 03:43:00 +02:00
Joakim Koljonen a92e052877
Rename unused params to _ 2017-08-07 02:34:39 +02:00
Thomas Roten da9f1975e5 Convert generator to list before looping. 2017-08-06 19:09:16 -05:00
Joakim Koljonen c97f53399f
Move py2/3 str/unicode logic to encodingutils.py 2017-08-07 01:16:56 +02:00
Joakim Koljonen a21c9eb294
Fix for Python 3 compatibility 2017-08-07 00:53:36 +02:00
François Pietka ee29475089
Add COLUMN as possible keyword after DROP 2017-08-07 00:19:07 +02:00
Joakim Koljonen c616a8b422
Improve formatting of array output
Before this change, e.g. `SELECT '{1}'::numeric` would output `[Decimal(1)]`.
Now it instead outputs `{1}`.
2017-08-06 19:30:34 +02:00
Joakim Koljonen b90beeb4d3
Don't quote identifiers that coïncide with non-reserved keywords
Keep track of which keywords are reserved, and quote identifiers
that coïncide with those.
https://www.postgresql.org/docs/10/static/sql-keywords-appendix.html
2017-08-06 09:46:52 +02:00
Joakim Koljonen 9d146f63aa
Don't include args in function suggestions for backslash commands 2017-08-06 08:13:43 +02:00
François Pietka f63081495c
Use psycopg2 to get database details 2017-07-29 16:05:35 +02:00
François Pietka 7baa76f2c1
PEP8 lint 2017-07-27 14:20:13 +02:00
François Pietka a9f4864d73
Use raw strings where needed to avoid backslash ambiguity 2017-07-27 14:08:12 +02:00
Amjith Ramanujam 1301b7ad7b Change the continuation char to empty string. 2017-07-24 10:32:37 -07:00
Amjith Ramanujam 5a8e5d21b6 Merge pull request #677 from dbcli/koljonen/suggest_functions_with_args
Include arguments in function suggestions
2017-07-20 09:48:28 -07:00
Amjith Ramanujam 2c80a8c98f Change the casing default to 'auto'. 2017-07-16 20:26:43 -07:00
Amjith Ramanujam 925341cbce Add fish-style autosuggestion. 2017-07-16 15:20:10 -07:00
Joakim Koljonen a326e54884
Merge branch 'master' into koljonen/suggest_functions_with_args 2017-07-16 12:13:36 +02:00
Irina Truong da48bdd6a4 Releasing version 1.7.0 2017-07-15 20:12:44 -07:00
François Pietka e8e7e41d70
Add option to list databases from command line 2017-07-15 01:18:32 +02:00
François Pietka ce88f56107
Add method to list databases with full information 2017-07-15 01:18:32 +02:00
Joakim Koljonen 534c0de47e
Fix crash bug whenever connecting to a DB that requires a password 2017-07-11 10:55:43 +02:00
Amjith Ramanujam fd5e030243 Merge pull request #744 from dbcli/koljonen/better_insert_star_completion
Better * expansion for inserts
2017-07-09 14:28:53 -07:00
Joakim Koljonen 28a3afc763
Some renames for compatibility with the function-arguments PR 2017-07-08 23:08:11 +02:00
Joakim Koljonen 9479808a75
Try to make linter happy 5 2017-07-07 17:22:21 +02:00
Joakim Koljonen d4396686a1
Try to make linter happy 4 2017-07-07 17:22:21 +02:00
Joakim Koljonen 2341f50034
Try to make linter happy 3 2017-07-07 17:22:20 +02:00
Joakim Koljonen 81ed311963
Try to make linter happy 2 2017-07-07 17:22:19 +02:00
Joakim Koljonen c5eaa77778
Try to make linter happy 2017-07-07 17:22:19 +02:00
Joakim Koljonen f5784746d9
Skip unwanted columns when expanding `INSERT INTO tbl(*`
Skip those that have a default value of some sequence (i.e. serial columns)
and those that have a default value of 'now()'.
2017-07-07 17:22:17 +02:00
Donnell Muse f84d421d46 Added InterfaceError handling for closed connection 2017-07-06 00:58:52 -04:00
Joakim Koljonen fdacd906a6
Some restructuring of get_column_matches() 2017-07-05 19:07:56 +02:00
Joakim Koljonen 2b0ca684d4
Add defaults to column metadata 2017-07-05 17:57:38 +02:00
Thomas Roten d26a1933aa Fix comparison. 2017-06-26 12:09:37 -05:00
Thomas Roten 423eefe0d6 Make 0 index implicit. 2017-06-26 12:07:01 -05:00
Thomas Roten bc80064915 Check content width based on first line of formatted output. 2017-06-26 11:58:17 -05:00
Thomas Roten 45a14530e2 Make align_decimals usage based solely on float_format. 2017-06-26 11:33:45 -05:00
Thomas Roten 7ef74ae3bd Move format_output out of Pgcli class. 2017-06-26 10:10:41 -05:00
Thomas Roten b7c1ba89f0 Move CLI Helper instantiation to format_output method. 2017-06-26 08:59:09 -05:00
Joakim Koljonen 5ef0c0ccea
Suggest function signature after `CREATE FUNCTION` 2017-06-25 12:49:23 +02:00
Joakim Koljonen f355c30ef7
Include arguments in function completions
E.g. instead of suggesting `my_func()`, suggest `my_func(arg1 :=, arg2 :=)`
or `my_func(arg1 text, arg2 bigint)`, depending on the context.
2017-06-25 01:35:22 +02:00
Joakim Koljonen 15b34c1dc9
Simplify pgcompleter.get_function_matches 2017-06-24 21:59:21 +02:00
Joakim Koljonen 02698b3c85
Preparatory rename 2017-06-24 21:59:21 +02:00
Thomas Roten a04be71ec7 Use align_decimals if no format strings are provided. 2017-06-22 13:44:27 -05:00
Thomas Roten 8d3e070d7e Add back utf8tounicode on headers. 2017-06-19 08:49:42 -05:00
Thomas Roten de9069d3d9 Merge branch 'master' of github.com:dbcli/pgcli into feature/cli_helpers_output_format
* 'master' of github.com:dbcli/pgcli:
  Use standard NullHandler
  Golf pep8radius
  Fix PEP8 empty line errors
2017-06-19 08:42:20 -05:00
Thomas Roten cc2ede2e79 Use integer_format for cli_helpers. 2017-06-18 22:45:29 -05:00
Thomas Roten 03bf6ec982 Add decimal/float format to format_output. 2017-06-15 13:01:59 -05:00
Étienne BERSAC e517525cf8
Use standard NullHandler 2017-06-15 09:49:53 +02:00
Étienne BERSAC e124c03575
Fix PEP8 empty line errors 2017-06-14 18:12:05 +02:00
Thomas Roten 44fac89ab5 Disable numparsing in tabulate. 2017-06-12 12:01:15 -05:00
Thomas Roten 6a330140bb Remove tabulate and expanded output. 2017-06-11 21:20:24 -05:00
Thomas Roten 61f0d63013 Initial work on using CLI Helpers. 2017-06-11 21:07:40 -05:00
Irina Truong d060de940e Merge branch 'master' into j-bennet/set-less-if-unset 2017-06-10 17:35:32 -07:00
Irina Truong ea0556b8c6 Schema name should be escaped in SET SCHEMA. 2017-06-09 14:41:33 -07:00
Irina Truong ba8341ef67 PEP8. 2017-06-09 11:32:06 -07:00
Irina Truong c309122f67 Only change LESS in env if not already configured. 2017-06-09 11:13:40 -07:00
Thomas Roten bdf0d88ef3 Merge branch 'master' of github.com:dbcli/pgcli into j-bennet/refresh-after-rollback
* 'master' of github.com:dbcli/pgcli:
  Create signed tags in release script.
  Updated changelog.
  Some pep8 in config module.
  DSN aliases should take custom pgclirc into account.
2017-05-29 08:00:49 -05:00
Thomas Roten 2989f16756 PEP 8 fix. 2017-05-29 07:59:16 -05:00
Irina Truong fc3025e9bc Refresh completions after COMMIT or ROLLBACK. 2017-05-28 17:56:48 -07:00
Irina Truong b3537d4249 Some pep8 in config module. 2017-05-28 15:03:45 -07:00
Irina Truong 7ea82a899f DSN aliases should take custom pgclirc into account. 2017-05-28 15:03:31 -07:00
Irina Truong 9d3fa4c81f Releasing version 1.6.0 2017-05-27 12:43:38 -07:00
Alexander Schmolck 0c729909cd Make it possible to use SSL with pgcli
This adds support for additional url query params which make stuff like

```
pgcli "postgres://user:pass@host.invalid/db?\
sslmode=verify-full&sslcert=my.pem&sslkey=my-key.pem&sslrootcert=ca.pem"
```

work. More generally it allows one to pass through various extra connection
options.
2017-05-25 14:49:30 +01:00
gustavo df90e5a8f6 Fixing minor details 2017-05-10 01:20:08 +02:00
gustavo e0219f4d5b Adding time option for the Prompt Format 2017-05-09 23:55:12 +02:00
Thomas Roten bf8c9b1a9d Remove editor command before opening editor. 2017-05-03 12:54:03 -05:00
Thomas Roten c389f5371d Edit last-run query in external editor. 2017-05-02 23:31:29 -05:00
Irina Truong c2dd7670fa User option should take precedence over environment variable. Fixes #697. 2017-04-30 16:43:24 -07:00
Irina Truong 2e4b907b19 Merge pull request #701 from jdpopkin/fix_lock_error
Fix handling of failure to obtain lock
2017-04-30 16:12:27 -07:00
Jackson Popkin 2c519711db Handle failure to obtain lock 2017-04-29 20:56:34 -04:00
Irina Truong e78aa8ee6e Merge pull request #702 from hatarist/fix_code_typo
Fix typo in parseutils.meta.FunctionMetadata
2017-04-29 15:33:15 -07:00
Igor Hatarist 8d8c3b18e2 Fix typo in parseutils.meta.FunctionMetadata 2017-04-29 05:43:55 +03:00
Étienne BERSAC 219b4a52d9
Fix PEP8 for #693 2017-04-27 21:32:44 +02:00
Étienne BERSAC 293b6b3a41
Complete keywords depending on previous token
Keywords list is based on
https://www.postgresql.org/docs/9.6/static/sql-commands.html.
2017-04-27 21:32:43 +02:00
Étienne BERSAC d4967adf41
Complete from last keywords for CREATE and DROP too 2017-04-27 21:32:43 +02:00
Étienne BERSAC b1e0e84bb7
Store keywords tree 2017-04-27 21:32:43 +02:00
Étienne BERSAC 7fc0dd85af
Use generic ALTER keyword instead of ALTER TABLE 2017-04-27 21:32:43 +02:00
Irina Truong bad238f996 Merge pull request #686 from owst/column_completion_for_order_by_and_distinct
Suggest columns for `ORDER BY` and `DISTINCT` (fixes #685)
2017-04-26 11:01:32 -07:00
Owen Stephens 3d560baf6c Suggest columns for `ORDER BY` and `DISTINCT` (fixes #685)
Having typed an alias name in an `ORDER BY` or (`SELECT`) `DISTINCT`
clause, the alias was not taken account of, and the completion simply
listed all columns. This change fixes that, and makes the autocompletion
behave the same as in `SELECT` and `WHERE` clauses.
2017-04-26 01:10:57 +01:00
Lele Gaifax 5da1a4154c Suggest functions for \\sf
Move the specials suggestion map to a constant dictionary, to avoid
repeating the key names.
2017-04-25 11:34:44 +02:00
Lele Gaifax 67f153e38e Fix typo in comment 2017-04-25 11:34:18 +02:00
Amjith Ramanujam edf40d052b Merge branch 'master' into koljonen/case_column_titles 2017-04-21 07:38:14 -07:00
Russell Davies f8597b78a6
Standardize command line option names
This standardizes on the same names as psql and removes some
conflicts.
2017-04-07 12:02:07 +01:00
Owen Stephens e5d3d5d63f Allow configurable multiline continuation char 2017-03-30 11:12:25 +01:00
Irina Truong 1ead2ed62e Added comment. 2017-03-20 09:24:29 -07: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
Irina Truong 7e5ae94dba Attempt to fix #668 (not pretty). 2017-03-15 21:18:21 -07:00
Joakim Koljonen 9a8d2c2d6f
Make format_output take a settings object 2017-03-16 03:06:56 +01:00
darikg 7b14da9b4c Merge pull request #649 from dbcli/koljonen/suggest_from_all_schemas
Suggest objects from schemas not in search_path
2017-03-14 16:36:36 -04:00
Irina Truong 324abde72a Releasing version 1.5.1 2017-03-14 08:35:02 -07:00
Joakim Koljonen 0df6e37dca
Add some comments 2017-03-13 23:18:44 +01:00
Joakim Koljonen cec8aaf16d
Make schema-qualified objects sort after non-schema-qualified 2017-03-13 22:58:31 +01:00
Irina Truong 6d37b9209d Combine select queries for connection properties. 2017-03-13 11:12:09 -07:00
Irina Truong dcd9cbac4f Fix set_session cannot be used inside a transaction when using dsn. Connect #664. 2017-03-13 11:02:16 -07:00
tk 6c2abba18b
Simplify assignment of self.less_chatty. 2017-03-11 02:31:02 -06:00
tk 6a42d4e91e
Add a command line option for --less-chatty. Fix #626. 2017-03-10 02:44:24 -06:00
koljonen 1277752d62
Find statements inside function body
Consider this script
```
CREATE FUNCTION foo() returns text LANGUAGE SQL AS $func$
SELECT 1 FROM Bar;
SELECT <cursor> FROM Baz;
$func$;
```
The change here is that `SELECT <cursor> FROM Baz;` will be seen as the
current statement, instead of the whole function definition.
This means we'll no longer get column suggestions from `Bar`.
2017-03-09 01:41:11 +01:00
Amjith Ramanujam 7f009c630f Add support for unicode chars in expanded mode. 2017-03-06 19:20:34 -08:00
Irina Truong 6e38853c99 Merge pull request #653 from dbcli/koljonen/materialized_view_keywords
Add MATERIALIZED VIEW keywords
2017-03-06 16:57:50 -08:00
Amjith Ramanujam de83ec24f0 Releasing version 1.5.0 2017-03-06 16:36:02 -08:00
Joakim Koljonen 6b8c62d0ec
Add MATERIALIZED VIEW keywords 2017-03-06 23:16:29 +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
Joakim Koljonen 5514a4b67e
Preparatory restructuring to simplify the next commit
No changes in function.
2017-03-05 00:42:19 +01:00
Amjith Ramanujam bdabb6cee3 Reconnect on OperationalError. 2017-03-03 11:05:44 -08:00
Amjith Ramanujam 01f8f9f771 Adjust the connection order to work around psycopg2 restriction. 2017-03-03 06:04:53 -08:00
Irina Truong 9cc58b7087 Merge pull request #642 from dbcli/darikg/reserve-more-menu-space
User config to reserve more menu space
2017-02-25 14:23:35 -08:00
Darik Gamble fe44cd4b37 Add a config option for the number of menu lines to reserve 2017-02-25 09:18:54 -05:00
Darik Gamble f314f8301b Suggest keywords after ALTER 2017-02-25 09:01:11 -05:00
Jonathan Virga 0559c5119e Switch the shorted prompt when prompt length is too long. Connect #587 2017-02-08 10:32:01 +01: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
Irina Truong 8a76a75523 Releasing version 1.4.0 2017-01-11 17:56:06 -08:00
darikg 44c7eb10c6 Merge pull request #624 from dbcli/koljonen/search_by_alias
Search suggestions by initialism
2017-01-09 10:54:31 -05:00
Joakim Koljonen 3cb73cc02c
Changes after review 2017-01-09 03:35:55 +09: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 ce55abc660
Initialism search for columns and functions
E.g. for table `Foo` with columns `FooBar` and `Fabulous`, inputting
`SELECT * FROM Foo F WHERE F.fb` will suggest `FooBar` as the #1 choice.
Likewise, given the functions `baz_baz()` and `baab()`, inputting
`SELECT bb` will have `baz_baz()` as the first option.
2016-12-12 02:45:39 +01:00
Joakim Koljonen 813afcaf11
Search table suggestions using initialisms
The idea is that if you have e.g. a table called `FooBar`, where we'd
use the initialism `FB` as an alias (suggesting `FooBar FB`),
inputting e.g. `SELECT * FROM FB` should suggest `FooBar FB` (or
`FooBar` if aliasing is disabled). Ditto for functions, views and joins.
The solution is that we send `FB` as a `synonym` to `find_matches`,
which results in the `FooBar` suggestion rising to the top (above e.g.
`FabulousTable`).
2016-12-12 02:45:39 +01:00
Joakim Koljonen 36568270fd
Clean up some leftovers 2016-12-12 02:45:39 +01:00
darikg a9352bdb22 Merge pull request #619 from dbcli/koljonen/qualify_columns
Table-qualifying column suggestions
2016-12-10 10:42:26 -05:00
Joakim Koljonen 466b8e74be
Better status-bar transaction-status colors 2016-12-10 05:13:29 +01:00
Joakim Koljonen 8f9c35f024
Optimization after code review 2016-12-10 05:11:52 +01:00
Joakim Koljonen f8b1647ae8
Add transaction status to toolbar 2016-12-07 04:39:03 +01:00
Joakim Koljonen 0129e49f7f
Display vi mode in the toolbar
I've been confused about what mode I'm in so many times ...
2016-12-07 03:00:50 +01:00
koljonen 45326335e6
Support for table-qualifying column suggestions
... i.e. suggesting foo.fooid instead of just fooid
Controlled using a config-file setting:
**qualify_columns**: always/never/**if_more_than_one_table**.

To enable the proper sorting of qualified column suggestions, we
introduce the concept of synonyms for suggestions
(in `pgcompleter.find_matches`). They way synonyms work is that a
number of synonyms may be provided for a suggestion sent to
`find_matches`. If synonyms are provided, sorting is based on how
well the best synonym matches the input, instead of only comparing
the input to the suggestion text.
In this case, the unqualified name acts as a synonym.
I have a couple of other ideas of use cases where we can use synonyms
to get better completions with less typing for the user, which I intend
to explore later.
2016-12-05 03:15:53 +01:00
Joakim Koljonen 41640738f1
Restructure pgcompleter.find_matches interface
Instead of accepting various synched lists as parameters, accept one
list of objects. There's no functional change here; this is just
a bit of cleanup before I go adding more parameters to this method.
2016-12-05 02:32:30 +01:00
Joakim Koljonen c2e76e335e
Fix scoping for columns from CTEs
We were suggesting all CTE columns regardless of whether the CTE in
question was included in the FROM clause.
2016-11-20 23:01:41 +01:00
Joakim Koljonen 279d6e85a7
Fix crash after `with` 2016-11-20 21:18:40 +01:00
Irina Truong 992ddeaf33 Added --prompt option. 2016-11-14 17:19:28 -08:00
Lele Gaifax d923ab3efd Fix issue #603
Python 3 forbids comparisons between different types: use a tuple
containing a single 0 (zero) as the priority for path matches so that it
can be compared with those generated by the workhorse method find_matches().
2016-10-31 18:33:07 +01:00
Amjith Ramanujam 10a4f9c46a Releasing version 1.3.1 2016-10-26 13:22:39 -07:00
Amjith Ramanujam a2f1f63523 Merge pull request #606 from dbcli/darikg/sqlparse022
Bump sqlparse to 0.2.2
2016-10-26 12:36:31 -07:00
Amjith Ramanujam 964b89ebc4 Releasing version 1.3.0 2016-10-26 09:52:07 -07:00
Darik Gamble dd43364feb token.is_group is now a property, not a method 2016-10-26 11:15:02 -04:00
Darik Gamble fe422738e7 Dollar sign quotes are handled differently now, makes this function almost trivial 2016-10-26 11:14:45 -04:00
Darik Gamble 9c32912b32 Hardcode case where last token is 'AS'
Fixes failing tests. In earlier versions of sqlparse this dangling AS was grouped with the previous
identifier so this case was handled implicitly
2016-10-26 11:12:59 -04:00
Amjith Ramanujam 4d149e827d Merge pull request #598 from dbcli/darikg/unrecognized-keywords
Darikg/unrecognized keywords
2016-10-19 20:46:42 -07:00
Lele Gaifax 9584c82a35 Fix typo in the decimal representation example 2016-10-17 20:27:29 +02:00
Darik Gamble d82591f7b7 Handle empty case 2016-10-17 13:58:52 -04:00
Darik Gamble 0881902207 If prev_keyword is an unrecognized keyword, go backward until we find a recognized one 2016-10-17 13:48:55 -04:00