Skip to main content

ScriptAnalysis

Struct ScriptAnalysis 

Source
pub struct ScriptAnalysis {
    pub text: String,
    pub statements: Vec<AnalysedStatement>,
    pub writes: Vec<ScriptWrite>,
    pub reads: IndexMap<String, TableName>,
    pub variable_reads: IndexMap<String, TableName>,
    pub definition_reads: IndexMap<String, TableName>,
    pub side_reads: IndexMap<String, TableName>,
    pub procedures: IndexMap<String, Procedure>,
    pub procedure_reports: Vec<Value>,
    pub opaque_temps: IndexMap<String, String>,
    pub temp_names: IndexSet<String>,
    /* private fields */
}
Expand description

The result of analyse_script.

Fields§

§text: String§statements: Vec<AnalysedStatement>§writes: Vec<ScriptWrite>§reads: IndexMap<String, TableName>

Real tables read directly.

§variable_reads: IndexMap<String, TableName>

Tables read through variables or conditions.

§definition_reads: IndexMap<String, TableName>

Tables the bodies of routine definitions read.

§side_reads: IndexMap<String, TableName>

Tables read outside the traced output query.

§procedures: IndexMap<String, Procedure>§procedure_reports: Vec<Value>§opaque_temps: IndexMap<String, String>

Temporary tables the final query reads whose query could not be followed, with why.

§temp_names: IndexSet<String>

Implementations§

Source§

impl ScriptAnalysis

Source

pub fn final_statement(&self) -> Option<&Statement>

The statement whose columns define the script’s output (its last unconditional query), with temporary tables renamed to the versions it reads.

Source

pub fn final_query(&self) -> Option<&Query>

The final statement’s query.

Source

pub fn final_target(&self) -> Option<&TableName>

The table the final statement writes, if any.

Source

pub fn with_temp_ctes(&self, query: Query) -> Query

query (the final one, with its own CTEs) with the temporary tables it reads defined in front of it as CTEs.

Source

pub fn final_query_with_temps(&self) -> Option<Query>

The final query with every single-definition temporary table it reads spliced in as a CTE.

Source

pub fn counts(&self) -> IndexMap<Disposition, usize>

Top-level statements by disposition.

Source

pub fn unknown(&self) -> Vec<&AnalysedStatement>

Every unknown statement, nested ones included.

Source

pub fn considered(&self) -> usize

Statements that matter for lineage: kept or unknown, not definitions.

Source

pub fn traced(&self) -> usize

Source

pub fn untraced_kept(&self) -> usize

Kept statements whose columns are not part of the traced output.

Source

pub fn untraced_kinds(&self) -> BTreeMap<String, usize>

Kinds of statements that matter but whose columns are not traced.

Source

pub fn all_reads(&self) -> Vec<TableName>

Every table read, directly or through variables.

Source

pub fn report(&self) -> Value

Counts and kinds only: no SQL text, names or paths.

Source

pub fn summary(&self) -> String

A one-line description of what was kept, ignored and unknown, for a diagnostic.

Trait Implementations§

Source§

impl Clone for ScriptAnalysis

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScriptAnalysis

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ScriptAnalysis

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for ScriptAnalysis

§

impl Freeze for ScriptAnalysis

§

impl Move for ScriptAnalysis

§

impl RefUnwindSafe for ScriptAnalysis

§

impl Send for ScriptAnalysis
where RawVecInner: Send, RawTable<usize>: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send, BoxRaw<Query>: Send, BoxRaw<CreateTable>: Send, BoxRaw<CreateView>: Send, BoxRaw<CreateFunction>: Send, BoxRaw<CreateTableFunction>: Send, BoxRaw<CreateProcedure>: Send, BoxRaw<CreateSchema>: Send, BoxRaw<Insert>: Send, BoxRaw<Update>: Send, BoxRaw<Delete>: Send, BoxRaw<Merge>: Send, BoxRaw<Drop>: Send, BoxRaw<AlterTable>: Send, BoxRaw<DataType>: Send, BoxRaw<Expr>: Send, BoxRaw<Function>: Send, BoxRaw<ExportData>: Send, BoxRaw<LoadData>: Send, BoxRaw<Select>: Send, BoxRaw<SetExpr>: Send, BoxRaw<TableWithJoins>: Send, BoxRaw<TableFactor>: Send, BoxRaw<MatchRecognize>: Send, BoxRaw<Align>: Send,

§

impl Sync for ScriptAnalysis
where RawVecInner: Sync, RawTable<usize>: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync, BoxRaw<Query>: Sync, BoxRaw<CreateTable>: Sync, BoxRaw<CreateView>: Sync, BoxRaw<CreateFunction>: Sync, BoxRaw<CreateTableFunction>: Sync, BoxRaw<CreateProcedure>: Sync, BoxRaw<CreateSchema>: Sync, BoxRaw<Insert>: Sync, BoxRaw<Update>: Sync, BoxRaw<Delete>: Sync, BoxRaw<Merge>: Sync, BoxRaw<Drop>: Sync, BoxRaw<AlterTable>: Sync, BoxRaw<DataType>: Sync, BoxRaw<Expr>: Sync, BoxRaw<Function>: Sync, BoxRaw<ExportData>: Sync, BoxRaw<LoadData>: Sync, BoxRaw<Select>: Sync, BoxRaw<SetExpr>: Sync, BoxRaw<TableWithJoins>: Sync, BoxRaw<TableFactor>: Sync, BoxRaw<MatchRecognize>: Sync, BoxRaw<Align>: Sync,

§

impl Unpin for ScriptAnalysis

§

impl UnsafeUnpin for ScriptAnalysis

§

impl UnwindSafe for ScriptAnalysis

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.