From dc1c33563270d68cc62d17634f95231387b5813b Mon Sep 17 00:00:00 2001 From: VVelox Date: Fri, 3 May 2019 04:21:25 -0500 Subject: [PATCH 1/5] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 13c76c020..8ddba1627 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ 'Pygments >= 2.0', # Pygments has to be Capitalcased. WTF? 'prompt_toolkit>=2.0.6,<2.1.0', 'psycopg2 >= 2.7.4,<2.8', - 'sqlparse >=0.2.2,<0.3.0', + 'sqlparse >=0.2.2', 'configobj >= 5.0.6', 'humanize >= 0.5.1', 'cli_helpers[styles] >= 1.2.0', From 881701749128e94a5bc51b2549bc8b9a560fa923 Mon Sep 17 00:00:00 2001 From: VVelox Date: Fri, 3 May 2019 04:22:02 -0500 Subject: [PATCH 2/5] Update AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 63eb2c048..87488d111 100644 --- a/AUTHORS +++ b/AUTHORS @@ -94,6 +94,7 @@ Contributors: * Nathan Verzemnieks * raylu * Zhaolong Zhu + * Zane C. Bowers-Hadley Creator: -------- From 1421da3c336f8ae41d66d1f6989fcc1243f0cd1e Mon Sep 17 00:00:00 2001 From: VVelox Date: Fri, 3 May 2019 04:24:27 -0500 Subject: [PATCH 3/5] Update changelog.rst --- changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.rst b/changelog.rst index cf86b06ee..06c115d5c 100644 --- a/changelog.rst +++ b/changelog.rst @@ -8,6 +8,7 @@ Bug fixes: * Fix for "no attribute KeyringLocked" (#1040). (Thanks: `Irina Truong`_) * Pgcli no longer works with password containing spaces (#1043). (Thanks: `Irina Truong`_) * Load keyring only when keyring is enabled in the config file (#1041). (Thanks: `Zhaolong Zhu`_) +* No longer depend on sqlparse as being less than 0.3.0 with the release of sqlparse 0.3.0. (`VVelox`) 2.1.0 ===== From 1908142adb80f324d6c795e76e38f7939948d7f1 Mon Sep 17 00:00:00 2001 From: Amjith Ramanujam Date: Mon, 6 May 2019 09:05:56 -0700 Subject: [PATCH 4/5] Upgrade to sqlparse 0.3.0. --- pgcli/packages/sqlcompletion.py | 4 ++-- setup.py | 2 +- tests/test_main.py | 2 +- tests/test_sqlcompletion.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pgcli/packages/sqlcompletion.py b/pgcli/packages/sqlcompletion.py index d128fc5a1..8ba282e83 100644 --- a/pgcli/packages/sqlcompletion.py +++ b/pgcli/packages/sqlcompletion.py @@ -154,7 +154,7 @@ def suggest_type(full_text, text_before_cursor): # Be careful here because trivial whitespace is parsed as a # statement, but the statement won't have a first token tok1 = stmt.parsed.token_first() - if tok1 and tok1.value == '\\': + if tok1 and tok1.value.startswith('\\'): text = stmt.text_before_cursor + stmt.word_before_cursor return suggest_special(text) @@ -398,7 +398,7 @@ def suggest_based_on_last_token(token, stmt): elif token_v == 'set': return (Column(table_refs=stmt.get_tables(), local_tables=stmt.local_tables),) - elif token_v in ('select', 'where', 'having', 'by', 'distinct'): + elif token_v in ('select', 'where', 'having', 'order by', 'distinct'): # Check for a table alias or schema qualification parent = (stmt.identifier and stmt.identifier.get_parent_name()) or [] tables = stmt.get_tables() diff --git a/setup.py b/setup.py index 8ddba1627..2cf93f792 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ 'Pygments >= 2.0', # Pygments has to be Capitalcased. WTF? 'prompt_toolkit>=2.0.6,<2.1.0', 'psycopg2 >= 2.7.4,<2.8', - 'sqlparse >=0.2.2', + 'sqlparse >=0.3.0,<0.4', 'configobj >= 5.0.6', 'humanize >= 0.5.1', 'cli_helpers[styles] >= 1.2.0', diff --git a/tests/test_main.py b/tests/test_main.py index e8e801d57..2b5edb7aa 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -317,5 +317,5 @@ def test_application_name_db_uri(tmpdir): mock_pgexecute.return_value = None cli = PGCli(pgclirc_file=str(tmpdir.join("rcfile"))) cli.connect_uri('postgres://bar@baz.com/?application_name=cow') - mock_pgexecute.assert_called_with('bar', 'bar', '', 'baz.com', '', '', + mock_pgexecute.assert_called_with('bar', 'bar', None, 'baz.com', '', '', application_name='cow') diff --git a/tests/test_sqlcompletion.py b/tests/test_sqlcompletion.py index 85fc37896..7e6a82253 100644 --- a/tests/test_sqlcompletion.py +++ b/tests/test_sqlcompletion.py @@ -236,7 +236,7 @@ def test_distinct_suggests_cols(text): ( 'SELECT * FROM tbl x JOIN tbl1 y ORDER BY ', 'SELECT * FROM tbl x JOIN tbl1 y ORDER BY ', - 'BY', + 'ORDER BY', ) ]) def test_distinct_and_order_by_suggestions_with_aliases(text, text_before, From 8b140291802849de924edc3377daa182d81008a5 Mon Sep 17 00:00:00 2001 From: Amjith Ramanujam Date: Mon, 6 May 2019 09:12:42 -0700 Subject: [PATCH 5/5] Fix the tests. --- tests/test_main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_main.py b/tests/test_main.py index 2b5edb7aa..e8e801d57 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -317,5 +317,5 @@ def test_application_name_db_uri(tmpdir): mock_pgexecute.return_value = None cli = PGCli(pgclirc_file=str(tmpdir.join("rcfile"))) cli.connect_uri('postgres://bar@baz.com/?application_name=cow') - mock_pgexecute.assert_called_with('bar', 'bar', None, 'baz.com', '', '', + mock_pgexecute.assert_called_with('bar', 'bar', '', 'baz.com', '', '', application_name='cow')