Commit Graph

232 Commits

Author SHA1 Message Date
Jussi Saurio
cc47bfba02 CSV import fixes
- Fix not being able to create table while importing
    * The behavior now aligns with SQLite so that if the table already
      exists, all the rows are treated as data. If the table doesn't exist,
      the first row is treated as the header from which column names for the
      new table are populated.
- Insert in batches instead of one at a time
2025-07-15 16:44:11 +03:00
Pekka Enberg
b13a0bb549 cli: Fail import command if table does not exists
SQLite creates a table if it does not exists, but we just silently
ignore the data. Let's add an error if table does not exist until we fix
this.

Refs #2079
2025-07-14 12:24:58 +03:00
Jussi Saurio
a48b6d049a Another post-rebase clippy round with 1.88.0 2025-07-12 19:10:56 +03:00
Nils Koch
828d4f5016 fix clippy errors for rust 1.88.0 (auto fix) 2025-07-12 18:58:41 +03:00
pedrocarlo
711b1ef114 make all run_once be run under statement or connection so that rollback is called 2025-07-07 11:51:25 -03:00
pedrocarlo
7ec47e90cc turn off tracing by default so that errors are not printed in the cli env is not set 2025-07-07 11:50:21 -03:00
Pekka Enberg
42c08b5bea cli: Add support for .headers command
The `.headers` command takes `on` and `off` as parameter, supported by
SQLite, which controls whether result set header is printed in list mode.
2025-07-07 13:24:45 +03:00
meteorgan
ccfee3f418 disable adaptive colors when output_mode is list 2025-07-03 23:31:51 +08:00
pedrocarlo
191f732088 from_uri was not passing mvcc and indexes flag to database creation for memory path 2025-07-02 13:46:49 -03:00
Pekka Enberg
5de904be47 Merge 'automatically select terminal colors for pretty mode' from Glauber Costa
I just tried turso and couldn't read the last column. Turns out I guess
Pekka's taste is not the best, at least not for everybody.
Auto-detect if terminal is light or dark mode and select colors
accordingly.

Closes #1922
2025-07-02 15:06:37 +03:00
Pekka Enberg
325bd80a86 Merge 'limbo -> turso' from Glauber Costa
Fix user-visible string

Closes #1918
2025-07-02 08:14:20 +03:00
Glauber Costa
808d83d34e automatically select terminal colors for pretty mode
I just tried turso and couldn't read the last column.
Turns out I guess Pekka's taste is not the best, at least not for
everybody.

Auto-detect if terminal is light or dark mode and select colors
accordingly.
2025-07-01 22:01:19 -05:00
Glauber Costa
4655b194c7 limbo -> turso
Fix user-visible string
2025-07-01 16:05:26 -05:00
PThorpe92
bbee10ba2c Add mvcc and index config to connection open api 2025-06-30 22:04:56 -04:00
PThorpe92
d526915b24 Optionally use from_uri in CLI if the connection string looks like a URI 2025-06-30 22:04:54 -04:00
Pekka Enberg
3dcc07c4f1 cli: Rename application to Turso
Affects the output of `--version`, for example.
2025-06-30 22:23:43 +03:00
Pekka Enberg
d377f4c948 Move completion extension dependency to CLI
We never need it in core anyway.
2025-06-29 13:32:17 +03:00
Pekka Enberg
53ba3ff926 Rename limbo_core crate to turso_core 2025-06-29 09:59:17 +03:00
Pekka Enberg
a87f294f24 cli: Switch to syntect development version
Fixes #1504
2025-06-27 13:21:10 +03:00
Pekka Enberg
45c1a72d0a cli: Rename CLI to Turso 2025-06-27 12:37:42 +03:00
Pekka Enberg
5653f96701 cargo fmt 2025-06-27 11:46:14 +03:00
Pekka Enberg
aaecca0ec9 cli: Add disclaimer that software is ALPHA 2025-06-27 11:28:32 +03:00
Pekka Enberg
018b17b6f2 Rename Limbo to Turso Database 2025-06-26 21:05:02 +03:00
Pekka Enberg
2fc5c0ce5c Switch to runtime flag for enabling indexes
Makes it easier to test the feature:

```
$ cargo run --  --experimental-indexes
Limbo v0.0.22
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database
limbo> CREATE TABLE t(x);
limbo> CREATE INDEX t_idx ON t(x);
limbo> DROP INDEX t_idx;
```
2025-06-26 10:07:28 +03:00
Pere Diaz Bou
0119b0f99d clippy 2025-06-25 14:01:53 +02:00
Pere Diaz Bou
4c3ca2caee remove hacked cacheflush on cli app 2025-06-25 14:00:57 +02:00
Pere Diaz Bou
e2df4e1d33 run cacheflush until completion cli 2025-06-25 14:00:57 +02:00
Nils Koch
2827b86917 chore: fix clippy warnings 2025-06-23 19:52:13 +01:00
Pekka Enberg
37566d29cc cli: Remove extra binary
The `cargo-dist` tool attempts to find it but because we never build it,
packaging fails. Remove the extra binary. Probably better to work
towards making experimental indexes a runtime flag instead.
2025-06-19 09:41:01 +03:00
Pekka Enberg
14da7defbf cli: Exclude experimental binary from dist package 2025-06-18 14:58:48 +03:00
Pere Diaz Bou
9ae4563bcd index_experimental flag to enable index usages
Currently indexes are the bulk of the problem with `UPDATE` and
`DELETE`, while we work on fixing those it makes sense to disable
indexing since they are not stable. We want to try to make everything
else stable before we continue with indexing.
2025-06-17 19:33:23 +02:00
Pekka Enberg
96c47667ea Merge 'Add abbreviated alias for .quit and .exit' from Krishna Vishal
Accidentally found that you can quit SQLite CLI just by typing `.q`,
`.qu` and `.qui` instead of full `.quit`.
IMO this will be an improvement to the DX.
I've also found bunch of other dot commands that work with abbreviated
aliases in SQLite. If this PR is okay then I will also add them here.

Closes #1720
2025-06-16 11:11:17 +03:00
Pekka Enberg
4d6b5c2b88 Merge 'cli: fix panic of queries with less than 7 chars' from Nils Koch
Hey everyone! I think this project is really really cool and I am here
to answer @jussisaurio
[call](https://x.com/jussisaur/status/1930290889496129562).
I started tinkering around with limbo and ran into this panic. Any input
with less than 7 characters (`"explain".len()`) will trigger it. In my
case it was `show;`. The issue was introduced a week ago in #1678.
PS: As I [said on X](https://x.com/nilskch/status/1930362930605723818),
I would love to help you with Limbo. I have a lot of experience with
DSLs and LSPs, and I have recently become interested in databases. I
don't have much experience with databases yet, but I am happy to learn.
I see that you have a lot of stuff going on with DSLs at the moment, so
I would be productive straight away in that area. Happy to chat if you
need help :)

Closes #1730
2025-06-16 11:06:02 +03:00
Pekka Enberg
90c1e3fc06 Switch Connection to use Arc instead of Rc
Connection needs to be Arc so that bindings can wrap it with `Mutex` for
multi-threading.
2025-06-16 10:43:19 +03:00
Nils Koch
733c3603f2 cli: fix panic of queries with less than 7 chars 2025-06-13 20:25:47 +01:00
Krishna Vishal
3ff9af3320 Add .quit alias = .q, .qu, .qui
Add .exit alias = .ex, .exi
2025-06-12 00:07:07 +05:30
pedrocarlo
b942414bb4 add anyhow to workspace dependency 2025-06-10 10:50:39 -03:00
pedrocarlo
0f2849f7e1 serde and serde_json as workspace dependencies 2025-06-09 11:38:15 -03:00
Anton Harniakou
5944e07484 Use eq_ignore_ascii_case 2025-06-06 17:08:49 +03:00
meteorgan
ab4eda59be close conn after executing limbo in cli 2025-06-03 22:06:08 +08:00
pedrocarlo
08f415370c remove rustyline traces from cli 2025-05-30 11:33:22 -03:00
Jussi Saurio
58bff43f1f Merge 'remove detection of comments in the middle of query in cli' from Pedro Muniz
I was trying to run the TPC-H 9.sql in the CLI, but it kept truncating
my input due to a comment that is present in the query. After removing
it, I can just copy and paste the query and it works. @PThorpe92 is it
safe to remove this? Or is there a particular reason that was included
that I am not aware of?

Closes #1525
2025-05-22 09:48:13 +03:00
Diego Reis
c76387ec1b cli/fix: Apply default config for app 2025-05-21 12:06:08 -03:00
pedrocarlo
4b7e4417aa remove detection of comments in the middle of query in cli 2025-05-19 16:47:00 -03:00
pedrocarlo
b3b52f7f2f applying config in app 2025-05-17 15:51:43 -03:00
pedrocarlo
c73927729d config docs 2025-05-17 15:51:17 -03:00
pedrocarlo
a614114591 Config Definitions 2025-05-17 15:51:17 -03:00
Pekka Enberg
e3f71259d8 Rename OwnedValue -> Value
We have not had enough merge conflicts for a while so let's do a
tree-wide rename.
2025-05-15 09:59:46 +03:00
Pekka Enberg
3e6ac7c4a0 Merge 'Save history on exit' from Piotr Rżysko
Before this change, the history was only saved when the shell was
interrupted (e.g., Ctrl-C pressed twice). With this change, history is
now also saved when the `.exit` or `.quit` commands are used.
I attempted to add shell tests to cover the changes introduced in this
PR, but emulating a terminal/TTY that would work cross-platform seems to
require significant changes to `TestLimboShell` and `LimboShell`. For
example, the `pty` module [currently doesn't support
Windows](https://bugs.python.org/issue41663). I'm open to experimenting,
but I’m unsure if complicating these classes is worthwhile, as saving
history doesn't seem to be critical.
Additionally, it might be worth considering a refactor of the CLI so
that exit and cleanup operations are performed in one place.

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #1414
2025-04-29 21:50:41 +03:00
Piotr Rzysko
33d230771f Save history on exit 2025-04-28 08:59:25 +02:00