jussisaurio 9aaf0869ae Merge 'Add several cli shell commands, re-structure shell api' from Preston Thorpe
After fixing the shell issue earlier I just had to revisit this. Let me
know if this is too opinionated of changes or out of scope.
This PR adds several of the sqlite CLI commands to the limbo shell user
interface, with their behavior matched as much as possible.
- `.show`:  displays a list of currently enabled settings
- `.open <file>` : opens a database file
- `.output <file>`: allows the user to direct shell output to a file, or
stdout if left blank
- `.cd <dir>`: changes the current working directory of the shell
environment
- `.mode <output_mode>`: allows the user to select between the (two)
current output modes "pretty | raw"
- `.nullvalue <string>`: allows user to set the value of NULL to be
displayed in the output
It also prevents a database file argument from needing to being passed
as an argv[1], but alerts the user that no database was selected, while
allowing them to `.open` a database file with a dot command.
![image](https://github.com/user-
attachments/assets/8249e28d-e545-4c49-ab30-909cf1e42563)
![image](https://github.com/user-
attachments/assets/cfda121b-c789-48cc-a35e-259d8b5a3a04)
This PR also restructures the CLI crate a bit, to make future commands a
bit easier to add.

Reviewed-by: Pekka Enberg <pere-altea@hotmail.com>

Closes #462
2024-12-14 15:45:48 +02:00
2024-12-14 08:15:48 -05:00
2024-12-12 17:22:03 +01:00
fmt
2024-12-13 13:10:33 +01:00
2024-12-11 14:39:27 +02:00
2024-11-15 15:55:33 +02:00
2024-12-13 13:09:13 +01:00
2024-12-13 13:09:13 +01:00
2024-12-12 18:49:05 +02:00
2024-05-07 16:33:44 -03:00
2024-07-05 09:51:56 +03:00
2024-07-12 13:07:34 -07:00
2024-07-12 12:38:56 -07:00
2024-12-14 11:36:22 +02:00

Limbo

Limbo

Limbo is a work-in-progress, in-process OLTP database management system, compatible with SQLite.

Build badge MIT Discord


Features

  • In-process OLTP database engine library
  • Asynchronous I/O support on Linux with io_uring
  • SQLite compatibility (status)
    • SQL dialect support
    • File format support
    • SQLite C API
  • JavaScript/WebAssembly bindings (wip)
  • Support for Linux, macOS, and Windows

Getting Started

CLI

Install limbo with:

curl --proto '=https' --tlsv1.2 -LsSf \
  https://github.com/penberg/limbo/releases/latest/download/limbo-installer.sh | sh

Then use the SQL shell to create and query a database:

$ limbo database.db
Limbo v0.0.6
Enter ".help" for usage hints.
limbo> CREATE TABLE users (id INT PRIMARY KEY, username TEXT);
limbo> INSERT INTO users VALUES (1, 'alice');
limbo> INSERT INTO users VALUES (2, 'bob');
limbo> SELECT * FROM users;
1|alice
2|bob

JavaScript (wip)

Installation:

npm i limbo-wasm

Example usage:

import { Database } from 'limbo-wasm';

const db = new Database('sqlite.db');
const stmt = db.prepare('SELECT * FROM users');
const users = stmt.all();
console.log(users);

Python (wip)

pip install pylimbo

Example usage:

import limbo

con = limbo.connect("sqlite.db")
cur = con.cursor()
res = cur.execute("SELECT * FROM users")
print(res.fetchone())

Developing

Build and run limbo cli:

cargo run --package limbo --bin limbo database.db

Run tests:

cargo test

Test coverage report:

cargo tarpaulin -o html

Run benchmarks:

cargo bench

Run benchmarks and generate flamegraphs:

echo -1 | sudo tee /proc/sys/kernel/perf_event_paranoid
cargo bench --bench benchmark -- --profile-time=5

FAQ

How is Limbo different from libSQL?

Limbo is a research project to build a SQLite compatible in-process database in Rust with native async support. The libSQL project, on the other hand, is an open source, open contribution fork of SQLite, with focus on production features such as replication, backups, encryption, and so on. There is no hard dependency between the two projects. Of course, if Limbo becomes widely successful, we might consider merging with libSQL, but that is something that will be decided in the future.

Publications

  • Pekka Enberg, Sasu Tarkoma, Jon Crowcroft Ashwin Rao (2024). Serverless Runtime / Database Co-Design With Asynchronous I/O. In EdgeSys 24. [PDF]
  • Pekka Enberg, Sasu Tarkoma, and Ashwin Rao (2023). Towards Database and Serverless Runtime Co-Design. In CoNEXT-SW 23. [PDF] [Slides]

Contributing

We'd love to have you contribute to Limbo! Check out the contribution guide to get started.

License

This project is licensed under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Limbo by you, shall be licensed as MIT, without any additional terms or conditions.

Description
No description provided
Readme 43 MiB
Languages
Rust 76.8%
Tcl 6.6%
C 6.4%
Dart 2.4%
Java 2.3%
Other 5.3%