pub struct SqliteBackend { /* private fields */ }Expand description
SQLite-backed data engine (see module docs).
Cheap to clone: clones share one connection behind a mutex, matching the
conversation store. All methods take &self.
Implementations§
Source§impl SqliteBackend
impl SqliteBackend
Sourcepub fn open(path: &Path) -> Result<Self>
pub fn open(path: &Path) -> Result<Self>
Open (creating if needed) the data database at path.
Creates the parent directory, opens the connection, applies
journal_mode=WAL (+ synchronous=NORMAL) with a journal_mode=DELETE
fallback on the known network-filesystem failure modes — exactly like
newt_core::store — and ensures the
__datasets metadata table exists.
Sourcepub fn open_in_memory() -> Result<Self>
pub fn open_in_memory() -> Result<Self>
Open an in-memory database with the __datasets table — used by tests
(no WAL on :memory:; the metadata table is created the same way).
Sourcepub fn default_db_path(workspace: &Path) -> PathBuf
pub fn default_db_path(workspace: &Path) -> PathBuf
The default data-database path for a workspace:
<workspace>/.newt-data/data.db.
Trait Implementations§
Source§impl Clone for SqliteBackend
impl Clone for SqliteBackend
Source§impl DataStore for SqliteBackend
impl DataStore for SqliteBackend
Source§fn ingest_csv(&self, path: &Path, table: &str) -> Result<IngestReport>
fn ingest_csv(&self, path: &Path, table: &str) -> Result<IngestReport>
Source§fn query(&self, sql: &str, row_cap: usize) -> Result<QueryResult>
fn query(&self, sql: &str, row_cap: usize) -> Result<QueryResult>
Run
sql and return up to row_cap rows with an honest truncated
flag (Phase 21 — see QueryResult). row_cap == 0 returns no rows
and truncated == true iff the query produced any.Source§fn summarize(&self, table: &str) -> Result<TableSummary>
fn summarize(&self, table: &str) -> Result<TableSummary>
Compute schema + per-column statistics (pandas-style describe for
numeric columns) for
table (DataError::NoSuchTable if absent).Source§fn list_tables(&self) -> Result<Vec<TableInfo>>
fn list_tables(&self) -> Result<Vec<TableInfo>>
List the user tables (excluding the engine’s
__datasets metadata and
SQLite’s internal tables) with their row counts and source paths.Source§fn backend_name(&self) -> &'static str
fn backend_name(&self) -> &'static str
A short, stable backend identifier (
"sqlite" today; "duckdb" at
step 21.8) for diagnostics and tool output.Auto Trait Implementations§
impl Freeze for SqliteBackend
impl RefUnwindSafe for SqliteBackend
impl Send for SqliteBackend
impl Sync for SqliteBackend
impl Unpin for SqliteBackend
impl UnsafeUnpin for SqliteBackend
impl UnwindSafe for SqliteBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more