sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
da608812e15e2b4cc732fd5352bc4edeade4650043a0e6870f9d08950426d860 | Rust | 1,274 | 32 | use dbt_telemetry::{NodeEvaluated, set_node_warning_outcome_warned};
use dbt_tracing::{LogRecordInfo, SeverityNumber};
use super::super::{
data_provider::DataProvider, fs_error_log::get_log_message, layer::TelemetryMiddleware,
};
/// Middleware that automatically marks the current node span as having produced
///... |
966b46deb822d60d7d43e047625bbbbb1ed59d4b6269439088d5bf8700a36a3f | Rust | 1,284 | 31 | //! Which global allocator the `salmon` binary is built with.
//!
//! The quant hot path is highly multithreaded and allocation-heavy (per-read
//! scratch buffers allocated on a parser thread and freed on a worker thread),
//! so the allocator is a real, measurable choice rather than a detail. mimalloc
//! is the defa... |
9b2182257a188f01d287b3ce105ea9e1512e6956b72cafe991cc285293ac8dc5 | Rust | 1,291 | 50 | use std::sync::Arc;
use minijinja::value::{Enumerator, Object, Value, ValueKind};
use minijinja::{context, Environment};
#[derive(Debug)]
struct SelfReferentialContext {
ctx: Value,
}
impl Object for SelfReferentialContext {
fn get_value(self: &Arc<Self>, name: &Value) -> Option<Value> {
if name.as_s... |
47a7655162db378ef35496379be4c91f171400386f9c7a416e3169239abdb9f2 | Rust | 1,296 | 45 | use std::collections::BTreeMap;
use dbt_adapter_core::AdapterType;
use minijinja::Value;
use crate::macro_test_harness::{MacroTestHarness, assert_executed_contains};
fn build_harness() -> MacroTestHarness {
let mut harness = MacroTestHarness::for_adapter(AdapterType::Databricks)
.load_all_macros()
... |
823739bb7589afc787bafa8a89792068478a5a8c419706d02d4e78fc590200b6 | Rust | 1,297 | 27 | //! Public classifier data shapes shared across crates.
//!
//! These are the lean, compiler-free shapes used by the OSS surface
//! (`dbt-jinja-utils`, `dbt-index-core`) and by the proprietary propagation
//! engine (`dbt-classification`). Anything that requires the SQL/LogicalPlan
//! compiler or warehouse-specific l... |
d969f206cf45ec1755e7dbfd5938d573c47ad079654e088deb105a0d14706b18 | Rust | 1,301 | 43 | use minijinja::{args, context, Environment};
fn main() {
let mut env = Environment::new();
env.add_template("layout.html", include_str!("templates/layout.html"))
.unwrap();
env.add_template("index.html", include_str!("templates/index.html"))
.unwrap();
let template = env.get_template("... |
96228be54465484bc777c48b7493e88c253b5ada9bc448634aecd069f1778d50 | Rust | 1,306 | 46 | use std::path::Path;
use dbt_tracing::{LogRecordInfo, SeverityNumber};
use super::super::{
data_provider::DataProvider, fs_error_log::get_log_message, layer::TelemetryMiddleware,
};
pub struct TelemetryMarkdownLogFilter;
impl TelemetryMarkdownLogFilter {
fn is_markdown_path(path: &str) -> bool {
Pat... |
419105ffd8b29b9a1aa5e5324d8f0b9030ef1afa93784ea73fd3c6d7051e2126 | Rust | 1,309 | 37 | use crate::constants::DBT_BRAND_NAME;
use crate::io_args::{FsCommand, IoArgs, LogFormat};
use crate::tracing::{FsTraceConfig, FsTraceConfigBuilder};
use std::path::PathBuf;
fn config_from_formats(log_format: LogFormat, log_format_file: Option<LogFormat>) -> FsTraceConfig {
// Any path works; nothing here resolves ... |
0800c71fe21a6efeb64c35e71f99126dcff605f89969cf3dda9b2daaeb7b881c | Rust | 1,342 | 39 | use dbt_common::io_args::FsCommand;
/// Common configuration for compilation pipeline
#[derive(Clone)]
pub struct CompilationConfig {
/// Whether to use the build cache to determine the schedule
pub use_build_cache_for_scheduling: bool,
/// Commands that support caching
pub cacheable_commands: Vec<FsCo... |
53166de9e0ece8dd2ed234f283d92f161519ff4dc44b765eced346a7e0c99ff6 | Rust | 1,350 | 39 | //! Public types for view-definition fetching.
//!
//! `ViewDefinition` is the per-view payload that the adapter's
//! `fetch_view_definitions` returns. Recursive traversal that parses these
//! definitions to discover upstream references is performed by callers.
use std::collections::BTreeSet;
use dbt_adapter_core::... |
5c3cb096913de32483f58fc38e8478a1e51b5f6838f0d03edfaebcf47e606f25 | Rust | 1,355 | 36 | //! The [SourcesExtractor] trait: parse a SQL statement and return the upstream
//! table references it depends on.
use dbt_adapter_core::AdapterType;
use crate::FullyQualifiedName;
use crate::error::FrontendResult;
use crate::named_reference::NamedReference;
pub trait SourcesExtractor: Send + Sync {
/// Parse `... |
621af5dbb1a166cec585ab03811c92a020c0988dc4d8dc60fae0efd001883f73 | Rust | 1,364 | 25 | //! Small utilities for pre-processing raw `yaml::Value` before Jinja rendering.
//!
//! Used by resolvers that need to keep specific fields out of
//! [`into_typed_with_jinja`](dbt_jinja_utils::serde::into_typed_with_jinja)'s
//! field-transformer (the recursive Jinja renderer). Documentation text is
//! the canonical... |
6f9ab3a53276bd05e72ba08aff9314d3023c98e5cd519d61d6d987c7c375a03e | Rust | 1,379 | 52 | use std::io::{self, Write};
use std::path::{Path, PathBuf};
use anyhow::{anyhow, Error};
use tempfile::NamedTempFile;
pub const STDIN_STDOUT: &str = "-";
pub struct Output {
temp: Option<(PathBuf, NamedTempFile)>,
}
impl Output {
pub fn new(filename: &Path) -> Result<Output, Error> {
Ok(Output {
... |
179fe72eccda60a8143c03f39b50501f48f099e06dd3aefd2685e19d444b4504 | Rust | 1,382 | 50 | use std::fs::create_dir_all;
pub mod cli {
include!("src/command.rs");
}
fn main() -> std::io::Result<()> {
println!("cargo:rerun-if-changed=build.rs");
let out_dir = match std::env::var_os("ASSET_OUT_DIR") {
Some(dir) => std::path::PathBuf::from(dir),
None => return Ok(()),
};
l... |
33785effa7c1b364fdef69ba46ca68bb4762e24ce88d452871777077753f657b | Rust | 1,384 | 33 | //! Dump the deduplicated transcriptome held by a salmon index as FASTA, so a
//! simulator (polyester) draws reads from exactly the transcript set that will
//! be quantified — no off-by-one between the simulated truth and the index.
//!
//! Usage: dump_txome <index_dir> <out.fa>
use salmon_index::SalmonIndex;
use st... |
654dc2aef6abbc3509bbfc4e4f6846186e63b1485427248e5aa82efccbc6c352 | Rust | 1,384 | 29 | //! Lightweight `std`-only home for dyn-trait handles shared between
//! `dbt-jinja-ctx` and the crates that implement them (`dbt-adapter`,
//! `dbt-schemas`, …).
//!
//! The crate exists so the typed Jinja context layer doesn't have to drag
//! `dbt-common` (with its `arrow` / `parquet` / `dashmap` / `schemars` /
//! ... |
0c8c8acba61792cf258ed95616b16e9f846ca24cc27e9931729e6172f390a8c2 | Rust | 1,409 | 46 | //! A set of util functions for casting from/to Value
use crate::relation::RelationObject;
use dbt_schemas::schemas::relations::base::BaseRelation;
use std::file;
use std::sync::Arc;
pub const THIS_RELATION_KEY: &str = "__this__";
pub fn downcast_value_to_dyn_base_relation(
value: &minijinja::Value,
) -> Result... |
c85cc5dc8d85ea7eaa570a673ca50683bd698987a0dfadd64c9fc31486d1e57f | Rust | 1,410 | 47 | use minijinja::{Environment, Error, Value};
fn eval_expr(env: &Environment, expr: &str) -> Result<Value, Error> {
env.compile_expression(expr).unwrap().eval((), &[])
}
#[test]
fn test_validation() {
use minijinja_contrib::modules::validation::create_validation_namespace;
let mut env = Environment::new();
... |
e2d65c32376cff8ededef49fc6262db0a98a37317186ba046bcbf7677db8c3a1 | Rust | 1,412 | 50 | use std::path::PathBuf;
use minijinja::value::{Value, ViaDeserialize};
use minijinja::{context, Environment};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct Point {
x: f32,
y: f32,
}
fn dirname(path: ViaDeserialize<PathBuf>) -> String {
match path.parent() {
... |
68978a5ad78d363b7c42884f16d6e4ec8b81eca081b2139c95cdb018df52488c | Rust | 1,414 | 50 | use std::rc::Rc;
use crate::{
types::{Object, Type},
TypecheckingEventListener,
};
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct TupleType {
pub fields: Vec<Type>,
}
impl TupleType {
pub fn new(fields: Vec<Type>) -> Self {
Self { fields }
}
}
impl Object for Tu... |
2bcc96c2dfb549dcc12462d0d375a3437a12b3467fea33bf041549d129f77f50 | Rust | 1,416 | 48 | use std::sync::Arc;
use std::sync::atomic::AtomicPtr;
use dbt_common::tracing::TelemetryHandle;
use dbt_common::tracing::TracingConfigProvider;
use dbt_common::tracing::error::TracingError;
use dbt_common::tracing::noop_tracing_config_provider;
pub struct TracingFeature {
pub config_provider: Arc<dyn TracingConfi... |
8ac141c6634cd37207e5227d39b00c02ca85feff80f4b80854370b5663db2a48 | Rust | 1,427 | 47 | /// Utility module to help with string interning.
use crate::utils::OnDrop;
use std::cell::{Cell, RefCell};
use std::collections::HashSet;
use std::sync::Arc;
thread_local! {
static STRING_KEY_CACHE: RefCell<HashSet<Arc<str>>> = Default::default();
static USE_STRING_KEY_CACHE: Cell<bool> = const { Cell::new(f... |
3dd8f2875d194f848d2f103a363634cb7f101675a37ce61fc382d32b1e4c475c | Rust | 1,440 | 48 | use dbt_adapter::relation::RelationObject;
use dbt_adapter_core::AdapterType;
use dbt_schemas::dbt_types::RelationType;
use minijinja::Value;
use crate::macro_test_harness::MacroTestHarness;
fn build_harness() -> MacroTestHarness {
let sql =
include_str!("../../src/dbt_macro_assets/dbt-databricks/macros/a... |
6b06ae0e7b44b835f8615d94ae00ce7e3a2de1e0be7be71be43208e5dca44f88 | Rust | 1,465 | 51 | #![cfg(feature = "fuel")]
use minijinja::{context, Environment, ErrorKind};
#[test]
fn test_basic() {
let mut env = Environment::new();
assert_eq!(env.fuel(), None);
env.set_fuel(Some(100));
assert_eq!(env.fuel(), Some(100));
env.add_template("test", "{% for x in seq %}{{ x }}\n{% endfor %}")
... |
f4c2a23bfeb39b5c989e6ade28327c188fce7f15851cb8ba05c252fb79e4bbfb | Rust | 1,486 | 55 | use minijinja::{context, Environment};
use serde::Serialize;
#[derive(Serialize)]
struct Item {
link: &'static str,
title: &'static str,
children: Vec<Item>,
}
fn main() {
let mut env = Environment::new();
env.set_debug(true);
env.add_template(
"loop.html",
r#"
<ul class="n... |
c84ac5b86a2d95943063cfcdd1cb1d7d34aaba7cab1bfa05bd6569c0a2559ea9 | Rust | 1,494 | 46 | use std::collections::{BTreeMap, BTreeSet, HashMap};
use std::string::String;
use std::sync::Arc;
use arrow_schema::Schema;
use dbt_adapter_core::ExecutionPhase;
use dbt_common::cancellation::CancellationToken;
use dbt_common::{AdapterResult, AsyncAdapterResult};
use dbt_schemas::schemas::relations::base::BaseRelation... |
d03545f7dd0b20ac72d421c56f653bdd08aea362da75b10cd63e124b7a530cc6 | Rust | 1,495 | 57 | use serde::{Deserialize, Serialize};
use std::str::FromStr;
/// Wrapper type that handles row limiting with special -1 case for unlimited rows
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
pub struct RowLimit(pub Option<u32>);
impl Default for RowLimit {
fn default() -> Self {
RowLimit(Some(10)) /... |
99fb5af7636905b73cd4698d51b20d63f86095c24023d951cdb83110971fefd0 | Rust | 1,500 | 53 | //! ADBC connection options for Spark
pub const HOST: &str = "spark.host";
pub const PORT: &str = "spark.port";
pub const TRANSPORT_API: &str = "spark.api";
pub mod transport_api {
pub const THRIFT_BINARY: &str = "thrift+binary";
pub const THRIFT_HTTP: &str = "thrift+http";
pub const LIVY: &str = "livy";
... |
a99649ce4cad53f8207190b799cd8a18fe983f432294e53a41d8da3f36214d8b | Rust | 1,518 | 49 | mod cloud_yaml;
mod env_var;
mod oauth;
pub use cloud_yaml::CloudYamlResolver;
pub use env_var::EnvVarResolver;
pub use oauth::{
INTERACTIVE_TIMEOUT, OAUTH_SCOPES, OAuthAbortHandle, OAuthInteractiveResolver,
OAuthInteractiveResolverBuilder, OAuthPassiveResolver, Opener,
};
use crate::{AuthError, Credential};
... |
d07a858811b602940f93d2a7dfc0b4a33b4a276f750f9456cd6172576e8d806e | Rust | 1,523 | 38 | //! Top-down prediction for binary leaf layers, mirroring
//! `pyhgf/updates/vectorised/binary/prediction.py`.
use crate::math::{sigmoid, with_coupling, CouplingFn};
use crate::updates::vectorised::push;
use crate::vectorised::layer::LayerState;
use crate::vectorised::mat::{Float, Matrix};
/// Predict a binary (Berno... |
6a4ca649fbd12b34bfcb99a6c36e474bca9c7c4ee15e4e8d4d01a43475e05859 | Rust | 1,545 | 40 | //! Parse-phase `Object` impls — std-only types moved here from
//! `dbt-jinja-utils` so the typed parse-phase ctx structs can hold them via
//! `JinjaObject<T>` rather than opaque `MinijinjaValue`.
//!
//! `ParseConfig<T>`, `ResolveRefFunction<T>` and friends are NOT here —
//! they're generic over the config-model ty... |
8c93dcc687e831c73c78896090497ee8206b4ee696d8a4524189b0e751df497c | Rust | 1,556 | 44 | use std::env;
use std::path::PathBuf;
use std::thread;
use std::time::Duration;
use minijinja::context;
use minijinja::{path_loader, Environment};
use minijinja_autoreload::AutoReloader;
fn main() {
// If DISABLE_AUTORELOAD is set, then the path tracking is disabled.
let disable_autoreload = env::var("DISABLE... |
6e1b76021f4358359415a34381cdca2dfbfc6824d7dd34e79eb0c429f20d6a8c | Rust | 1,562 | 40 | use dbt_common::{
ErrorCode, FsError,
io_args::StaticAnalysisKind,
static_analysis::{StaticAnalysisDeprecationOrigin, check_deprecated_static_analysis_kind},
tracing::dbt_emit::emit_warn_log_from_fs_error,
};
use dbt_schemas::schemas::project::ResolvedConfig;
/// Warns when a node config has `static_an... |
701b6c797ba1616926692072911eb953a620d1bbf70a7bcb2aec1ed47df30284 | Rust | 1,563 | 54 | use itertools::Itertools;
const HASH_SIZE: usize = 16;
const VERSION_SIZE: usize = 17;
pub fn strip_version_hash(
table_name: &str,
version: &Option<String>,
hash: &Option<String>,
) -> String {
if let Some(version) = version {
let suffix = if let Some(hash) = hash {
format!("_{ver... |
e19b3d343ff725065df225f089117b7eab131ed101c3d3ae8937d81c15761110 | Rust | 1,576 | 38 | //! Replicate a BAM N times into a larger BAM for align-mode timing benchmarks.
//! Each copy's records stay contiguous, so per-fragment name grouping (by
//! adjacency) is preserved — copies are simply counted as additional fragments.
//!
//! Usage: replicate_bam <in.bam> <out.bam> <n>
use noodles_bam as bam;
use noo... |
84e5e247c7fb9ac9f049a4b23a80e1ad7da94f8f0ac5b9aebe3d6853920b6c64 | Rust | 1,586 | 52 | use std::{io::Write, path::Path};
use dbt_telemetry::{ArtifactType, ArtifactWritten};
use serde::Serialize;
use crate::{ErrorCode, FsError, FsResult, create_info_span, stdfs};
/// Writes a JSON artifact file and emits a standard `ArtifactWritten` telemetry span.
///
/// `manifest.json` is streamed directly to avoid ... |
6351934fd209b5058f66a8f65418cfac6ebeddd06cf648dc909034cc638090f4 | Rust | 1,588 | 41 | //! Metadata SDK for the dbt platform.
//!
//! Resolves cached dbt authentication (via [`dbt_platform_auth`]) and exposes
//! higher-level operations scoped to an account: identity ([`PlatformClient::whoami`]),
//! projects ([`PlatformClient::list_projects`]), and catalog exploration through
//! the Discovery GraphQL A... |
eea9ddaa509b784e703d82450fa958c5810fa37fedaa90476e9b54331ccc81d1 | Rust | 1,589 | 46 | use std::io::Write;
use dbt_telemetry::QueryExecuted;
use dbt_tracing::{SpanStartInfo, TelemetryRecordRef};
use super::super::formatters::query_log::format_query_log;
use dbt_tracing::{
background_writer::BackgroundWriter,
filter::{TelemetryFilterFn, disable_all_logs},
layer::{ConsumerLayer, TelemetryCons... |
c506d2d2d14c93a7e41cef1a9bf4766e621f58d7daa481850d0bd5faaecf7523 | Rust | 1,591 | 40 | //! Databricks-specific helpers for the ADBC engine (`super::adbc`).
use dbt_schemas::schemas::AdapterAttr;
use minijinja::State;
use serde::Deserialize;
/// Node-agnostic probe for `__adapter_attr__` (matches v1's
/// `config.get("databricks_compute")`); models/snapshots/data tests all
/// carry this. TODO: seeds do... |
717a1261f8536b38c76763e4bc646df9b29d2861c5ac46da838f1b7e24158a02 | Rust | 1,625 | 51 | //! Utilities for testing `impl Object` blocks of things across the codebase.
use minijinja::{
value::{Object, Value},
Environment,
};
use regex::Regex;
use std::collections::HashMap;
use std::sync::LazyLock;
/// Relax a jinja string for comparison by normalizing identation and trimming
pub fn relax_string_fo... |
14a44195300dd237d67e560768f543e5a4fee0807901d488edea8fb549e80c30 | Rust | 1,636 | 58 | use std::fmt;
use std::path::Path;
#[derive(Debug)]
pub(crate) struct RecordReplayError(pub String);
impl fmt::Display for RecordReplayError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}
impl std::error::Error for RecordReplayError {}
impl From<std::io::Err... |
9188cbc31fdc5ea24b434ebc21ff7a604de17fae7e9de7ba235a0f4fe3ddfb22 | Rust | 1,641 | 36 | //! Access to reference sequences for alignment validation.
//!
//! The mapper needs the forward-strand bytes of a reference to align a read
//! against. piscem's index does not retain reference sequences, so they are
//! supplied through this trait (salmon-index persists and serves them). Keeping
//! it a trait decoup... |
d746d3b1684197702dd5716cb02fc083d928cf8befea4db6cb62a3dc0cf19c06 | Rust | 1,678 | 46 | /// Utilities for inferring model primary keys from constraints and tests
pub(crate) mod primary_key_inference;
/// Functions for resolving analyses
pub mod resolve_analyses;
/// Functions for resolving checks
pub mod resolve_checks;
/// Functions for resolving exposures
pub(crate) mod resolve_exposures;
/// Functions ... |
8ae58bb57831ba6ecf19be7671bdb6c4c2a5035961a62e3642525ff8aa1f9d8d | Rust | 1,686 | 66 | use std::collections::HashSet;
use std::sync::{Arc, Mutex};
use minijinja::value::{Enumerator, Object, Value};
use minijinja::{context, Environment};
#[derive(Debug)]
struct TrackedContext {
enclosed: Value,
resolved: Arc<Mutex<HashSet<String>>>,
}
impl Object for TrackedContext {
fn get_value(self: &Arc... |
9d5e3a4f2b7d1e1fe73e37f93f30a345520459c35597f063f48dbb8ea4348dfd | Rust | 1,699 | 39 | //! `Object` impls used as values in typed-ctx structs.
//!
//! These move here progressively from `dbt-jinja-utils` so the typed-ctx
//! structs can hold concrete `JinjaObject<T>` slots instead of opaque
//! `MinijinjaValue`. Each move is gated on the type being expressible
//! without depending on `dbt-common` / `dbt... |
b95d290368176b51be0e9a81cbfda980be9f0488a99313114f7d9bfc580746a2 | Rust | 1,702 | 62 | use std::path::PathBuf;
use std::sync::Arc;
use std::time::Duration;
use tokio::sync::oneshot;
use super::serve_with_shutdown;
use crate::DocsServeArgs;
use crate::providers::Providers;
use crate::state::AppState;
fn test_args() -> Arc<DocsServeArgs> {
Arc::new(DocsServeArgs {
target_path: None,
... |
872131f857d08705478080f14f28c3ffa4231936e4db5d85d43bb650acae8476 | Rust | 1,704 | 53 | use super::super::{
dbt_metrics::{FusionMetricKey, InvocationMetricKey},
emit::{create_root_info_span, emit_warn_event},
layer::{ConsumerLayer, MiddlewareLayer},
metrics::get_metric,
middlewares::metric_aggregator::TelemetryMetricAggregator,
};
use crate::tracing::dbt_init::create_tracing_subcriber_... |
41a5b6e8148d638c1a74bbc3339ff6203151325301d6d044124696fbfd5b96c8 | Rust | 1,712 | 57 | use std::sync::Arc;
use error::CodeLocationWithFile;
use crate::{
constants::{FAILED, PASSED, REUSED, SKIPPED, SUCCEEDED, WARNED},
io_utils::StatusReporter,
stats::NodeStatus,
};
fn status_action(node_status: &NodeStatus) -> &'static str {
match node_status {
NodeStatus::Succeeded => SUCCEEDE... |
572202bd7c14af6d77843d8c502ccda604a7ef6df64332d658b3365ca0f82cce | Rust | 1,725 | 50 | //! [`LoadCtx`]: the env globals registered on the **load** `JinjaEnv`.
use std::collections::BTreeMap;
use chrono::DateTime;
use chrono_tz::Tz;
use minijinja::Value as MinijinjaValue;
use minijinja_contrib::modules::py_datetime::datetime::PyDateTime;
use minijinja_contrib::modules::pytz::PytzTimezone;
use schemars::... |
13dd5937f1cbe9fb3e29a843611faff25964812bbeb12a2e7a748bd484186053 | Rust | 1,727 | 42 | //! Vectorised (whole-layer, matrix-multiply) update kernels, mirroring
//! `pyhgf/updates/vectorised/` file for file: one submodule per node kind
//! (`volatile`, `binary`, `categorical`), each with its `prediction`,
//! `prediction_error`, and (for volatile) `posterior` kernels, plus the
//! rank-one weight-gradient ... |
7f2926ac68dfaeda4e6643d2ca120ad970435852e9128f4e3852e9c53a13e62b | Rust | 1,729 | 65 | //! A builder for [`Driver`]
//!
//!
use super::LoadStrategy;
use crate::{Backend, Driver, driver::AdbcDriver};
#[allow(unused_imports)]
use adbc_core::{
error::{Error, Result, Status},
options::AdbcVersion,
};
/// A builder for [`Driver`].
#[derive(Clone, Debug)]
pub struct Builder {
/// The backend targ... |
3664f627fa11322822007210c6a04a8f61f44619332f9217f8604abd56211634 | Rust | 1,730 | 58 | #![cfg(feature = "loader")]
use minijinja::Environment;
use similar_asserts::assert_eq;
fn create_env() -> Environment<'static> {
let mut env = Environment::new();
let template = String::from("Hello World!");
env.add_template_owned("hello", template, None).unwrap();
env
}
#[test]
fn test_basic() {
... |
1a9e67ac0c5c963c2b716dc56559d4638dee41e8d719a942fde55169821dcbbf | Rust | 1,740 | 42 | //! Shared error type for the salmon crates.
//!
//! Rust has no exceptions: a function that can fail returns a `Result`, which is
//! either `Ok(value)` or `Err(error)`, and the caller must deal with both. This
//! module defines the error side of that for the core crates.
use thiserror::Error;
/// Errors surfaced b... |
536b57c4c7757a21e700d388f3dd085ecb9111a43898cdfacd168adef2ee2bf7 | Rust | 1,740 | 56 | use std::collections::BTreeMap;
use std::env;
use std::fs;
use std::sync::Arc;
use std::sync::Mutex;
use minijinja::value::{Object, Value};
use minijinja::Environment;
#[derive(Default, Debug)]
struct Site {
cache: Mutex<BTreeMap<String, Value>>,
}
impl Object for Site {
/// This loads a file on attribute ac... |
81fefc2b00a3013d51615bc18a20850d117ea56e1285c4864d49c3c7ac60afff | Rust | 1,741 | 60 | use clap::{Parser, Subcommand};
use dbt_ci::{
BumpCargoVersionArgs, HomebrewPublishArgs, HomebrewRenderArgs, PackArgs, PypiPublishArgs,
};
use std::process::ExitCode;
#[derive(Parser, Debug)]
#[command(
name = "cargo-ci",
bin_name = "cargo ci",
about = "Release-pipeline commands for dbt-fusion",
di... |
09cb840c0482e82df3ae873bed1c09e26d054a2f77f945f39e80f56ab6d6f438 | Rust | 1,759 | 63 | #![deny(missing_docs)]
//! This crate provides utilities for working with Jinja templates in the context of dbt.
/// Module for rendering event listener functionality
pub mod listener;
/// Module for formatting Jinja macro arguments
pub mod jinja_arg_format;
/// Module for serialization/deserialization functionality... |
908c35125b51ed1e58a93dc095947917f662a7a50ae94a320613a7f5ed49f264 | Rust | 1,780 | 45 | //! Column-level downstream-impact feature surface.
//!
//! Multi-hop BFS through `dbt.column_lineage` starting at a specific
//! `(node, column)` pair, walking downstream until the reachable set
//! stops growing. Returns every `(node, column, distance)` triple the
//! source column flows into. Distinct from [`super::... |
46f0b16b365b01e27fdce14a92bf6ee655c56ce76ed1cb8b0d2c484e97f0a9c7 | Rust | 1,787 | 54 | use arrow_schema::Schema;
use dbt_adbc::*;
pub struct NoopConnection;
impl Connection for NoopConnection {
// Unsupported operations return an error rather than panicking so callers can handle it gracefully;
// cancel/commit/rollback are no-ops since this connection never holds transaction state.
fn new_s... |
7c9178f0a88fcfee4b9091320c1194f75db960008899615356b1e284259e29f7 | Rust | 1,814 | 57 | //! Confirmation prompt for actions that run code we did not ship in-process
//! (external install scripts, external package managers). Shared by
//! [`crate::upgrade`] and, in the future, `dbt system doctor`.
use std::io::IsTerminal;
use dbt_common::{ErrorCode, FsResult, fs_err};
/// Whether stdin is a terminal an ... |
40645f0579d52c1ffd36e24d20ce8ac62c1d97cdcaaf5fde5c0d8a0f373af594 | Rust | 1,882 | 60 | use console::Style;
use dbt_telemetry::ProgressMessage;
use dbt_tracing::SeverityNumber;
use super::{
color::{GREEN, PLAIN, RED, YELLOW, maybe_apply_color},
layout::right_align_action,
};
/// Map severity number to corresponding color style.
///
/// Unlike with log messages, progress messages use green for in... |
8b865788006372cc24ea97f9d1ff508c228309c3e365f10d99dbc70346991812 | Rust | 1,889 | 54 | //! Compile-phase `Object` impls — std-only types moved here from
//! `dbt-jinja-utils` so the typed compile-phase ctx structs can hold them
//! via `JinjaObject<T>` rather than opaque `MinijinjaValue`.
//!
//! Currently moved: `DummyConfig`.
//!
//! Pending later PRs (need handle traits to move):
//! * `RefFunction`, ... |
f23e56ca2b9729c3abb72d6c56d04ccd1a211f015c2ee165567db23c7f10eb1a | Rust | 1,889 | 63 | //! The vec-of-rows representation of Agate tables.
//!
//!
use std::sync::Arc;
use arrow::array::RecordBatch;
use arrow_schema::ArrowError;
use minijinja::Value;
use crate::flat_record_batch::FlatRecordBatch;
/// Internal table representation that stores rows as a vector of minijinja values.
#[derive(Debug)]
pub(c... |
4ea822aa213f40766883383b0a2a7002f2195fc88ed713ce3c58f9650f2bbbb5 | Rust | 1,892 | 64 | use criterion::{black_box, criterion_group, criterion_main, Criterion};
use minijinja::machinery::parse;
use minijinja::{context, Environment, State};
fn do_parse() {
parse(
black_box(include_str!("../inputs/all_elements.html")),
"all_elements.html",
Default::default(),
Default::def... |
d9b5afb55b3836c7888e45e8042527485bd07847d7bf5ea7a5de279421c9f838 | Rust | 1,905 | 44 | // Names of Database options for Salesforce Data Cloud ADBC Driver
// Based on the Go implementation at arrow-adbc/go/adbc/driver/salesforce/driver.go
/// Login URL (default: [DEFAULT_LOGIN_URL])
pub const LOGIN_URL: &str = "adbc.salesforce.dc.login_url";
/// Username for authentication
pub const USERNAME: &str = "adb... |
6a6946118f45209d4b48ca9295e03bbbafcadd6a002973886b16afe3730b484d | Rust | 1,919 | 48 | use std::error::Error;
use std::panic;
use std::time::Duration;
use tokio::task::JoinError;
// re-export symbols that used to live here, but are now in dbt-cancel
pub use dbt_base::cancel::{
Cancellable, CancellationToken, CancellationTokenSource, CancelledError, never_cancels,
};
/// The max timeout duration for... |
0830ab676f32e1b96c7d506fd8b8b91a5940de54f00d9f5f9e107378d92546c8 | Rust | 1,947 | 51 | //! Minimal Jinja environment for profile rendering.
//!
//! Implements `env_var` and `var` functions plus base filters via `dbt-jinja-filters`.
//! No dependency on `dbt-jinja-utils` or `dbt-common`.
use std::collections::BTreeMap;
use std::sync::Arc;
use dbt_jinja_vars::Var;
use minijinja::{Environment, Value};
use... |
9d1f3b750afdebffb8563ef58e3ddd52f719624cbd832ff22679599b3c552b9f | Rust | 1,947 | 77 | use std::fmt;
use minijinja::{context, Environment, Error, ErrorKind};
#[derive(Debug)]
struct UserError(String, usize);
impl UserError {
fn code(&self) -> usize {
self.1
}
fn message(&self) -> &str {
&self.0
}
}
impl fmt::Display for UserError {
fn fmt(&self, f: &mut fmt::Forma... |
dae060ed0ff7c02e984638b108d67b473716fa03c2e5319c3837dba8ad120bc3 | Rust | 1,949 | 60 | //! Matrix primitives for the vectorised backend.
//!
//! The backend works directly on [`ndarray`] types: matrix products go through
//! `ndarray`'s `.dot()`, which the default `blas` feature routes through a
//! linked BLAS (`SGEMM`/`DGEMM`); building with `--no-default-features` falls
//! back to the pure-Rust (thre... |
7760aaebd14369e8d7bdf8e80506cd1e08db8fdbec056e15c513493d59ab2e11 | Rust | 1,958 | 47 | //! Mate/fragment status, mirroring pufferfish's `util::MateStatus`.
//!
//! # Background: mates and fragments
//!
//! In paired-end sequencing one physical DNA *fragment* is read from both ends,
//! producing two reads called *mates*. Ideally both mates place consistently on
//! the same transcript ("proper pair"), wh... |
100d1b5774bc2f95cf2055ca1cb5c046c23b8ac5589c246d94ee9fbab87cc676 | Rust | 1,963 | 55 | //! Utility types and functions used across the fusion workspace.
//!
//! **NOTE**: The purpose of this crate is to sit at the very root of the fusion
//! dependency graph, so it can be pulled in by any other fusion crate. To this
//! end, it
//! - MUST NOT depend on any other fusion crates!
//! - MUST NOT have any e... |
2a61edacb46e89a557d49a67d68e44a44e133a0c3e30a726325f3bc89b372433 | Rust | 1,963 | 58 | use crate::column::Column;
/// Keep only the leading column names from a Spark `describe extended` result,
/// discarding all columns from a separator column name (empty string or starts
/// with `#`)
///
/// Mirrors dbt-core's `SparkAdapter.parse_describe_extended` from dbt-adapters/dbt-spark
pub(crate) fn truncate_a... |
c7043bddd513669beef8ca286f618678b8d96a7711e67e7dcc8f403ab810be06 | Rust | 1,965 | 58 | use dbt_common::{ErrorCode, FsResult, fs_err};
use std::future::Future;
use tracing::Instrument as _;
/// Parallelism budget for the parse phase.
///
/// Parse is CPU-bound and does not touch the warehouse, so it must NOT be
/// throttled by the profile's `threads` setting — that knob is exclusively the
/// adapter co... |
e7b66a4ab05496137e546b3fdbe338e043e4feb0d3a8612b39a2f141f210dd9b | Rust | 1,988 | 55 | //! Resolver is a crate for resolving a dbt project. It is responsible
//! for resolving all project source files (i.e. models, seeds, tests, macros etc.)
//! and propagating all configuration properties.
//!
//! The result of resolution is a "parse" phase `manifest.json`, whereby
//! "parse" is used to describe the pr... |
65e53d7e9a20eb778b77f10692b5796934b18a00b8538eabbfcc9ee5fea67d28 | Rust | 1,996 | 64 | //! Typed context used to render documentation fields.
//!
//! The field names are `REQUIRED_DOCS_KEYS` in dbt-core `tests/unit/context/test_context.py`.
use minijinja::Value as MinijinjaValue;
use serde::Serialize;
/// The context dbt Core renders documentation fields with.
#[derive(Debug, Clone, Serialize)]
pub str... |
0f225f68b674c0dd1ad8fa164e2ccddbd307e2a68c6d87132f1653065f9399d1 | Rust | 2,022 | 61 | use serde::{Deserialize, Serialize};
use crate::compiler::tokens::Span;
/// Source-side Jinja layout facts used by downstream lint/format passes.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct JinjaLayoutEvents {
/// Events in source order.
pub items: Vec<JinjaLayoutEvent>,
}
impl JinjaL... |
ab595bb9e98265762ae434342b32abe3c3671bb77513b596f74f6cdf3ac32b15 | Rust | 2,029 | 54 | //! This module contains the logic for rendering secrets in the dbt project.
use dbt_common::{ErrorCode, FsResult, fs_err};
use minijinja::State;
use regex::Regex;
use crate::env_var;
use crate::functions::SECRET_PLACEHOLDER;
use crate::utils::SECRET_ENV_VAR_PREFIX;
/// Prefix which identifies environment variables ... |
9b88da5d6e52fafc40c3eabe0fa44f92c62bf41815d2a2a89b82ecfa0de08abf | Rust | 2,035 | 54 | //! Formatter for test results.
//!
//! This module provides formatters for test failure messages with optional
//! color formatting.
use crate::pretty_string::RED;
use dbt_telemetry::node_processed::NodeOutcomeDetail;
use dbt_telemetry::{NodeProcessed, TestOutcome};
use super::color::maybe_apply_color;
/// Format a... |
97d9b46c6f3c9e7885f960794c8e41a0e1b2ca83629a0621bc7eb916b027c5f9 | Rust | 2,082 | 53 | #![allow(clippy::disallowed_methods)] // RustEmbed generates calls to std::path::Path::canonicalize
use std::borrow::Cow;
use axum::{
http::{StatusCode, Uri},
response::{IntoResponse, Response},
};
use rust_embed::RustEmbed;
use crate::assets::{asset_response, is_navigation_path, normalize_path, not_found};
... |
3a304810630d503b8754d2a16fd7298cb05156d1884ec944ac2a0145315868df | Rust | 2,091 | 69 | //! Handler for the `dbt internal get-distribution-info` plumbing command.
use std::path::Path;
use dbt_common::tracing::dbt_emit::println;
use dbt_common::{ErrorCode, FsResult, fs_err};
use crate::DistInfoDiscovery;
/// Prints distribution info as JSON, per the `path`/`all` flags:
/// - `all`: info for every dbt f... |
04109ef02507ec003f7ff8c4813483a1b4464c5c6918e35c71ef52df201ee6a2 | Rust | 2,108 | 73 | use std::collections::BTreeMap;
use std::sync::{Arc, Mutex};
use crate::value::{Enumerator, Object, Value};
/// Closure cycle breaker utility.
///
/// The closure tracker is a crude way to forcefully break the cycles
/// caused by closures on teardown of the state. Whenever a closure is
/// exposed to the engine it'... |
5f968a597e068453ad3a4f4a0efad3fcca552b5d546e27ee0c044500e7d4af3f | Rust | 2,121 | 52 | /// Errors that can occur during credential resolution.
#[derive(Debug, thiserror::Error)]
pub enum AuthError {
#[error("not authenticated: no credentials found")]
NotAuthenticated,
#[error("authentication expired")]
AuthenticationExpired,
/// The credential source (file, socket, etc.) could not b... |
739ecb9e6eb44a3fe329fbaa8b9bb7c6db6f4a1f2707590f95c72010e87031e4 | Rust | 2,124 | 51 | //! Why does reusing the sketch MappingCache (vs allocating one per read) not
//! change wall time? Measure the cost of `MappingCache::new` (alloc+free of an
//! AHashMap cap-256 + Vec cap-64) vs `clear()` (reuse), under whichever global
//! allocator the binary is built with. Run with the default (mimalloc) and with
/... |
b389a9194c54d3fe19fea6b9103e29c55f121186afcbc00b33d90cb0c23c6ea6 | Rust | 2,157 | 64 | //! Epoch-append parquet layers for dbt-index.
use std::path::{Path, PathBuf};
/// Epoch file-name prefix. `pub` because the generated epoch views glob on it
/// (`info_schema::epoch_views`), and a mismatch there would silently read no
/// files rather than fail.
pub const SCHEMA_VERSION: &str = "v1";
/// File name ... |
b8b9df26270a12590ab54453f8b0a6bc1e76a30b916ec6688552818b2fe417d5 | Rust | 2,164 | 56 | pub(crate) mod components;
pub(crate) mod relation_types;
#[cfg(test)]
pub(crate) mod test_helpers;
use dbt_agate::AgateTable;
use indexmap::IndexMap;
// TODO: delete this and make it use RecordBatches instead
#[derive(Debug, Eq, PartialEq, Hash)]
pub(crate) enum DatabricksRelationMetadataKey {
InfoSchemaViews,
... |
5c9ce9c45abbbbeab904703bfaac87966074588368c619c511727caa16d644ea | Rust | 2,181 | 64 | use dbt_cloud_api::apis::{projects_api, whoami_api};
use dbt_cloud_api::models::{ProjectResponse, WhoamiResponse};
use crate::client::PlatformClient;
use crate::error::Result;
/// The maximum page size accepted by the dbt Cloud Admin API list endpoints.
const MAX_PAGE_SIZE: i32 = 100;
impl PlatformClient {
/// F... |
3d40b3465437fcc245fb777da095e88fa64bce4dede5eb229506bcc0e4464a22 | Rust | 2,185 | 61 | use serde::{Deserialize, Serialize};
use crate::error::CodeLocation;
/// A recorded `{{ reclassify(expr, 'from', 'to') }}` call: the byte offsets of
/// the (warehouse-safe) inner expression in the rendered SQL, plus the label
/// mutation. Produced during rendering and matched against bound expression
/// spans by t... |
d4a704f4455f1fac2601f8e5cb77e52b4e1c1c024e16a0bc33f7f7bce0ce1e6f | Rust | 2,198 | 45 | /// Default content for `doc.dbt.__overview__`, mirroring dbt Core's bundled
/// `dbt/include/global_project/docs/overview.md`. dbt Core always injects
/// this entry via its internal global project; Fusion uses this constant as a
/// fallback when the user project (and its dependencies) don't define their own
/// `{%... |
d7b10479733e204cf517334d90d2edb3f23c0c5cb1ffa6b7890d73cf53c8976a | Rust | 2,207 | 81 | #![allow(clippy::let_unit_value)]
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use minijinja::value::{from_args, Enumerator, Object, ObjectRepr, Value};
use minijinja::{Environment, Error, State};
#[derive(Debug)]
struct Cycler {
values: Vec<Value>,
idx: AtomicUsize,
}
impl Object for ... |
0e282142651e386d1e71133d525264a9a77907284a7905fac0d319241aa3e934 | Rust | 2,247 | 93 | use dbt_scheduler::node_selector::ColId;
use std::fmt;
/// Flat CLL edge
#[derive(Debug, Clone)]
pub struct CllEdge {
pub from_node: String,
pub from_col: String,
pub to_node: String,
pub to_col: Option<String>,
pub op: &'static str,
}
impl CllEdge {
/// `to_col` treats an empty string as `Non... |
7d60be4b1b9cd867c807611fd0cb1e8479ca309ca6ed205ca26ce7e34858c627 | Rust | 2,255 | 69 | use crate::compiler::instructions::Instruction;
use crate::error::{Error, ErrorKind};
use std::sync::atomic::{AtomicIsize, Ordering};
use std::sync::Arc;
/// Helper for tracking fuel consumption
pub struct FuelTracker {
// The initial fuel level.
initial: u64,
// This should be an AtomicI64 but sadly 32bi... |
0432329aa7856a6d1fcdeeb9a72d9de52dbefc6b6cfbb5505e618c1d83ffae0f | Rust | 2,268 | 54 | // Option key constants for the Athena ADBC driver (`adbc_driver_athena`).
//
// Unlike the Apache Arrow ADBC drivers (Snowflake, BigQuery, Salesforce) which use an
// `adbc.<driver>.sql.*` prefix, the Athena driver uses a plain `athena.*` prefix.
// Keys sourced from: https://github.com/dbt-labs/athena/blob/main/go/dr... |
9cdc8bd0ed94f59321887b7790326e4d4583b5011aba4c3783c91ca8e6638943 | Rust | 2,268 | 41 | //! Constants for the Minijinja library
/// The name of the global namespace registry
/// the dict of it should be package_name -> [macro_name, macro_name, ...]
pub const MACRO_NAMESPACE_REGISTRY: &str = "MACRO_NAMESPACE_REGISTRY";
/// The name of the root project namespace
pub const ROOT_PROJECT_NAMESPACE: &str = "RO... |
d2c7d89ae81b2b9a795385290f6beeaba0f6cca0989fafa4dc5dc056d37bbbd3 | Rust | 2,281 | 68 | #![cfg(feature = "unstable_machinery")]
use minijinja::compiler::codegen::CodeGenerationProfile;
use minijinja::machinery::{CodeGenerator, Instruction, Span};
use minijinja::value::Value;
#[test]
fn test_for_loop() {
let mut c = CodeGenerator::new("<unknown>", "", CodeGenerationProfile::Render);
c.add(Instruct... |
7edb61bd23f9dbf6daf0660550df1b5448dd809539e158f87c5374a1e91360eb | Rust | 2,285 | 65 | use std::collections::BTreeMap;
use dbt_common::{ErrorCode, FsResult, err, fs_err};
use dbt_jinja_utils::jinja_environment::JinjaEnv;
use dbt_schemas::schemas::project::QueryComment;
pub fn resolve_query_comment(
query_comment: &QueryComment,
jinja_env: &JinjaEnv,
base_ctx: &BTreeMap<String, minijinja::Va... |
2ffb41450d1fe7b8010851a33689655f2919ebe38d4a3c4ce86f5e240b24491c | Rust | 2,292 | 68 | use crate::tracing::dbt_init::create_tracing_subcriber_with_layer;
use crate::{
io_args::EvalArgs,
tracing::{
emit::{create_root_info_span, emit_info_event},
invocation::create_invocation_attributes,
layers::file_log_layer::build_file_log_layer_with_background_writer,
},
};
use dbt_t... |
2de8df1f11a01a1dd8439448806f0e889269f4ebba6e79c1ddafb8aa70a64daa | Rust | 2,320 | 83 | use std::collections::HashSet;
use std::sync::{Arc, Mutex};
use minijinja::value::{Enumerator, Object, Value};
use minijinja::{context, Environment};
#[derive(Debug)]
struct TrackedContext {
enclosed: Value,
undefined: Arc<Mutex<HashSet<String>>>,
}
impl Object for TrackedContext {
fn get_value(self: &Ar... |
3ecb06878d4907a33a458b182db75eb1b8659c279edbf569e0d68f661cbb0187 | Rust | 2,321 | 48 | use dbt_common::FsResult;
use dbt_jinja_vars::DbtVars;
use indexmap::IndexMap;
// Load vars
// If no vars have been set, this is the root package and we need to set the global vars
// It's required that we push the "true" global vars to the vars vector, because these have
// not been expanded to consider the local pac... |
2f0549de5cd33dcf4cdef16be6e07b52830fcd60298e11a5331ac4561ea0ab61 | Rust | 2,327 | 76 | use std::collections::HashSet;
use std::sync::Arc;
use dbt_common::io_utils::YML_EXT;
use dbt_common::node_selector::IndirectSelection;
use dbt_common::path::DbtPath;
use dbt_schemas::state::CacheState;
#[derive(Debug)]
pub struct DbtCustomScheduleDescription {
pub unique_ids: Vec<String>,
pub include_parents... |
b57c72f22e885e639a91db051ec235c80201d3b4638536a5ca07dda421b3a749 | Rust | 2,334 | 57 | //! Coarse per-phase wall-clock timing for profiling.
//!
//! A [`PhaseTimer`] logs the elapsed time of each phase on the dedicated
//! `salmon::timing` tracing target, so a breakdown (mapping/RAD-read vs.
//! inference vs. posterior vs. output) is available inline at the default
//! `info` level, or in isolation via `... |
41b485b2ca0fe09ee8440b4a7ae7a1ecfd8ea5977076e0d5a2c734fc34179552 | Rust | 2,345 | 60 | // Demonstrates the interactive OAuth login flow that `dbt login` performs.
//
// Builds an OAuthInteractiveResolver directly, wires up a Ctrl-C abort handle
// so the user can cancel mid-flow, then calls resolve(). On success the session
// is automatically written to ~/.dbt/oauth_sessions.json and the credential is
/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.