MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / snapshot

Function snapshot

src/sql-server-util/src/inspect.rs:857–872  ·  view source on GitHub ↗

Return a [`Stream`] that is the entire snapshot of the specified table.

(
    client: &mut Client,
    table: &SqlServerTableRaw,
)

Source from the content-addressed store, hash-verified

855
856/// Return a [`Stream`] that is the entire snapshot of the specified table.
857pub fn snapshot(
858 client: &mut Client,
859 table: &SqlServerTableRaw,
860) -> impl Stream<Item = Result<tiberius::Row, SqlServerError>> {
861 let cols = table
862 .columns
863 .iter()
864 .map(|SqlServerColumnRaw { name, .. }| quote_identifier(name))
865 .join(",");
866 let query = format!(
867 "SELECT {cols} FROM {schema_name}.{table_name};",
868 schema_name = quote_identifier(&table.schema_name),
869 table_name = quote_identifier(&table.name)
870 );
871 client.query_streaming(query, &[])
872}
873
874/// Returns the total number of rows present in the specified table.
875pub async fn snapshot_size(

Callers

nothing calls this directly

Calls 5

query_streamingMethod · 0.80
quote_identifierFunction · 0.70
joinMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected