pub struct QueryEngine { /* private fields */ }Expand description
The main query engine that wraps DuckDB
Implementations§
Source§impl QueryEngine
impl QueryEngine
Sourcepub fn new(config: &QueryConfig) -> Result<Self>
pub fn new(config: &QueryConfig) -> Result<Self>
Create a new query engine with the given configuration
Sourcepub fn from_cache(cache_path: &Path, config: &QueryConfig) -> Result<Self>
pub fn from_cache(cache_path: &Path, config: &QueryConfig) -> Result<Self>
Create a query engine from a cached database file
Sourcepub fn import_dump(&mut self, dump_path: &Path) -> Result<&ImportStats>
pub fn import_dump(&mut self, dump_path: &Path) -> Result<&ImportStats>
Import a SQL dump file into the DuckDB database
Sourcepub fn query(&self, sql: &str) -> Result<QueryResult>
pub fn query(&self, sql: &str) -> Result<QueryResult>
Execute a query and return the results
Sourcepub fn execute(&self, sql: &str) -> Result<usize>
pub fn execute(&self, sql: &str) -> Result<usize>
Execute a statement that doesn’t return results (e.g., CREATE, INSERT)
Sourcepub fn list_tables(&self) -> Result<Vec<String>>
pub fn list_tables(&self) -> Result<Vec<String>>
Get list of tables in the database
Sourcepub fn describe_table(&self, table: &str) -> Result<QueryResult>
pub fn describe_table(&self, table: &str) -> Result<QueryResult>
Get schema for a specific table
Sourcepub fn import_stats(&self) -> Option<&ImportStats>
pub fn import_stats(&self) -> Option<&ImportStats>
Get import statistics (if a dump was imported)
Sourcepub fn connection(&self) -> &Connection
pub fn connection(&self) -> &Connection
Get the underlying DuckDB connection (for advanced use)
Sourcepub fn save_to_file(&self, path: &Path) -> Result<()>
pub fn save_to_file(&self, path: &Path) -> Result<()>
Save the current database to a file (for caching)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for QueryEngine
impl !RefUnwindSafe for QueryEngine
impl Send for QueryEngine
impl !Sync for QueryEngine
impl Unpin for QueryEngine
impl UnwindSafe for QueryEngine
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more