pub struct SnowflakeSource { /* private fields */ }Expand description
A source that streams the rows of a Snowflake SQL statement via the SQL REST API.
Implementations§
Source§impl SnowflakeSource
impl SnowflakeSource
Sourcepub fn new(config: SnowflakeSourceConfig) -> Result<Self, FaucetError>
pub fn new(config: SnowflakeSourceConfig) -> Result<Self, FaucetError>
Create a new Snowflake source. Initialises the underlying HTTP client and
does no I/O; it fails only on an invalid config (an out-of-range
batch_size).
Sourcepub fn with_auth_provider(self, provider: SharedAuthProvider) -> Self
pub fn with_auth_provider(self, provider: SharedAuthProvider) -> Self
Attach a shared AuthProvider. When set,
the provider supplies the credential for every request (taking
precedence over inline auth), so several sources can share one OAuth
token with single-flight refresh. Used by the CLI to resolve
auth: { ref }, and by library callers who inject a provider directly.
The provider must yield a Bearer or Token credential, which maps
onto SnowflakeAuth::OAuth. Key-pair JWT cannot be supplied via a
provider (JWT is minted locally from the RSA key).
Sourcepub fn with_endpoint_base(self, base: impl Into<String>) -> Self
pub fn with_endpoint_base(self, base: impl Into<String>) -> Self
Override the base URL used to reach the SQL REST API.
Pass http://127.0.0.1:1234 to point the source at a mock server —
the source will issue requests to {base}/api/v2/statements and
{base}/api/v2/statements/{handle}?partition=N. Useful for tests
and proxy/private-link setups.
Trait Implementations§
Source§impl Source for SnowflakeSource
impl Source for SnowflakeSource
Source§fn check<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 CheckContext,
) -> Pin<Box<dyn Future<Output = Result<CheckReport, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 CheckContext,
) -> Pin<Box<dyn Future<Output = Result<CheckReport, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Preflight probe for faucet doctor. Overrides the default (which pulls a
page via stream_pages and would execute the configured query).
Instead submits a cheap SELECT 1 so doctor validates auth, warehouse,
and connectivity without running the user’s real statement.
Source§fn stream_pages<'a>(
&'a self,
context: &'a HashMap<String, Value>,
_batch_size: usize,
) -> Pin<Box<dyn Stream<Item = Result<StreamPage, FaucetError>> + Send + 'a>>
fn stream_pages<'a>( &'a self, context: &'a HashMap<String, Value>, _batch_size: usize, ) -> Pin<Box<dyn Stream<Item = Result<StreamPage, FaucetError>> + Send + 'a>>
Stream rows partition-by-partition without buffering the full result
set. Rows are accumulated into a per-page buffer of
SnowflakeSourceConfig::batch_size entries and yielded as soon as
the buffer is full.
The trait-level batch_size argument is ignored in favour of the
config field — the config is the user-facing knob the README
documents, and routing the pipeline-supplied hint through it would
silently override an explicit config value.
batch_size = 0 drains every partition and emits the full result
set as a single page. The source has no incremental-replication mode
today, so every emitted page carries bookmark: None.
Source§fn connector_name(&self) -> &'static str
fn connector_name(&self) -> &'static str
connector label on metrics and the
connector attribute on spans. Defaults to the final segment of
std::any::type_name::<Self>(), e.g. "RestSource". Built-in
connectors override with a short, friendly snake_case name (e.g.
"rest"). Must return a non-empty string; observability decorators
fall back to "unknown" in release builds if it is empty (and
debug_assert! in debug builds).Source§fn config_schema(&self) -> Value
fn config_schema(&self) -> Value
Source§fn dataset_uri(&self) -> String
fn dataset_uri(&self) -> String
Source§fn fetch_with_context<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_with_context<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn fetch_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn fetch_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Source§fn fetch_with_context_incremental<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Value>, Option<Value>), FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn fetch_with_context_incremental<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Value>, Option<Value>), FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Source§fn fetch_all_incremental<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Value>, Option<Value>), FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn fetch_all_incremental<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Value>, Option<Value>), FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Source§fn state_key(&self) -> Option<String>
fn state_key(&self) -> Option<String>
StateStore. Read moreSource§fn apply_start_bookmark<'life0, 'async_trait>(
&'life0 self,
_bookmark: Value,
) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn apply_start_bookmark<'life0, 'async_trait>(
&'life0 self,
_bookmark: Value,
) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
StateStore
as this run’s starting point. Read moreSource§fn capture_resume_position<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn capture_resume_position<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Source§fn supports_exactly_once(&self) -> bool
fn supports_exactly_once(&self) -> bool
false. Read moreSource§fn replay_guarantee(&self) -> ReplayGuarantee
fn replay_guarantee(&self) -> ReplayGuarantee
ReplayGuarantee. Read moreSource§fn is_shardable(&self) -> bool
fn is_shardable(&self) -> bool
false (single whole-dataset
shard). Sources with a natural partition (object-store prefixes, table
primary-key ranges) override this to true and implement
enumerate_shards +
apply_shard.Source§fn enumerate_shards<'life0, 'async_trait>(
&'life0 self,
_target: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<ShardSpec>, FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn enumerate_shards<'life0, 'async_trait>(
&'life0 self,
_target: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<ShardSpec>, FaucetError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
target
of them (a hint — the source may return fewer, e.g. when the dataset is
small, or one per natural partition regardless of target). Read more