Commit Graph

45 Commits

Author SHA1 Message Date
Pekka Enberg
993079e39d bindings/python: Add "experimental_indexes" parameter to connect() 2025-07-21 12:49:38 +03:00
Jussi Saurio
a48b6d049a Another post-rebase clippy round with 1.88.0 2025-07-12 19:10:56 +03:00
Pekka Enberg
5216e67d53 bindings/python: Start transaction implicitly in execute()
We need to start transaction implicitly in execute() for DML statements
to make sure first transaction is actually started.

Fixes #2002
2025-07-09 10:59:52 +03:00
Pere Diaz Bou
91107d364a only close connection in case of reference count is 1
Due to how `execute` is implemented, it returns a `Connection` clone
which internally shares a turso_core::Connection with every other
Connection. Since `execute` returns `Connection` and immediatly it is
dropped, it will close connection, checkpoint and leave database in
weird state.
2025-07-08 15:19:20 +02: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
Pekka Enberg
9303244f9d bindings/python: Explicit transaction control support 2025-07-03 16:50:21 +03:00
Pekka Enberg
603e57aff8 bindings/python: Fix ROLLBACK 2025-07-03 16:36:18 +03:00
PThorpe92
bbee10ba2c Add mvcc and index config to connection open api 2025-06-30 22:04:56 -04:00
PThorpe92
c2670dbd67 Use connection::from_uri method in Python bindings 2025-06-30 22:03:51 -04:00
Pekka Enberg
53ba3ff926 Rename limbo_core crate to turso_core 2025-06-29 09:59:17 +03:00
Pekka Enberg
a5b539f1bf bindings/python: Rename package to pyturso 2025-06-27 11:27:08 +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
Pekka Enberg
2123858770 bindings/python: Add Connection.rollback() 2025-06-25 20:02:09 +03:00
Nils Koch
2827b86917 chore: fix clippy warnings 2025-06-23 19:52:13 +01: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
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
Pere Diaz Bou
ee55116ca6 return row as reference to registers 2025-03-29 22:04:08 +01:00
Pere Diaz Bou
5b7fcd27bd make column reuse blob/text fields 2025-03-29 22:02:49 +01:00
Pere Diaz Bou
bf37fd3314 wip 2025-03-29 22:02:49 +01:00
Pere Diaz Bou
9291f60722 Introduce Register struct
OwnedValue has become a powerhouse of madness, mainly because I decided
to do it like that when I first introduced AggContext. I decided it was
enough and I introduced a `Register` struct that contains `OwnedValue`,
`Record` and `Aggregation`, this way we don't use `OwnedValue` for
everything make everyone's life harder.

This is the next step towards making ImmutableRecords the default
because I want to remove unnecessary allocations. Right now we clone
OwnedValues when we generate a record more than needed.
2025-03-27 17:53:02 +01:00
Diego Reis
ab8187f4e6 ext/python: Gracefully close connection by closing it at Drop 2025-03-24 12:21:15 -03:00
Diego Reis
4ca5b11bed ext/python: Add support for Context Manager 2025-03-24 12:20:13 -03:00
Diego Reis
16b9325830 ext/python: Basic support for placeholding insert 2025-03-20 17:10:12 -03:00
Diego Reis
2481d73d70 ext/python: Partially implements commit()
It was based on https://docs.python.org/3/library/sqlite3.html but some more work is needed specially in LEGACY_TRANSACTION_CONTROL and isolation levels.

See: https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.autocommit
2025-03-20 17:09:55 -03:00
Pekka Enberg
a81ed4a523 bindings/python: Update PyO3 dependency to 0.24.0 2025-03-17 10:58:33 +02:00
Pekka Enberg
96175cccf7 cli: Add --experimental-mvcc option to enable MVCC 2025-03-06 10:16:42 +02:00
Pere Diaz Bou
8daf7666d1 Make database Sync + Send 2025-03-05 14:07:48 +01:00
Pekka Enberg
936ae307b7 core: Kill value type
We currently have two value types, `Value` and `OwnedValue`. The
original thinking was that `Value` is external type and `OwnedValue` is
internal type. However, this just results in unnecessary transformation
between the types as data crosses the Limbo library boundary.

Let's just follow SQLite here and consolidate on a single value type
(where `sqlite3_value` is just an alias for the internal `Mem` type).
The way this will eventually work is that we can have bunch of
pre-allocated `OwnedValue` objects in `ProgramState` and basically
return a reference to them all the way to the application itself, which
extracts the actual value.
2025-02-26 10:57:45 +02:00
Tiago Ribeiro
c69d69a3a2 Update python bindings to use the new retrieval methods to access Record values. 2025-02-10 00:27:51 -07:00
Pekka Enberg
c210821100 core: Move result row to ProgramState
Move result row to `ProgramState` to mimic what SQLite does where `Vdbe`
struct has a `pResultRow` member. This makes it easier to deal with result
lifetime, but more importantly, eventually lazily parse values at the edges of
the API.
2025-02-06 11:52:26 +02:00
Pekka Enberg
7573fc62e6 core: Unify Row and Record structs
They're exactly the same thing.
2025-02-05 09:04:52 +02:00
Jorge López
683125fefb syntactic changes: factor duplicated code into helper function that can be reused 2025-01-18 19:20:11 +01:00
Jorge López
e4ab2fb273 syntactic changes: rewrite loop with while 2025-01-18 19:19:49 +01:00
JeanArhancet
9a70dc8f78 fix: clippy error 2024-12-30 10:22:36 +01:00
JeanArhancet
2a0402ce7f fix: python lint 2024-12-30 10:21:11 +01:00
JeanArhancet
cb69d8b0dd feat(python): add in-memory mode 2024-12-30 10:21:11 +01:00
Pekka Enberg
f2ecebc357 Rename RowResult to StepResult
The name "row result" is confusing because it really *is* a result from
a step() call. The only difference is how a row is represented as we
return from VDBE or from a statement.

Therefore, rename RowResult to StepResult.
2024-12-27 10:20:41 +02:00
Pere Diaz Bou
aed14117c9 core: transaction support 2024-12-24 18:04:30 +01:00
amuldotexe
b7b22f303f ran cargofmt 2024-12-20 20:36:35 +05:30
amuldotexe
f912771ae6 gracefully handling errors for issue https://github.com/tursodatabase/limbo/issues/494 , changes made 5 places where todo macros were replaced with relevant errors 2024-12-20 20:32:03 +05:30
Pekka Enberg
e93ac38e55 Add statement interruption support
This adds an interrupt() method to Statement that allows apps to
interrupt a running statement. Please note that this is different from
`sqlite3_interrupt()` which interrupts all ongoing operations in a
database. Although we want to support that too, per statement interrupt
is much more useful to apps.
2024-12-19 12:30:32 +02:00
Pere Diaz Bou
f66e3925f3 fix imports 2024-11-05 15:29:54 +01:00
김선우
28884181be Fix clippy 2024-09-15 16:23:27 +09:00
JeanArhancet
fc2962e04e ci: integrate pyo3
ci: add manylinux

fix: maturin build error

ci: add wheels upload

ci: use venv
2024-08-25 21:47:17 +02:00
JeanArhancet
7c362b129f feat: impl python binding
refactor: pep-0249

refactor: rust comment and requirements-dev.txt

fix: name conflict
2024-08-11 08:58:18 +02:00