1
0
mirror of https://github.com/dbcli/pgcli synced 2024-05-31 01:17:54 +00:00
Commit Graph

464 Commits

Author SHA1 Message Date
Damien Baty
d8eb8b5b82 Apply black (version 23.1.0) 2023-03-18 14:00:38 +01:00
Damien Baty
1c071770bb Remove leftovers of Python 2 support 2023-03-18 10:22:12 +01:00
Andy Schoenberger
2db54f14aa
fix psycopg.sql.Identifier in \ev handling (#1384) 2022-11-21 16:10:13 -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
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
ERYoung11
c93b15e98f oy, updated the issue. 2022-08-31 21:51:09 -05:00
ERYoung11
2850c83310 black'd the code. 2022-08-31 21:48:06 -05:00
ERYoung11
7a022a5f74 Removed unused re 2022-08-31 21:44:27 -05:00
ERYoung11
f7b1621e34 fixed comments with special see Issue #1362 2022-08-31 21:41:11 -05:00
Irina Truong
f04ffae12f Add test. 2022-06-10 11:26:53 -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
Irina Truong
18071754bc
Port to psycopg3 (#1324)
* WIP.

* Add some comments about porting from psycopg 2 to 3 (#1318)

* WIP

* Disable _set_wait_callback()

* TransactionStatus.

* First working query.

* More pg3 changes.

* test_pgexecute still fails.

* Fix bytea support.

* Fix json and enum unicode.

* Get unit tests to pass.

* Behave tests still break, WIP.

* Prompt seems to be displayed fine, why don't the tests see the whitespace?

* Python version.

* Fix test.

* Black.

* Added black to dev reqs.

* nbu link for donations.

* Use psycopg.sql to format statement.

* Special case for show help in pgbouncer.

* Fix test.

* Added integration test.

* Install pgbouncer in ci.

* Fix integration test.

* Remove tmate session.

* Revert commenting out python versions.

* Pin pgspecial to >=2.

* Changelog.

Co-authored-by: Daniele Varrazzo <daniele.varrazzo@gmail.com>
Co-authored-by: Amjith Ramanujam <amjith.r@gmail.com>
2022-06-06 11:20:48 -07: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
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
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
898f8255e0 Blacken. 2021-05-07 12:43:32 -07:00
Amjith Ramanujam
c196c28e78 Add tests for search_path function completion. 2021-05-07 12:36:40 -07:00
Amjith Ramanujam
6309dd4f93 Blacken. 2021-05-06 21:20:12 -07: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
ERYoung11
9ca545d880
Fix test_config.py on Windows (#1247)
* fixing test_config.py to work on windows

* Getting rid of odd characters in wrappager.py

* added a space to a comment to try to kick the github workflow.

Co-authored-by: Eric Young <YoungEricR@JohnDeere.com>
2021-02-22 14:40:30 -08:00
Irina Truong
3600566d46
Postgres user has password in ci. (#1243) 2021-02-15 13:07:55 -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
Irina Truong
000102ef9b
Conditional didn't work in CI. (#1237)
* Conditional didn't work in CI.

* Try to fix flaky exit.
2021-01-18 13:50:03 -08:00
Kevin Marsh
34d6e080ff
dependencies: add support for sqlparse 0.4.x (#1224) 2020-12-01 16:03:38 -08:00
laixintao
f985e1bdd8
test: test pgcli on python3.9 (#1214)
* test: test pgcli on python3.9

* test on 3.9

* use 3.9-dev version from travis.

* try to fix pexpect EOF.
2020-10-13 11:47:34 -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
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
赖信涛
b6e2a229e5
upgrade prompt-toolit to 3.0 (#1149)
* upgrade prompt-toolit to 3.0

fix: https://github.com/dbcli/pgcli/issues/1148

related:
https://github.com/prompt-toolkit/python-prompt-toolkit/issues/886

in order to make the `behave` test pass, I have to:

- extend timeout for database connection test.
- extend timeout for basic command expect.
- extend timeout for features/steps/crud_table.py:: see data selected.
- disable cpr for features but "run the cli"

* [ci] disable CPR for all behave tests.

* bugfix: remove duplicated prompt expect.

* [ci] delete CPR env setting.

* Revert "[ci] delete CPR env setting."

This reverts commit fe4d5b565e.

* revert the extending timeout back.

* [ci] test when didn't disable CPR.

* Revert "[ci] test when didn't disable CPR."

This reverts commit d379b1e736.
2020-04-05 20:56:31 -07:00
Georgy Frolov
61c81b05f5 removed py2-related stuff 2020-03-14 10:53:43 +08: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
Martin Matějek
6b2e8df8bd
run black again 2019-10-29 17:47:18 +01:00
Amjith Ramanujam
f658e3d1b4 Add a test to verify error message. 2019-10-23 21:00:45 -07:00
Owen Stephens
a700f2b788 fixup! Take account of table aliases when completing function args (#1048) 2019-10-12 17:11:32 +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
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
7da18ee794 Run black on test files. 2019-06-02 18:53:42 -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
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
Irina Truong
b4fbe28286 Fix for dsn_password behave test. 2019-05-21 20:21:58 -07:00
Amjith Ramanujam
5177c9922e Add a behave test with spaces in password. 2019-05-15 23:40:21 -07:00
Amjith Ramanujam
004f62e714 Add some behavioral tests for command line options. 2019-05-14 00:01:20 -07:00
Amjith Ramanujam
8b14029180 Fix the tests. 2019-05-06 09:12:42 -07:00
Amjith Ramanujam
1908142adb Upgrade to sqlparse 0.3.0. 2019-05-06 09:05:56 -07:00
raylu
eef0e0d65c Allow application_name to be overridden (#1044)
* Allow application_name to be overridden

* Fixed broken link.

* Default password value is empty str?

* Make pep8 happier.
2019-04-27 21:25:19 -06:00
Irina Truong
a8739c8c15 pep8. 2019-03-18 03:10:52 +00:00