Skip to content
Snippets Groups Projects
  • Dmitry Rodionov's avatar
    faca599c
    SQL REPL PoC in rust without Lua · faca599c
    Dmitry Rodionov authored
    This patch adds new command `picodata sql`. Arguments are the same as `picodata connect`. The idea would be to eventually replace picodata connect with this version.
    
    Simple prerequisites for testing with auth:
    
    ```lua
    pico.create_user("Yoda", "12341234")
    pico.grant_privilege("Yoda", "execute", "role", "super")
    ```
    Super grant wont be needed in the future when access control will be tuned properly (access to system spaces, context: https://git.picodata.io/picodata/picodata/picodata/-/merge_requests/663).
    
    Then run `target/debug/picodata run` in one terminal and `target/debug/picodata sql Yoda@localhost:3301` in another one
    
    Features:
    - Usual lib readline goodies, backward/forward search etc. Provided by [rustyline](https://lib.rs/crates/rustyline)
    - Simple file based history (~/.picodata_history by default)
    - Displays result sets in ascii tables. Styling can be customized if needed. Here we're using [comfy-table](https://lib.rs/crates/comfy-table) library
    - If you type `\e` command your `$EDITOR` will be opened so you can write the query there. Once you close your editor the query will be executed (suggested by @funbringer)
    
    There are a lot of things we can add. Completion, highlighting, more special commands.
    
    Close #363 
    faca599c
    History
    SQL REPL PoC in rust without Lua
    Dmitry Rodionov authored
    This patch adds new command `picodata sql`. Arguments are the same as `picodata connect`. The idea would be to eventually replace picodata connect with this version.
    
    Simple prerequisites for testing with auth:
    
    ```lua
    pico.create_user("Yoda", "12341234")
    pico.grant_privilege("Yoda", "execute", "role", "super")
    ```
    Super grant wont be needed in the future when access control will be tuned properly (access to system spaces, context: https://git.picodata.io/picodata/picodata/picodata/-/merge_requests/663).
    
    Then run `target/debug/picodata run` in one terminal and `target/debug/picodata sql Yoda@localhost:3301` in another one
    
    Features:
    - Usual lib readline goodies, backward/forward search etc. Provided by [rustyline](https://lib.rs/crates/rustyline)
    - Simple file based history (~/.picodata_history by default)
    - Displays result sets in ascii tables. Styling can be customized if needed. Here we're using [comfy-table](https://lib.rs/crates/comfy-table) library
    - If you type `\e` command your `$EDITOR` will be opened so you can write the query there. Once you close your editor the query will be executed (suggested by @funbringer)
    
    There are a lot of things we can add. Completion, highlighting, more special commands.
    
    Close #363 
This project manages its dependencies using Cargo. Learn more