diff options
author | Jonathan Slenders <jonathan@slenders.be> | 2018-05-24 22:26:59 +0200 |
---|---|---|
committer | Jonathan Slenders <jonathan@slenders.be> | 2018-05-24 22:30:48 +0200 |
commit | 24512aac081d1e30ad52805606b42411f1aed861 (patch) | |
tree | 7335c2b855da62ec8e0a65147e12d344fe61da2e /examples/tutorial/sqlite-cli.py | |
parent | 1d3991df3305ee20534326efdd433e021650c642 (diff) |
Updated SQLite tutorial with new images and small improvements.
Diffstat (limited to 'examples/tutorial/sqlite-cli.py')
-rwxr-xr-x | examples/tutorial/sqlite-cli.py | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/examples/tutorial/sqlite-cli.py b/examples/tutorial/sqlite-cli.py index da9abda9..04cf259e 100755 --- a/examples/tutorial/sqlite-cli.py +++ b/examples/tutorial/sqlite-cli.py @@ -1,25 +1,42 @@ #!/usr/bin/env python -from __future__ import unicode_literals +from __future__ import unicode_literals, print_function import sys import sqlite3 from prompt_toolkit import PromptSession from prompt_toolkit.completion import WordCompleter -from prompt_toolkit.styles import Style from prompt_toolkit.lexers import PygmentsLexer - +from prompt_toolkit.styles import Style from pygments.lexers import SqlLexer -sql_completer = WordCompleter( - ['create', 'select', 'insert', 'drop', 'delete', 'from', 'where', 'table'], - ignore_case=True) +sql_completer = WordCompleter([ + 'abort', 'action', 'add', 'after', 'all', 'alter', 'analyze', 'and', + 'as', 'asc', 'attach', 'autoincrement', 'before', 'begin', 'between', + 'by', 'cascade', 'case', 'cast', 'check', 'collate', 'column', + 'commit', 'conflict', 'constraint', 'create', 'cross', 'current_date', + 'current_time', 'current_timestamp', 'database', 'default', + 'deferrable', 'deferred', 'delete', 'desc', 'detach', 'distinct', + 'drop', 'each', 'else', 'end', 'escape', 'except', 'exclusive', + 'exists', 'explain', 'fail', 'for', 'foreign', 'from', 'full', 'glob', + 'group', 'having', 'if', 'ignore', 'immediate', 'in', 'index', + 'indexed', 'initially', 'inner', 'insert', 'instead', 'intersect', + 'into', 'is', 'isnull', 'join', 'key', 'left', 'like', 'limit', + 'match', 'natural', 'no', 'not', 'notnull', 'null', 'of', 'offset', + 'on', 'or', 'order', 'outer', 'plan', 'pragma', 'primary', 'query', + 'raise', 'recursive', 'references', 'regexp', 'reindex', 'release', + 'rename', 'replace', 'restrict', 'right', 'rollback', 'row', + 'savepoint', 'select', 'set', 'table', 'temp', 'temporary', 'then', + 'to', 'transaction', 'trigger', 'union', 'unique', 'update', 'using', + 'vacuum', 'values', 'view', 'virtual', 'when', 'where', 'with', + 'without'], ignore_case=True) style = Style.from_dict({ - 'completion-menu.current-completion': 'bg:#00aaaa #000000', 'completion-menu.completion': 'bg:#008888 #ffffff', + 'completion-menu.completion.current': 'bg:#00aaaa #000000', + 'scrollbar.background': 'bg:#88aaaa', + 'scrollbar.button': 'bg:#222222', }) - def main(database): connection = sqlite3.connect(database) session = PromptSession( @@ -41,8 +58,8 @@ def main(database): else: for message in messages: print(message) - print('GoodBye!') + print('GoodBye!') if __name__ == '__main__': if len(sys.argv) < 2: |