summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-01-14 14:44:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-01-14 14:44:59 +0000
commit1c022c910ef0924699841e272ebe6e881b37e7f1 (patch)
tree7eabc13771cdc591d3e5d88d88c3bc86a2f0206c
parentReleasing debian version 1.24.1-3. (diff)
downloadmycli-1c022c910ef0924699841e272ebe6e881b37e7f1.tar.xz
mycli-1c022c910ef0924699841e272ebe6e881b37e7f1.zip
Merging upstream version 1.24.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r--changelog.md50
-rw-r--r--mycli/AUTHORS120
-rw-r--r--mycli/__init__.py2
-rw-r--r--mycli/completion_refresher.py2
-rw-r--r--mycli/myclirc4
-rw-r--r--mycli/packages/parseutils.py7
-rw-r--r--mycli/packages/special/dbcommands.py36
-rw-r--r--requirements-dev.txt1
-rwxr-xr-xsetup.py4
-rw-r--r--test/test_completion_engine.py11
-rw-r--r--test/test_completion_refresher.py2
-rw-r--r--test/test_naive_completion.py2
-rw-r--r--test/test_smart_completion_public_schema_only.py4
-rw-r--r--test/test_special_iocommands.py2
14 files changed, 138 insertions, 109 deletions
diff --git a/changelog.md b/changelog.md
index 95e594f..ad870c0 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,7 +1,11 @@
-TBD:
-====
+1.24.2 (2022/01/11)
+===================
-*
+Bug Fixes:
+----------
+* Fix autocompletion for more than one JOIN
+* Fix the status command when connected to TiDB or other servers that don't implement 'Threads\_connected'
+* Pin pygments version to avoid a breaking change
1.24.1:
=======
@@ -10,6 +14,10 @@ Bug Fixes:
---------
* Restore dependency on cryptography for the interactive password prompt
+Internal:
+---------
+* Deprecate Python mock
+
1.24.0
======
@@ -41,7 +49,7 @@ Internal:
Bug Fixes:
----------
* Ensure `--port` is always an int.
-
+
1.23.1
======
@@ -834,31 +842,31 @@ Bug Fixes:
----------
* Fixed the installation issues with PyMySQL dependency on case-sensitive file systems.
-[Daniel West]: http://github.com/danieljwest
-[Irina Truong]: https://github.com/j-bennet
[Amjith Ramanujam]: https://blog.amjith.com
-[Kacper Kwapisz]: https://github.com/KKKas
-[Martijn Engler]: https://github.com/martijnengler
-[Matheus Rosa]: https://github.com/mdsrosa
-[Shoma Suzuki]: https://github.com/shoma
-[spacewander]: https://github.com/spacewander
-[Thomas Roten]: https://github.com/tsroten
[Artem Bezsmertnyi]: https://github.com/mrdeathless
-[Mikhail Borisov]: https://github.com/borman
-[Casper Langemeijer]: Casper Langemeijer
-[Lennart Weller]: https://github.com/lhw
-[Phil Cohen]: https://github.com/phlipper
-[Terseus]: https://github.com/Terseus
-[William GARCIA]: https://github.com/willgarcia
-[Jonathan Slenders]: https://github.com/jonathanslenders
+[Carlos Afonso]: https://github.com/afonsocarlos
[Casper Langemeijer]: https://github.com/langemeijer
-[Scrappy Soft]: https://github.com/scrappysoft
+[Daniel West]: http://github.com/danieljwest
[Dick Marinus]: https://github.com/meeuw
[François Pietka]: https://github.com/fpietka
[Frederic Aoustin]: https://github.com/fraoustin
[Georgy Frolov]: https://github.com/pasenor
-[Zach DeCook]: https://zachdecook.com
+[Irina Truong]: https://github.com/j-bennet
+[Jonathan Slenders]: https://github.com/jonathanslenders
+[Kacper Kwapisz]: https://github.com/KKKas
[laixintao]: https://github.com/laixintao
+[Lennart Weller]: https://github.com/lhw
+[Martijn Engler]: https://github.com/martijnengler
+[Matheus Rosa]: https://github.com/mdsrosa
+[Mikhail Borisov]: https://github.com/borman
[mtorromeo]: https://github.com/mtorromeo
[mwcm]: https://github.com/mwcm
+[Phil Cohen]: https://github.com/phlipper
+[Scrappy Soft]: https://github.com/scrappysoft
+[Shoma Suzuki]: https://github.com/shoma
+[spacewander]: https://github.com/spacewander
+[Terseus]: https://github.com/Terseus
+[Thomas Roten]: https://github.com/tsroten
+[William GARCIA]: https://github.com/willgarcia
[xeron]: https://github.com/xeron
+[Zach DeCook]: https://zachdecook.com
diff --git a/mycli/AUTHORS b/mycli/AUTHORS
index 8cdea91..308e962 100644
--- a/mycli/AUTHORS
+++ b/mycli/AUTHORS
@@ -15,78 +15,80 @@ Core Developers:
Contributors:
-------------
- * Steve Robbins
- * Shoma Suzuki
- * Daniel West
- * Scrappy Soft
- * Daniel Black
- * Jonathan Bruno
- * Casper Langemeijer
- * Jonathan Slenders
+ * 0xflotus
+ * Abirami P
+ * Adam Chainz
+ * Aljosha Papsch
+ * Andy Teijelo Pérez
+ * Angelo Lupo
* Artem Bezsmertnyi
- * Mikhail Borisov
+ * bitkeen
+ * bjarnagin
+ * caitinggui
+ * Carlos Afonso
+ * Casper Langemeijer
+ * chainkite
+ * Colin Caine
+ * cxbig
+ * Daniel Black
+ * Daniel West
+ * Daniël van Eeden
+ * François Pietka
+ * Frederic Aoustin
+ * Georgy Frolov
* Heath Naylor
- * Phil Cohen
- * spacewander
- * Adam Chainz
+ * Huachao Mao
+ * Jakub Boukal
+ * jbruno
+ * Jerome Provensal
+ * Jialong Liu
* Johannes Hoff
+ * John Sterling
+ * Jonathan Bruno
+ * Jonathan Lloyd
+ * Jonathan Slenders
* Kacper Kwapisz
+ * Karthikeyan Singaravelan
+ * kevinhwang91
+ * KITAGAWA Yasutaka
+ * Klaus Wünschel
+ * laixintao
* Lennart Weller
* Martijn Engler
+ * Massimiliano Torromeo
+ * Michał Górny
+ * Mike Palandra
+ * Mikhail Borisov
+ * Morgan Mitchell
+ * mrdeathless
+ * Nathan Huang
+ * Nicolas Palumbo
+ * Phil Cohen
+ * QiaoHou Peng
+ * Roland Walker
+ * Ryan Smith
+ * Scrappy Soft
+ * Seamile
+ * Shoma Suzuki
+ * spacewander
+ * Steve Robbins
+ * Takeshi D. Itoh
+ * Terje Røsten
* Terseus
* Tyler Kuipers
+ * ushuz
* William GARCIA
+ * xeron
+ * Yang Zou
* Yasuhiro Matsumoto
- * bjarnagin
- * jbruno
- * mrdeathless
- * Abirami P
- * John Sterling
- * Jialong Liu
- * Zhidong
- * Daniël van Eeden
+ * Zach DeCook
+ * Zane C. Bowers-Hadley
* zer09
- * cxbig
- * chainkite
- * Michał Górny
- * Terje Røsten
- * Ryan Smith
- * Klaus Wünschel
- * François Pietka
- * Colin Caine
- * Frederic Aoustin
- * caitinggui
- * ushuz
* Zhaolong Zhu
+ * Zhidong
* Zhongyang Guan
- * Huachao Mao
- * QiaoHou Peng
- * Yang Zou
- * Angelo Lupo
- * Aljosha Papsch
- * Zane C. Bowers-Hadley
- * Mike Palandra
- * Georgy Frolov
- * Jonathan Lloyd
- * Nathan Huang
- * Jakub Boukal
- * Takeshi D. Itoh
- * laixintao
- * Zach DeCook
- * kevinhwang91
- * KITAGAWA Yasutaka
- * Nicolas Palumbo
- * Andy Teijelo Pérez
- * bitkeen
- * Morgan Mitchell
- * Massimiliano Torromeo
- * Roland Walker
- * xeron
- * 0xflotus
- * Seamile
- * Jerome Provensal
-Creator:
---------
+Created by:
+-----------
Amjith Ramanujam
diff --git a/mycli/__init__.py b/mycli/__init__.py
index 785c3b8..b27b4ed 100644
--- a/mycli/__init__.py
+++ b/mycli/__init__.py
@@ -1 +1 @@
-__version__ = '1.24.1'
+__version__ = '1.24.2'
diff --git a/mycli/completion_refresher.py b/mycli/completion_refresher.py
index e6c8dd0..124068a 100644
--- a/mycli/completion_refresher.py
+++ b/mycli/completion_refresher.py
@@ -36,7 +36,7 @@ class CompletionRefresher(object):
target=self._bg_refresh,
args=(executor, callbacks, completer_options),
name='completion_refresh')
- self._completer_thread.setDaemon(True)
+ self._completer_thread.daemon = True
self._completer_thread.start()
return [(None, None, None,
'Auto-completion refresh started in the background.')]
diff --git a/mycli/myclirc b/mycli/myclirc
index 0bde200..c89caa0 100644
--- a/mycli/myclirc
+++ b/mycli/myclirc
@@ -60,8 +60,8 @@ wider_completion_menu = False
# \n - Newline
# \P - AM/PM
# \p - Port
-# \R - The current time, in 24-hour military time (0–23)
-# \r - The current time, standard 12-hour time (1–12)
+# \R - The current time, in 24-hour military time (0-23)
+# \r - The current time, standard 12-hour time (1-12)
# \s - Seconds of the current time
# \t - Product type (Percona, MySQL, MariaDB)
# \A - DSN alias name (from the [alias_dsn] section)
diff --git a/mycli/packages/parseutils.py b/mycli/packages/parseutils.py
index fa5f2c9..d47f59a 100644
--- a/mycli/packages/parseutils.py
+++ b/mycli/packages/parseutils.py
@@ -81,6 +81,13 @@ def extract_from_part(parsed, stop_at_punctuation=True):
yield x
elif stop_at_punctuation and item.ttype is Punctuation:
return
+ # Multiple JOINs in the same query won't work properly since
+ # "ON" is a keyword and will trigger the next elif condition.
+ # So instead of stooping the loop when finding an "ON" skip it
+ # eg: 'SELECT * FROM abc JOIN def ON abc.id = def.abc_id JOIN ghi'
+ elif item.ttype is Keyword and item.value.upper() == 'ON':
+ tbl_prefix_seen = False
+ continue
# An incomplete nested select won't be recognized correctly as a
# sub-select. eg: 'SELECT * FROM (SELECT id FROM user'. This causes
# the second FROM to trigger this elif condition resulting in a
diff --git a/mycli/packages/special/dbcommands.py b/mycli/packages/special/dbcommands.py
index ed90e4c..45d7069 100644
--- a/mycli/packages/special/dbcommands.py
+++ b/mycli/packages/special/dbcommands.py
@@ -135,23 +135,25 @@ def status(cur, **_):
else:
output.append(('UNIX socket:', variables['socket']))
- output.append(('Uptime:', format_uptime(status['Uptime'])))
-
- # Print the current server statistics.
- stats = []
- stats.append('Connections: {0}'.format(status['Threads_connected']))
- if 'Queries' in status:
- stats.append('Queries: {0}'.format(status['Queries']))
- stats.append('Slow queries: {0}'.format(status['Slow_queries']))
- stats.append('Opens: {0}'.format(status['Opened_tables']))
- stats.append('Flush tables: {0}'.format(status['Flush_commands']))
- stats.append('Open tables: {0}'.format(status['Open_tables']))
- if 'Queries' in status:
- queries_per_second = int(status['Queries']) / int(status['Uptime'])
- stats.append('Queries per second avg: {:.3f}'.format(
- queries_per_second))
- stats = ' '.join(stats)
- footer.append('\n' + stats)
+ if 'Uptime' in status:
+ output.append(('Uptime:', format_uptime(status['Uptime'])))
+
+ if 'Threads_connected' in status:
+ # Print the current server statistics.
+ stats = []
+ stats.append('Connections: {0}'.format(status['Threads_connected']))
+ if 'Queries' in status:
+ stats.append('Queries: {0}'.format(status['Queries']))
+ stats.append('Slow queries: {0}'.format(status['Slow_queries']))
+ stats.append('Opens: {0}'.format(status['Opened_tables']))
+ stats.append('Flush tables: {0}'.format(status['Flush_commands']))
+ stats.append('Open tables: {0}'.format(status['Open_tables']))
+ if 'Queries' in status:
+ queries_per_second = int(status['Queries']) / int(status['Uptime'])
+ stats.append('Queries per second avg: {:.3f}'.format(
+ queries_per_second))
+ stats = ' '.join(stats)
+ footer.append('\n' + stats)
footer.append('--------------')
return [('\n'.join(title), output, '', '\n'.join(footer))]
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 7a38ed5..9c40316 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,4 +1,3 @@
-mock
pytest!=3.3.0
pytest-cov==2.4.0
tox
diff --git a/setup.py b/setup.py
index 1d619f3..abcf52b 100755
--- a/setup.py
+++ b/setup.py
@@ -19,10 +19,10 @@ description = 'CLI for MySQL Database. With auto-completion and syntax highlight
install_requirements = [
'click >= 7.0',
'cryptography >= 1.0.0',
- 'Pygments >= 1.6',
+ 'Pygments>=1.6,<=2.11.1',
'prompt_toolkit>=3.0.6,<4.0.0',
'PyMySQL >= 0.9.2',
- 'sqlparse>=0.3.0,<0.4.0',
+ 'sqlparse>=0.3.0,<0.5.0',
'configobj >= 5.0.5',
'cli_helpers[styles] >= 2.0.1',
'pyperclip >= 1.8.1',
diff --git a/test/test_completion_engine.py b/test/test_completion_engine.py
index 9e7c608..8b06ed3 100644
--- a/test/test_completion_engine.py
+++ b/test/test_completion_engine.py
@@ -393,6 +393,17 @@ def test_join_using_suggests_common_columns(col_list):
'tables': [(None, 'abc', None), (None, 'def', None)],
'drop_unique': True}]
+@pytest.mark.parametrize('sql', [
+ 'SELECT * FROM abc a JOIN def d ON a.id = d.id JOIN ghi g ON g.',
+ 'SELECT * FROM abc a JOIN def d ON a.id = d.id AND a.id2 = d.id2 JOIN ghi g ON d.id = g.id AND g.',
+])
+def test_two_join_alias_dot_suggests_cols1(sql):
+ suggestions = suggest_type(sql, sql)
+ assert sorted_dicts(suggestions) == sorted_dicts([
+ {'type': 'column', 'tables': [(None, 'ghi', 'g')]},
+ {'type': 'table', 'schema': 'g'},
+ {'type': 'view', 'schema': 'g'},
+ {'type': 'function', 'schema': 'g'}])
def test_2_statements_2nd_current():
suggestions = suggest_type('select * from a; select * from ',
diff --git a/test/test_completion_refresher.py b/test/test_completion_refresher.py
index 1ed6377..cdc2fb5 100644
--- a/test/test_completion_refresher.py
+++ b/test/test_completion_refresher.py
@@ -1,6 +1,6 @@
import time
import pytest
-from mock import Mock, patch
+from unittest.mock import Mock, patch
@pytest.fixture
diff --git a/test/test_naive_completion.py b/test/test_naive_completion.py
index 14c1bf5..32b2abd 100644
--- a/test/test_naive_completion.py
+++ b/test/test_naive_completion.py
@@ -11,7 +11,7 @@ def completer():
@pytest.fixture
def complete_event():
- from mock import Mock
+ from unittest.mock import Mock
return Mock()
diff --git a/test/test_smart_completion_public_schema_only.py b/test/test_smart_completion_public_schema_only.py
index b66c696..e7d460a 100644
--- a/test/test_smart_completion_public_schema_only.py
+++ b/test/test_smart_completion_public_schema_only.py
@@ -1,5 +1,5 @@
import pytest
-from mock import patch
+from unittest.mock import patch
from prompt_toolkit.completion import Completion
from prompt_toolkit.document import Document
import mycli.packages.special.main as special
@@ -35,7 +35,7 @@ def completer():
@pytest.fixture
def complete_event():
- from mock import Mock
+ from unittest.mock import Mock
return Mock()
diff --git a/test/test_special_iocommands.py b/test/test_special_iocommands.py
index 73bfbab..8b6be33 100644
--- a/test/test_special_iocommands.py
+++ b/test/test_special_iocommands.py
@@ -2,7 +2,7 @@ import os
import stat
import tempfile
from time import time
-from mock import patch
+from unittest.mock import patch
import pytest
from pymysql import ProgrammingError