1
0
Fork 0
Commit Graph

366 Commits

Author SHA1 Message Date
Sharon Yogev 0ad3393fa8
confirm_destructive_query: Use confirm rather than prompt (#1410)
* confirm_destructive_query: Use confirm rather than prompt

* Fix tests
2023-10-18 09:25:29 -07:00
astroshot 69dcceb5f6
Fix sql-insert format emits NULL as 'None' (#1409)
* Sub: Fix issue #1408

Body:
1. Fix issue #1408 sql-insert format emits NULL as 'None';
2. Fix DUAL displays as ""DUAL"";

==== End ====

* Sub: Update changelog.rst

Body:

==== End ====

* Sub: Optimize if logic

Body:

==== End ====
2023-06-23 07:05:58 +02:00
Damien Baty d8eb8b5b82 Apply black (version 23.1.0) 2023-03-18 14:00:38 +01: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
Kian-Meng Ang d608ffe7c7
Fix typos (#1345)
Co-authored-by: Irina Truong <i.chernyavska@gmail.com>
2022-06-08 11:38:29 -07: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 1d2570f462 Include functions from search_path in completion. 2021-05-06 21:12:48 -07:00
Paweł Sacawa 26bdc4e759 Add missing function literals 2021-05-06 05:15:05 -04: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
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
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
Irina Truong 106c6c7bf8 Fix for #1193 list index out of range on sql comment. 2020-06-26 14:01:24 -07:00
Georgy Frolov 61c81b05f5 removed py2-related stuff 2020-03-14 10:53:43 +08:00
Tim Gates 8456dcb18f
Fix simple typo: thows -> throws
Closes #1128
2019-12-05 08:35:22 +11: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 b401b16d9a Take account of table aliases when completing function args (#1048) 2019-10-12 16:19:15 +01: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
Amjith Ramanujam 1908142adb Upgrade to sqlparse 0.3.0. 2019-05-06 09:05:56 -07:00
Irina Truong 0cae7e2036
Remove some functions completions (#982)
Remove extension and private functions from completer.
2019-01-02 16:15:59 -08:00
Amjith Ramanujam 25a66ecfb3 Fix the StopIteration issue in Python 3.7 (#971)
* Fix the StopIteration issue in Python 3.7
2018-11-18 20:11:15 -08: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
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
Jason Ribeiro 9014d96526 Add completion for table formats 2018-05-14 16:54:52 -04:00
Dan Clark e105fda516 Actually port the prompt functions 2018-05-14 10:05:38 -04:00
Dan Clark 938826dbe4 Added prompt_utils from mysql 2018-05-14 09:54:57 -04:00
Andrew Speed 82d84ec89f Remove OrderedDict workaround for python < 2.7 2017-08-20 14:46:45 +01: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
François Pietka ee29475089
Add COLUMN as possible keyword after DROP 2017-08-07 00:19:07 +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 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
Joakim Koljonen a326e54884
Merge branch 'master' into koljonen/suggest_functions_with_args 2017-07-16 12:13:36 +02:00
Joakim Koljonen 28a3afc763
Some renames for compatibility with the function-arguments PR 2017-07-08 23:08:11 +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
Joakim Koljonen 2b0ca684d4
Add defaults to column metadata 2017-07-05 17:57:38 +02: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 02698b3c85
Preparatory rename 2017-06-24 21:59:21 +02: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
Étienne BERSAC e124c03575
Fix PEP8 empty line errors 2017-06-14 18:12:05 +02:00
Thomas Roten 6a330140bb Remove tabulate and expanded output. 2017-06-11 21:20:24 -05:00
Irina Truong ea0556b8c6 Schema name should be escaped in SET SCHEMA. 2017-06-09 14:41:33 -07:00
Irina Truong fc3025e9bc Refresh completions after COMMIT or ROLLBACK. 2017-05-28 17:56:48 -07:00