用python3编写的sqlite repl

sqliterepl的Python项目详细描述


用python3编写的sqlite repl

良好完成

usage: SQLiteREPL [-h] [-H [PATH]] [-e [FILE]] [-m] [-v] [-M]
                  [--no-history-search] [--no-complete-while-typing]
                  [--no-infobar] [--no-editor] [-t STYLE] [-s STYLE]
                  [-p STRING]
                  [database]

A dead simple REPL for SQLite

positional arguments:
  database              path to database

optional arguments:
  -h, --help            show this help message and exit
  -H [PATH], --history [PATH]
                        path to history file
  -e [FILE], --eval [FILE]
                        eval SQL script before running the REPL
  -m, --multiline       enable multiline mode (useful for creating tables)
  -v, --verbose         enable verbose logging
  -M, --memory          in memory database
  --no-history-search   disable history search
  --no-complete-while-typing
                        disable completion while typing
  --no-infobar          disable info bar at the bottom of the screen
  --no-editor           disable opening in $EDITOR
  -t STYLE, --table_style STYLE
                        set table style to <STYLE>, (see
                        https://pypi.org/project/tabulate/) (hint: try
                        "simple", "orgtbl", "pipe", "html" or "latex")
  -s STYLE, --style STYLE
                        pygments style (see
                        http://pygments.org/docs/styles/#builtin-styles)
  -p STRING, --prompt STRING
                        prompt string

在REPL运行时修改它

支持以下.meta命令:

   .dump [FILE]            Stringify database into SQL commands or STDOUT if FILE is not provided.
  .exit                   Exit the REPL.
  .help [PATTERN]         Display meta commands matching PATTERN or ALL if PATTERN is not provided.
  .mode [STYLE]           Change table style to STYLE or display current style if STYLE is not provided.
  .open [DATABASE]        Close this database and open DATABASE or show current database if DATABASE is not provided.
.output [FILE]            Redirect output of commands to FILE (or to STDOUT if FILE == "stdout"), shows current output stream if FILE is not provided.
 .print [STRING, ...]     Display given STRING in the terminal.
.prompt [STRING]          Change prompt to STRING.
  .quit                   Exit the REPL.
  .read [FILE]            Eval SQL from FILE.
  .save <FILE>            Save in-memory database to FILE.
.schema [PATTERN]         Show schemas for tables in the database matching PATTERN.
 .shell <CMD> [ARG, ...]  Run an OS command CMD.
  .show [PATTERN]         Display info about the REPL starting with PATTERN or all info if PATTERN is not provided.
 .style [STYLE]           Change style to STYLE or show current style if STYLE is not provided.
.system <CMD> [ARG, ...]  Run an OS command CMD with ARGS.
.tables [PATTERN]         Show tables in the database matching PATTERN or show all tables if PATTERN is not provided.

注释

这些实际上是官方sqlite3 repl支持的一个子集。语法保持相似。

注释

除非用database指定数据库位置,否则 载入内存。

定制

  • 查看pygments以了解所有可能的样式
  • 查看所有表格类型的表格
  • 为“半永久”配置使用别名,例如:alias sqlite='sqliterepl --multiline'

兼容性

它应该可以在win10和linux上运行。

安装

$ pip install --user sqliterepl

注释
确保~/.local/bin(gnu/linux)或~\AppData\Roaming\Python\Python<VERSION>\Scripts(win10)目录位于$PATH

运行

$ sqliterepl

限制

  • 不区分上下文
  • 不填写表名
  • 没有表格标题

依赖关系

注释

sqliterepl已更新为使用prompt_toolkit 2

相关

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
显示图像的RGB编号的java   java JavaFX画布2D游戏:背景变换vs.绘画   在到达maxElementsInMemory之前创建的java DiskMarker   a4j:ajax可用事件的java详尽列表?   java从批处理文件运行jar文件,如果出现错误,则显示meessage   音频Java在背景音乐之上播放声音   用于在FTP中上载文件的java更改目录   尽管设置了必要的属性,java列表项仍不会保持选中状态   java Stanford Core NLP解析与CSV   java使用缓冲区合并热态和冷态   java无法初始化类javax。加密。JCE安全   对这个Java循环如此困惑的输入   java Spring RabbitMQ SimpleRabbitListenerContainerFactory用法   java如何使用jGrowl创建JSF消息   安装jRebel插件后,Netbeans项目中的java源文件夹不可见?   如何在Java中解析复杂的json字符串   java Spark KafkaUtils CreateRDD在键上应用过滤器   try块中的java代码被忽略,为什么?