Commit Graph
10 Commits
Author SHA1 Message Date
Eric Eastwood 287c0656d6 Convert SQL args to compatible with the Python side
```
error[E0308]: mismatched types
   --> rust/src/storage/db/python_db_pool.rs:236:35
    |
236 |             self.execute(py, sql, args)?;
    |                  -------          ^^^^ expected `&Bound<'_, PyAny>`, found `&[&str]`
    |                  |
    |                  arguments to this method are incorrect
    |
    = note: expected reference `&pyo3::Bound<'_, pyo3::PyAny>`
               found reference `&'life2 [&'life3 str]`
note: method defined here
   --> rust/src/storage/db/python_db_pool.rs:206:12
    |
206 |     pub fn execute<'py>(
    |            ^^^^^^^
...
210 |         args: &Bound<'py, PyAny>,
    |         ------------------------
```
2026-06-05 15:57:48 -05:00
Eric Eastwood 7e709fb861 Fix tricky Rust error which turned out to just needing to use an actual py
```
error[E0277]: the trait bound `std::vec::Vec<T>: pyo3::FromPyObject<'_, '_>` is not satisfied
   --> rust/src/storage/db/python_db_pool.rs:228:30
    |
228 |         Ok(fetch_fn.call0()?.extract()?)
    |                              ^^^^^^^ the trait `pyo3::FromPyObject<'_, '_>` is not implemented for `std::vec::Vec<T>`
    |
note: required by a bound in `pyo3::types::PyAnyMethods::extract`
   --> /home/eric/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pyo3-0.28.3/src/types/any.rs:881:12
    |
879 |     fn extract<'a, T>(&'a self) -> Result<T, T::Error>
    |        ------- required by a bound in this associated function
880 |     where
881 |         T: FromPyObject<'a, 'py>;
    |            ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `PyAnyMethods::extract`
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
    |
223 |     ) -> anyhow::Result<Vec<T>> where std::vec::Vec<T>: pyo3::FromPyObject<'_, '_> {
    |                                 ++++++++++++++++++++++++++++++++++++++++++++++++++
```
2026-06-05 15:40:13 -05:00
Eric Eastwood c289dd19a6 Resolve fetchall lifetimes -> FromPyObjectOwned
We can use `FromPyObjectOwned` (instead of `FromPyObject`)
because we don't borrow anything

```
error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied
   --> rust/src/storage/db/python_db_pool.rs:220:24
    |
220 |     pub fn fetchall<T: FromPyObject<'py> + ValidDatabaseReturnType>(
    |                        ^^^^^^^^^^^^ --- supplied 1 lifetime argument
    |                        |
    |                        expected 2 lifetime arguments
    |
note: trait defined here, with 2 lifetime parameters: `'a`, `'py`
   --> /home/eric/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pyo3-0.28.3/src/conversion.rs:401:11
    |
401 | pub trait FromPyObject<'a, 'py>: Sized {
    |           ^^^^^^^^^^^^ --  ---
help: add missing lifetime argument
    |
220 |     pub fn fetchall<T: FromPyObject<'py, 'py> + ValidDatabaseReturnType>(
    |                                        +++++
```
2026-06-05 15:34:45 -05:00
Eric Eastwood 8672bb4be3 Better figure out Bound<'py, PyAny> vs Py<PyAny>
Docs: https://pyo3.rs/v0.28.3/types.html
2026-06-05 15:25:20 -05:00
Eric Eastwood 7757712ebc Fix db_pool extraction 2026-06-05 14:32:01 -05:00
Eric Eastwood 66a1886dc7 SynapseConfig FromPyObject 2026-06-05 14:11:06 -05:00
Eric Eastwood bdffe562ad Split connection vs transaction 2026-06-04 19:21:08 -05:00
Eric Eastwood 66737780dd Slow going 2026-06-04 18:44:04 -05:00
Eric Eastwood 99b13354d2 Iterate on structure 2026-06-04 16:31:46 -05:00
Eric Eastwood 51ff8ee3d6 Refine usage 2026-06-04 11:31:45 -05:00