1
0
Fork 0

Merging upstream version 1.24.2.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-09 18:59:41 +01:00
parent 5df7a54f6d
commit 4523ea515c
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
14 changed files with 141 additions and 112 deletions

View file

@ -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: 1.24.1:
======= =======
@ -10,6 +14,10 @@ Bug Fixes:
--------- ---------
* Restore dependency on cryptography for the interactive password prompt * Restore dependency on cryptography for the interactive password prompt
Internal:
---------
* Deprecate Python mock
1.24.0 1.24.0
====== ======
@ -834,31 +842,31 @@ Bug Fixes:
---------- ----------
* Fixed the installation issues with PyMySQL dependency on case-sensitive file systems. * 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 [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 [Artem Bezsmertnyi]: https://github.com/mrdeathless
[Mikhail Borisov]: https://github.com/borman [Carlos Afonso]: https://github.com/afonsocarlos
[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
[Casper Langemeijer]: https://github.com/langemeijer [Casper Langemeijer]: https://github.com/langemeijer
[Scrappy Soft]: https://github.com/scrappysoft [Daniel West]: http://github.com/danieljwest
[Dick Marinus]: https://github.com/meeuw [Dick Marinus]: https://github.com/meeuw
[François Pietka]: https://github.com/fpietka [François Pietka]: https://github.com/fpietka
[Frederic Aoustin]: https://github.com/fraoustin [Frederic Aoustin]: https://github.com/fraoustin
[Georgy Frolov]: https://github.com/pasenor [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 [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 [mtorromeo]: https://github.com/mtorromeo
[mwcm]: https://github.com/mwcm [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 [xeron]: https://github.com/xeron
[Zach DeCook]: https://zachdecook.com

View file

@ -15,78 +15,80 @@ Core Developers:
Contributors: Contributors:
------------- -------------
* Steve Robbins * 0xflotus
* Shoma Suzuki
* Daniel West
* Scrappy Soft
* Daniel Black
* Jonathan Bruno
* Casper Langemeijer
* Jonathan Slenders
* Artem Bezsmertnyi
* Mikhail Borisov
* Heath Naylor
* Phil Cohen
* spacewander
* Adam Chainz
* Johannes Hoff
* Kacper Kwapisz
* Lennart Weller
* Martijn Engler
* Terseus
* Tyler Kuipers
* William GARCIA
* Yasuhiro Matsumoto
* bjarnagin
* jbruno
* mrdeathless
* Abirami P * Abirami P
* John Sterling * Adam Chainz
* Jialong Liu
* Zhidong
* Daniël van Eeden
* 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
* Zhongyang Guan
* Huachao Mao
* QiaoHou Peng
* Yang Zou
* Angelo Lupo
* Aljosha Papsch * Aljosha Papsch
* Zane C. Bowers-Hadley * Andy Teijelo Pérez
* Mike Palandra * Angelo Lupo
* Artem Bezsmertnyi
* 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 * Georgy Frolov
* Jonathan Lloyd * Heath Naylor
* Nathan Huang * Huachao Mao
* Jakub Boukal * Jakub Boukal
* Takeshi D. Itoh * jbruno
* laixintao * Jerome Provensal
* Zach DeCook * Jialong Liu
* Johannes Hoff
* John Sterling
* Jonathan Bruno
* Jonathan Lloyd
* Jonathan Slenders
* Kacper Kwapisz
* Karthikeyan Singaravelan
* kevinhwang91 * kevinhwang91
* KITAGAWA Yasutaka * KITAGAWA Yasutaka
* Nicolas Palumbo * Klaus Wünschel
* Andy Teijelo Pérez * laixintao
* bitkeen * Lennart Weller
* Morgan Mitchell * Martijn Engler
* Massimiliano Torromeo * Massimiliano Torromeo
* Michał Górny
* Mike Palandra
* Mikhail Borisov
* Morgan Mitchell
* mrdeathless
* Nathan Huang
* Nicolas Palumbo
* Phil Cohen
* QiaoHou Peng
* Roland Walker * Roland Walker
* xeron * Ryan Smith
* 0xflotus * Scrappy Soft
* Seamile * Seamile
* Jerome Provensal * Shoma Suzuki
* spacewander
* Steve Robbins
* Takeshi D. Itoh
* Terje Røsten
* Terseus
* Tyler Kuipers
* ushuz
* William GARCIA
* xeron
* Yang Zou
* Yasuhiro Matsumoto
* Zach DeCook
* Zane C. Bowers-Hadley
* zer09
* Zhaolong Zhu
* Zhidong
* Zhongyang Guan
Creator: Created by:
-------- -----------
Amjith Ramanujam Amjith Ramanujam

View file

@ -1 +1 @@
__version__ = '1.24.1' __version__ = '1.24.2'

View file

@ -36,7 +36,7 @@ class CompletionRefresher(object):
target=self._bg_refresh, target=self._bg_refresh,
args=(executor, callbacks, completer_options), args=(executor, callbacks, completer_options),
name='completion_refresh') name='completion_refresh')
self._completer_thread.setDaemon(True) self._completer_thread.daemon = True
self._completer_thread.start() self._completer_thread.start()
return [(None, None, None, return [(None, None, None,
'Auto-completion refresh started in the background.')] 'Auto-completion refresh started in the background.')]

View file

@ -60,8 +60,8 @@ wider_completion_menu = False
# \n - Newline # \n - Newline
# \P - AM/PM # \P - AM/PM
# \p - Port # \p - Port
# \R - The current time, in 24-hour military time (023) # \R - The current time, in 24-hour military time (0-23)
# \r - The current time, standard 12-hour time (112) # \r - The current time, standard 12-hour time (1-12)
# \s - Seconds of the current time # \s - Seconds of the current time
# \t - Product type (Percona, MySQL, MariaDB) # \t - Product type (Percona, MySQL, MariaDB)
# \A - DSN alias name (from the [alias_dsn] section) # \A - DSN alias name (from the [alias_dsn] section)

View file

@ -81,6 +81,13 @@ def extract_from_part(parsed, stop_at_punctuation=True):
yield x yield x
elif stop_at_punctuation and item.ttype is Punctuation: elif stop_at_punctuation and item.ttype is Punctuation:
return 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 # An incomplete nested select won't be recognized correctly as a
# sub-select. eg: 'SELECT * FROM (SELECT id FROM user'. This causes # sub-select. eg: 'SELECT * FROM (SELECT id FROM user'. This causes
# the second FROM to trigger this elif condition resulting in a # the second FROM to trigger this elif condition resulting in a

View file

@ -135,8 +135,10 @@ def status(cur, **_):
else: else:
output.append(('UNIX socket:', variables['socket'])) output.append(('UNIX socket:', variables['socket']))
if 'Uptime' in status:
output.append(('Uptime:', format_uptime(status['Uptime']))) output.append(('Uptime:', format_uptime(status['Uptime'])))
if 'Threads_connected' in status:
# Print the current server statistics. # Print the current server statistics.
stats = [] stats = []
stats.append('Connections: {0}'.format(status['Threads_connected'])) stats.append('Connections: {0}'.format(status['Threads_connected']))

View file

@ -1,4 +1,3 @@
mock
pytest!=3.3.0 pytest!=3.3.0
pytest-cov==2.4.0 pytest-cov==2.4.0
tox tox

View file

@ -19,10 +19,10 @@ description = 'CLI for MySQL Database. With auto-completion and syntax highlight
install_requirements = [ install_requirements = [
'click >= 7.0', 'click >= 7.0',
'cryptography >= 1.0.0', 'cryptography >= 1.0.0',
'Pygments >= 1.6', 'Pygments>=1.6,<=2.11.1',
'prompt_toolkit>=3.0.6,<4.0.0', 'prompt_toolkit>=3.0.6,<4.0.0',
'PyMySQL >= 0.9.2', 'PyMySQL >= 0.9.2',
'sqlparse>=0.3.0,<0.4.0', 'sqlparse>=0.3.0,<0.5.0',
'configobj >= 5.0.5', 'configobj >= 5.0.5',
'cli_helpers[styles] >= 2.0.1', 'cli_helpers[styles] >= 2.0.1',
'pyperclip >= 1.8.1', 'pyperclip >= 1.8.1',

View file

@ -393,6 +393,17 @@ def test_join_using_suggests_common_columns(col_list):
'tables': [(None, 'abc', None), (None, 'def', None)], 'tables': [(None, 'abc', None), (None, 'def', None)],
'drop_unique': True}] '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(): def test_2_statements_2nd_current():
suggestions = suggest_type('select * from a; select * from ', suggestions = suggest_type('select * from a; select * from ',

View file

@ -1,6 +1,6 @@
import time import time
import pytest import pytest
from mock import Mock, patch from unittest.mock import Mock, patch
@pytest.fixture @pytest.fixture

View file

@ -11,7 +11,7 @@ def completer():
@pytest.fixture @pytest.fixture
def complete_event(): def complete_event():
from mock import Mock from unittest.mock import Mock
return Mock() return Mock()

View file

@ -1,5 +1,5 @@
import pytest import pytest
from mock import patch from unittest.mock import patch
from prompt_toolkit.completion import Completion from prompt_toolkit.completion import Completion
from prompt_toolkit.document import Document from prompt_toolkit.document import Document
import mycli.packages.special.main as special import mycli.packages.special.main as special
@ -35,7 +35,7 @@ def completer():
@pytest.fixture @pytest.fixture
def complete_event(): def complete_event():
from mock import Mock from unittest.mock import Mock
return Mock() return Mock()

View file

@ -2,7 +2,7 @@ import os
import stat import stat
import tempfile import tempfile
from time import time from time import time
from mock import patch from unittest.mock import patch
import pytest import pytest
from pymysql import ProgrammingError from pymysql import ProgrammingError