From c89e69ae47c46fda761794d4e986fa694ab56ea1 Mon Sep 17 00:00:00 2001 From: Massimiliano Torromeo Date: Thu, 8 Oct 2020 10:00:07 +0200 Subject: [PATCH] Remove unnecessary use of python 2 compat type Since python 2 compat has been removed and sqlparse 0.4 also doesn't ship with the compat module anymore, there is no reason to use the text_type alias for str/unicode. --- changelog.md | 7 ++++++- mycli/AUTHORS | 1 + mycli/packages/completion_engine.py | 3 +-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 1a4ae2c0..508c8013 100644 --- a/changelog.md +++ b/changelog.md @@ -6,13 +6,17 @@ Features: * Add an option `--init-command` to execute SQL after connecting (Thanks: [KITAGAWA Yasutaka]). +Bug Fixes: +---------- +* Fixed compatibility with sqlparse 0.4 (Thanks: [mtorromeo]). + 1.22.2 ====== Bug Fixes: ---------- -* Make the `pwd` module optional. +* Make the `pwd` module optional. 1.22.1 ====== @@ -785,3 +789,4 @@ Bug Fixes: [Georgy Frolov]: https://github.com/pasenor [Zach DeCook]: https://zachdecook.com [laixintao]: https://github.com/laixintao +[mtorromeo]: https://github.com/mtorromeo diff --git a/mycli/AUTHORS b/mycli/AUTHORS index c50a15cd..a1204b02 100644 --- a/mycli/AUTHORS +++ b/mycli/AUTHORS @@ -75,6 +75,7 @@ Contributors: * Zach DeCook * kevinhwang91 * KITAGAWA Yasutaka + * Massimiliano Torromeo Creator: -------- diff --git a/mycli/packages/completion_engine.py b/mycli/packages/completion_engine.py index 2b19c32d..3cff2ccc 100644 --- a/mycli/packages/completion_engine.py +++ b/mycli/packages/completion_engine.py @@ -2,7 +2,6 @@ import sys import sqlparse from sqlparse.sql import Comparison, Identifier, Where -from sqlparse.compat import text_type from .parseutils import last_word, extract_tables, find_prev_keyword from .special import parse_special_command @@ -55,7 +54,7 @@ def suggest_type(full_text, text_before_cursor): stmt_start, stmt_end = 0, 0 for statement in parsed: - stmt_len = len(text_type(statement)) + stmt_len = len(str(statement)) stmt_start, stmt_end = stmt_end, stmt_end + stmt_len if stmt_end >= current_pos: