From 014d251a16853cf0cddf22918850da16be198a8f Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 4 Jun 2018 23:01:22 -0700 Subject: [PATCH] [cli] add an quit/exit/bye commands --- README.md | 9 +++++++++ pydruid/console.py | 2 ++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 9fd78253..396833ab 100644 --- a/README.md +++ b/README.md @@ -236,4 +236,13 @@ $ pydruid http://localhost:8082/druid/v2/sql/ cnt ----- 12345 +> SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES; +TABLE_NAME +---------- +test_table +COLUMNS +SCHEMATA +TABLES +> BYE; +GoodBye! ``` diff --git a/pydruid/console.py b/pydruid/console.py index f91bd1ba..35dece09 100644 --- a/pydruid/console.py +++ b/pydruid/console.py @@ -183,6 +183,8 @@ def main(): query = query.strip('; ') if query: # shortcuts + if query.lower() in ('bye', 'exit', 'quit'): + break for pattern, repl in replacements.items(): query = re.sub(pattern, repl, query)