sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
be0a1a476e0448d92058062d963784f3d8eb9a7225a4635fed653d348b160b54 | Rust | 7,076 | 271 | use std::iter::Peekable;
use std::str::CharIndices;
#[derive(Debug, PartialEq, Eq)]
pub(crate) enum Token<'a> {
/// `(`
LParen,
/// `)`
RParen,
/// `,`
Comma,
/// `+`
Plus,
/// `-`
Minus,
/// `<`
Lt,
/// `<=`
Lte,
/// `>`
Gt,
/// `>=`
Gte,
///... |
fa980442a0fd4061e73a02790366badca507b6574702118bd49971e2d2ea02da | Rust | 7,082 | 199 | //! The requant writer's output contract (#1140): decoy references stay out of
//! `quant.sf` and the files positionally aligned with it, and `meta_info.json`
//! reports what the run actually did (`samp_type`, `serialized_eq_classes`,
//! `num_decoy_fragments`) instead of hardcoded placeholders.
//!
//! A reads-mode R... |
8cc2e543cacae2c9e379abd6849ce0809f876ab243c44c44243dc4dfe8fa3bb0 | Rust | 7,174 | 211 | use std::collections::BTreeMap;
use std::sync::Arc;
use dbt_adapter::relation::RelationObject;
use dbt_adapter_core::AdapterType;
use dbt_jinja_utils::flags::Flags;
use dbt_jinja_utils::mock_object::MockJinjaObject;
use dbt_schemas::dbt_types::RelationType;
use minijinja::Value;
use crate::macro_test_harness::MacroTe... |
2d243f91b7bf92fd145356d93293745db050099d39375762a6a8bfc5f762f921 | Rust | 7,228 | 225 | //! Locates installed `dbt` executables and classifies the stdout of a
//! `dbt --version` invocation into a distribution and generation. Kept as its
//! own crate, independent of `dbt-dist`'s `dbt-common` dependency, so
//! lightweight consumers (e.g. `dbt-index`, or `wizard/dbt-codex`) can find a
//! `dbt` binary and... |
0447e2b863cf9e45fbc8eb13b56baee686e92af9d340e8dd77cbbe9906908ec5 | Rust | 7,255 | 183 | //! Testing utilities for Snowflake relation configs
#![cfg(test)]
use arrow_array::record_batch;
use dbt_schemas::schemas::{
AdapterAttr, CommonAttributes, DbtModel, NodeBaseAttributes,
common::{ClusterConfig, DbtMaterialization},
project::{ModelConfig, WarehouseSpecificNodeConfig},
};
use dbt_yaml::Spann... |
0996d3a653a12a836c3d88e563426ea6ee674ed867830f7883c69c26876d32a0 | Rust | 7,286 | 245 | use std::ffi::{c_char, CString};
use std::ptr;
use minijinja::syntax::SyntaxConfig;
use minijinja::{Environment, Error, ErrorKind, UndefinedBehavior};
use crate::mj_value;
/// Pointer to a MiniJinja environment.
pub struct mj_env(pub(crate) Environment<'static>);
ffi_fn! {
/// Allocates a new and empty MiniJinj... |
2fe4d2f5b47cdc0df82a131a3f7cecea2f54aa3c059edf8d1d93fa1e12ee5c2d | Rust | 7,338 | 218 | use std::borrow::Cow;
use dbt_adbc::{Backend, database};
use crate::{Auth, AuthError};
pub use dbt_yaml::Value as YmlValue;
// TODO(felipecrv): move this struct for generic use as it now has nothing specific to adapters
#[derive(Clone, Debug, Default)]
pub struct AdapterConfig {
repr: dbt_yaml::Mapping,
}
pub... |
fc4df6fd7b2dbd21081979de2544c6e0427ea69ca8991eff357d94c1203adecf | Rust | 7,346 | 208 | use crate::{ErrorCode, FsResult, fs_err};
/// Splits the input string into words, but treats every {..} as one word
pub fn split_into_whitespace_and_brackets(input: &str) -> Vec<String> {
// Used to prepare programmatic commandline parsing
let mut results = Vec::new();
let input = input.replace('\n', " ");... |
1841f3365c41edb6ee13c08f70b8e0ba25a49cfa3b1ccdb25d6672e769a614ab | Rust | 7,365 | 193 | use crate::publish::Environment;
use clap::Args;
use std::path::PathBuf;
#[derive(Args, Debug)]
pub struct PypiPublishArgs {
/// `staging`, `prod`, or `test-pypi`. Not needed when only building an sdist
/// (`--sdist-out`), which stages a file instead of uploading.
#[arg(long, value_enum, required_unless_p... |
a597a41ba8128d856f9ef1726c50b12fd153d6433a9ef20d4e920c569cd2ca8d | Rust | 7,384 | 209 | use std::fs;
use std::path::{Path, PathBuf};
use arrow_array::{Decimal128Array, Float64Array, Int32Array, Int64Array, RecordBatch};
use dbt_adbc::{Backend, Connection, Database, database, driver};
use dbt_metricflow::{Dialect, InMemoryMetricStore, compile, parse_query_spec};
struct DuckDb {
#[allow(dead_code)]
... |
9096b911fd791ac78194e6e88910d4481ba55ceb47a8f9be9b9f56cfac3a3ceb | Rust | 7,386 | 230 | use super::*;
const APPEND_SQL: &str = "INSERT INTO target SELECT * FROM source";
const DATABRICKS_STRATEGIES_SQL: &str = include_str!(
"../../../../src/dbt_macro_assets/dbt-databricks/macros/materializations/incremental/strategies.sql"
);
fn normalize_sql(sql: &str) -> String {
sql.to_lowercase()
.sp... |
fcfce2402c7c39bc6d3b04889f1737da18de2f5f2cee45d62c560c6005c9deae | Rust | 7,423 | 190 | //! This module contains the SqlFileInfo struct, which is used to collect details about processed sql files.
use dbt_frontend_common::error::CodeLocation;
use dbt_jinja_utils::phases::parse::sql_resource::SqlResource;
use dbt_schemas::schemas::{common::DbtChecksum, project::ResolvableConfig, serde::NodeVersion};
use m... |
0b937a140d730064501e8467b433399446bc7e53b2df2b935cbeb318794a6b54 | Rust | 7,431 | 200 | use crate::{ErrorCode, FsResult, ectx, fs_err};
use crate::error::LiftableResult;
use std::fs::Metadata;
use std::path::{Path, PathBuf};
use std::time::SystemTime;
/// Wrapper around [`std::fs::canonicalize`] that returns a useful error in case of failure.
pub fn canonicalize<P: AsRef<Path>>(path: P) -> FsResult<Path... |
393b4f5238df3006d5b685cb3d7e7a807da2ace6c2686c495b7c2a5acc6bec1c | Rust | 7,446 | 225 | //! Trait and registry for time machine serialization of Object types.
//!
//! # Adding a New Serializable Type
//!
//! 1. Implement `TimeMachineSerializable` for your type
//! 2. Register it in `build_registry()`
//! 3. Add the downcast check in `serialize_object()`
use std::collections::HashMap;
use std::sync::OnceL... |
54789a63ca96b1b4388210901c39636b04e65e135a595422bd5e3fd737a2952d | Rust | 7,468 | 121 | /*
* dbt Cloud API v3
*
* # How to use this API The dbt Cloud API v3 contains endpoints for programmatic administration of your dbt Cloud account. With it, you can replicate resources across projects, accounts, and environments, or standardize project creation for business teams. For endpoints related to jobs and r... |
eecfa8a60cc88e78d6bcf6ebf09b24773e0ab70e29ef22cfdf6949618f919f8d | Rust | 7,487 | 193 | //! Pins the DDL-portability invariant from fs#13788: the generated view DDL
//! must behave identically on both DuckDB builds we ship against — the
//! extended driver (ADBC path: docs, MCP, wizard) and the vanilla driver
//! (the checks adapter). The whole shared-statements design rests on this
//! seam, so it is ass... |
927b7278ef48aada006c8da885ad463f35d4c0748970d90f4b0dc188c31ff0af | Rust | 7,496 | 217 | use crate::{CodeLocationWithFile, fs_err};
use dbt_error::ErrorCode;
use dbt_tracing::{SeverityNumber, TelemetryOutputFlags};
use std::panic::Location;
use crate::tracing::dbt_init::create_tracing_subcriber_with_layer;
use crate::tracing::{
dbt_emit::{emit_error_log_from_fs_error, emit_error_log_message, emit_warn... |
8f723a54f050fe06e49dff4307773cad5290576f67b3fda015e40bacc460bdc7 | Rust | 7,504 | 195 | //! Append-only parquet for warehouse catalog stats records.
//!
//! Files land at:
//! ```text
//! target/
//! metadata/run/catalog_stats/v1_{N}.parquet ← append-only, one row per node per invocation
//! ```
//!
//! ## Design
//! * **Append-only** — each invocation appends a new file with one row per node that
//!... |
1c0d3bc62ce1d8afbadd9380635b5891ebd2ac9469fc6d1ffd93b4be2775bf09 | Rust | 7,552 | 188 | use adbc_core::error::{Error as AdbcError, Result as AdbcResult, Status as AdbcStatus};
use regex::Regex;
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
use std::path::Path;
use crate::COUNTERS;
pub fn cleanup_schema_name(input: &str) -> String {
let re = Regex::new(r"___.*?___").un... |
a18ed9f817d710ef723c828f6a4f8c0938b28dc16d1419b32fdf03dcdb334810 | Rust | 7,565 | 214 | //! Testing utilities for databricks relation configs
use crate::AdapterType;
use crate::relation::databricks::config::DatabricksRelationMetadata;
use crate::relation::test_helpers;
use arrow::csv::ReaderBuilder;
use arrow_schema::{DataType, Field, Schema};
use dbt_agate::AgateTable;
use dbt_schemas::schemas::dbt_colum... |
ace90e2820e72b1be5bd39c69523ed69c151462cbd0929f1dc56d607cb77d662 | Rust | 7,594 | 200 | use crate::AdapterEngine;
use crate::adapter::adapter_impl::AdapterImpl;
use crate::{AdapterResult, errors::AsyncAdapterResult, metadata::*, record_batch::RecordBatchExt};
use arrow_schema::Schema;
use dbt_common::cancellation::CancellationToken;
use arrow_array::{Array, Decimal128Array, RecordBatch, StringArray};
us... |
072bb757f824725d1c7340c86b3731fb7fe9c5b1bc8e0914da5fbbe6c3ce718e | Rust | 7,633 | 224 | //! `--dumpEq` has to describe the classes the run actually used, in every mode.
//!
//! Under `--deterministic` it did not: the mapping pass wrote the file before any
//! class existed, declaring zero of them, and the quantification pass never
//! replaced it (COMBINE-lab/salmon#1140). A well-formed file saying "0 cla... |
6172237b56823448f5eeef675e51d70a906e773474aebff07a306f50b31f3f2c | Rust | 7,633 | 207 | //! `salmon quantmerge`: merge one column across several samples' `quant.sf`
//! (or `quant.genes.sf`) into a single target × sample matrix TSV.
//!
//! # What this is for
//!
//! A salmon run produces one `quant.sf` per sample. Almost every downstream
//! analysis (differential expression, clustering, plotting) instea... |
0289fddf21b88f7c31ecf84d2b66a2038bc53425665aa104dff3232b34a1372c | Rust | 7,650 | 181 | use std::sync::Arc;
use arrow::compute::{CastOptions, cast_with_options, concat_batches};
use arrow::util::display::FormatOptions;
use arrow_array::{ArrayRef, RecordBatch};
use arrow_schema::{ArrowError, DataType, Field, Schema, SchemaRef};
use dbt_common::{AdapterError, AdapterErrorKind, AdapterResult};
use crate::e... |
2e9cb01cc680713778c74bf8c61ef87dcad376b5ff0c6fbacf14ac532da1aace | Rust | 7,651 | 195 | use dbt_common::{AdapterError, AdapterResult};
use dbt_schemas::schemas::{DbtModel, InternalDbtNodeAttributes};
use minijinja::Value;
use super::non_blank;
use crate::relation::config_v2::{
ComponentConfig, ComponentConfigLoader, SimpleComponentConfigImpl, impl_loader,
};
use crate::relation::snowflake::config::{
... |
875c2ccc87d14d30887ee54ab847903abc1736406045ae3aef3c7c41f412c5ba | Rust | 7,653 | 213 | //! https://github.com/databricks/dbt-databricks/blob/main/dbt/adapters/databricks/relation_configs/liquid_clustering.py
use dbt_schemas::schemas::DbtModel;
use dbt_schemas::schemas::InternalDbtNodeAttributes;
use minijinja::Value;
use serde::Serialize;
use crate::errors::AdapterResult;
use crate::relation::config_v2... |
b6a33ee8a6c6099087fc674e79d61845385e969117349dc6a4f3db89426a68e8 | Rust | 7,659 | 225 | use minijinja::Value;
use minijinja::value::Object;
use std::collections::HashMap;
use std::ops::Deref;
use std::sync::{Mutex, MutexGuard};
type HandlerFn = Box<dyn Fn(&[Value]) -> Result<Value, minijinja::Error> + Send + Sync>;
/// A recorded `call_method` invocation on a Jinja object.
#[derive(Debug, Clone)]
/// A ... |
9f8a6109aad5d7335b2206ec8f3746aec22698edae3a8087e655ee13f38060b5 | Rust | 7,674 | 191 | //! Tests covering `ResolveModelCtx` end-to-end:
//!
//! 1. The typed ctx serializes to exactly the same key set today's
//! `build_resolve_model_context<T>` BTreeMap produces — 17 keys including
//! the underscore-decorated `TARGET_UNIQUE_ID` /
//! `__minijinja_current_path` / `__minijinja_current_span` const... |
7579d0bc470dc9c1e3ddb300fb9a7dd39124df00f355515f264a5628ed49ac7a | Rust | 7,696 | 213 | use insta::assert_snapshot;
use minijinja::{render, Environment};
use minijinja_contrib::globals::{create_dict_namespace, cycler, joiner};
#[test]
fn test_cycler() {
let mut env = Environment::new();
env.add_function("cycler", cycler);
assert_snapshot!(render!(in env, r"{% set c = cycler(1, 2) -%}
next():... |
1928e5a2ef43cc971489800be466a8b945a47fe15c931a2ae4c244b0c842c5c2 | Rust | 7,699 | 256 | use std::fmt::Display;
use int_enum::IntEnum;
/// Error codes for the SDF Frontend.
///
/// Each error code is a 3-digit number in the range [100, 999], stored as a u16
/// type.
#[repr(u16)]
#[non_exhaustive]
#[derive(Debug, Copy, Clone, Eq, PartialEq, IntEnum)]
pub enum ErrorCode {
SyntaxInvalid = 101,
SqlS... |
ad320a9e4986ff898e3509e7192ba3a24f545dab40dd875b49abe74b87f63158 | Rust | 7,734 | 245 | //! Simple golden file testing for Rust.
//!
//! A fork of `goldie` 0.5.0 that emits mismatches as unified diffs wrapped in
//! `<<<<<<<< BEGIN PATCH` / `>>>>>>>> END PATCH` markers, matching the
//! integration-test goldie mechanism in `dbt-test-utils` (see
//! `fs/sa/crates/dbt-test-utils/src/task/goldie.rs` and `tas... |
6896515eae1515e8a040c08b724ea8d989a69892605decd7ca37edd7225afcc6 | Rust | 7,794 | 226 | //! Regressions for the four defects the pre-2.6.0 release-readiness sweep found
//! on `develop` (#1140 follow-up). Three of them were introduced by the audit
//! fixes themselves, which is why each is pinned end to end through the binary
//! rather than at the unit level: every one of them type-checked, passed the
//... |
1dd7373f7ba6cdc2320425c967baa4b9d5a88ca959e1aa4b280f42e9cfab91fd | Rust | 7,800 | 203 | use super::common::{ConfigField, ConfigProcessor, FieldValue, InteractiveSetup};
use dbt_common::FsResult;
use dbt_schemas::schemas::profiles::SnowflakeDbConfig;
use dbt_schemas::schemas::serde::StringOrInteger;
use std::path::PathBuf;
impl InteractiveSetup for SnowflakeDbConfig {
fn get_fields() -> Vec<ConfigFiel... |
510868a689af959a118e748ec6b4356438cb03c2a1b70f76e803eee22b246ddc | Rust | 7,817 | 269 | use std::{fmt, io};
use crate::AgateTable;
pub struct TableDisplay<'a> {
table: &'a AgateTable,
pub max_rows: usize,
pub max_columns: usize,
pub max_column_width: usize,
}
impl<'a> TableDisplay<'a> {
pub fn new(table: &'a AgateTable) -> Self {
Self {
table,
max_row... |
dfffc2075f19a08baa8e76fee1076af0dc9fe7cfb57b635d1f7b9683636ca5d5 | Rust | 7,818 | 287 | #![cfg(all(feature = "datetime", feature = "timezone"))]
use minijinja::context;
use similar_asserts::assert_eq;
use time::format_description::well_known::Iso8601;
#[test]
fn test_datetimeformat() {
let mut env = minijinja::Environment::new();
env.add_global("TIMEZONE", "Europe/Vienna");
env.add_global("D... |
55c9dac27b94fa00aa17a5ebeea62ba259cb72e4fc6fdf74e2ed0d3d86a96227 | Rust | 7,850 | 198 | //! The salmon bulk RAD record and its parsing context.
//!
//! This is the innermost layer of the format: the exact bytes written for one
//! fragment. The per-hit `(compressed_ori_ref, pos, frag_len)` triple is
//! byte-identical to piscem's `bulk_with_pos`; for the selective-alignment
//! profile salmon adds a per-h... |
e984e82a313a425bd78cb9b1809e4468f6899e9863fd9b2bfc16f9e4f4a622b3 | Rust | 7,876 | 197 | //! The `info_schema()` Jinja helper available to project quality checks.
//!
//! A check is SQL over the metadata index, and it runs **at parse time** — before anything is
//! compiled or materialized. So the helper deliberately exposes only views whose every column has
//! its final value by the end of parse. Anythin... |
9014a1caeef2199300c5621caf757dbb746c6064a498985e8d9dad5550c4cf61 | Rust | 7,902 | 208 | use std::sync::LazyLock;
use dbt_telemetry::{DepsAddPackage, DepsAllPackagesInstalled, DepsPackageInstalled, PackageType};
use dbt_tracing::StatusCode;
use super::{
color::{GREEN, RED, maybe_apply_color},
layout::right_align_static_action,
};
pub static INSTALLING_ACTION: LazyLock<String> = LazyLock::new(|| ... |
00f73380a8ede10dda00fd199b6b6858065dfd9608d2136d450b51e94ce10012 | Rust | 7,920 | 161 | use std::collections::{HashMap, HashSet};
use std::path::{Path, PathBuf};
use std::time::{SystemTime, UNIX_EPOCH};
use crate::epoch_layers;
// ---------------------------------------------------------------------------
// Directory layout under target/private/metadata/
// ---------------------------------------------... |
2c9332625a8eb29418a92dd5c463a5299ca983edec2a35fc7ba884714f16fbc3 | Rust | 7,928 | 220 | use crate::{
args::LoadArgs,
dbt_project_yml_loader::{collect_protected_paths, load_project_yml},
load_for_clean,
};
use std::{
collections::{BTreeMap, HashSet},
path::Path,
};
use dbt_common::{
ErrorCode, FsResult,
cancellation::CancellationToken,
constants::{DBT_INDEX_DIR_NAME, DBT_ME... |
3ad0bbd0912df334392fce0022b34ff14c056d2a12102e76fc7e9f05ea94f681 | Rust | 7,930 | 238 | use dbt_adapter_core::AdapterType;
use crate::tokenizer::{Token, Tokenizer};
pub fn clean_sql(sql: &str, adapter_type: AdapterType) -> String {
match adapter_type {
AdapterType::Databricks => {
let sql = sql.trim();
sql.strip_suffix(';').unwrap_or(sql).to_string()
}
... |
9edd729618caa2ac6e998cb5a1dc9eaa6f8999c797f677ad7bfa8d23b4d76fc9 | Rust | 7,941 | 209 | //! DuckDB `COPY` materializer: the information schema as parquet written
//! straight from the epoch-view layer.
//!
//! Replaces the Arrow ingest-and-project path when a DuckDB driver is
//! available. The views already express the public contract over
//! `target/private/metadata/**`; `COPY (SELECT * FROM <view>) TO... |
1537b5c0d707ea1c5adf1eca1abb0c2f2f79c829e8df359250683b2f8789e48c | Rust | 7,953 | 259 | use std::borrow::Cow;
use std::collections::BTreeMap;
use std::fmt;
use std::fs;
use std::io;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
use memo_map::MemoMap;
use self_cell::self_cell;
use crate::compiler::codegen::CodeGenerationProfile;
use crate::compiler::instructions::Instructions;
use crat... |
20e314c2c49d3a5e0e9c59cd7bd502bc25ea6ec3510219200600116a0147edb9 | Rust | 7,957 | 215 | //! Tests covering `ResolveBaseCtx` end-to-end:
//!
//! 1. The typed ctx serializes to the same key set today's hand-built
//! `build_resolve_context` BTreeMap produces — fifteen fixed keys plus one
//! top-level entry per `dbt_namespace` (via `#[serde(flatten)]`).
//! 2. The `dbt_namespaces` flatten emits each n... |
77d30e569e9acc4a26589e0fac485230bbfe9e18218878e7e224836fc9c4725c | Rust | 7,958 | 224 | //! Tests for the macros that splice a node body into a wrapping query:
//! `get_empty_subquery_sql` (`dbt-adapters/macros/adapters/columns.sql`) and
//! `get_select_subquery` (`dbt-adapters/macros/relations/table/create.sql`).
//!
//! Both are reached when `contract.enforced` is set, and a terminal `;` in the
//! body... |
9dbb49805ade82bb1dee7be66756bf131886e5fd34d3a20ee3d0aa8031e774f7 | Rust | 7,964 | 238 | use std::sync::Arc;
use arrow_array::RecordBatch;
use dbt_index_core::{Backend, BackendError};
use super::*;
/// Backend that answers only the probe the export makes.
///
/// The export issues no SQL now — it copies files at most — so the only thing a
/// backend is asked is whether there are any resources.
struct M... |
9365560a20f5a5c729cedf0ccca74a6089eb6ccf3543630e60e697e335bbb37e | Rust | 7,992 | 229 | use std::collections::BTreeMap;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use serde::Serialize;
use handlebars::handlebars_helper;
criterion_main! { benches }
criterion_group! {
benches,
bench_compare_compile,
bench_compare_render,
}
#[derive(Serialize, Debug)]
struct NavI... |
13a64a56d833ca728edaa52d8eeb6da903fbb1e86b3619bc06a7a1745d070ee5 | Rust | 8,017 | 216 | //! SLT-style cross-phase Jinja context tests.
//!
//! Each `#[test]` here builds the typed-ctx fixtures available at the current
//! migration step, then runs an `.slt` file against them via the harness in
//! `common/jinja_ctx_slt.rs`. Phases that haven't landed yet are simply not
//! populated in the fixtures map; r... |
00f8be8904e60677d96de5175a5b9957ccfa2a93dd8def159596a15a5daf26be | Rust | 8,018 | 241 | //! Mode×flag applicability, end to end (#1140, audit batch E): a flag that
//! does nothing in the selected mode must say so, and the flags the audit
//! found silently dropped must now act. One index build feeds every check.
use std::path::{Path, PathBuf};
use std::process::{Command, Output};
const SALMON: &str = e... |
2c44e7e673411371ca495df42ab25da167e34c3c82bfd55aeef6762926587a1c | Rust | 8,034 | 226 | use std::path::Path;
use dbt_common::{ErrorCode, FsResult, fs_err};
use dbt_platform_auth::Credential;
use dbt_schemas::schemas::UserSettings;
const MANAGE_STATE_ENV: &str = "DBT_ENGINE_MANAGE_STATE";
// ── State config detection ────────────────────────────────────────────────────
/// Where `manage_state: true` wa... |
151cbd5a410d668d8e64632143d0b8b94a814819ccee2ca8a5aa9fcb90c08fc1 | Rust | 8,045 | 289 | use core::fmt;
use std::rc::Rc;
use std::sync::Arc;
use minijinja::listener::RenderingEventListener;
use minijinja::value::{Enumerator, Object, ObjectRepr};
use minijinja::{State, Value};
use crate::table::TableRepr;
use crate::{MappedSequence, Tuple, TupleRepr, ZippedTupleRepr};
#[derive(Debug)]
pub(crate) struct C... |
ed7c8fc0743438ec850fda33b31726100d704d3dfe7f19f90a33e1fb9f89b27a | Rust | 8,089 | 230 | /// Context carrying metadata associated with a query.
#[derive(Clone, Debug, Default)]
pub struct QueryCtx {
// Model executing this query
node_unique_id: Option<String>,
// Unique id this query targets, mirroring the Jinja `TARGET_UNIQUE_ID` key. Equal to
// `node_unique_id` for ordinary work; see `ta... |
5c398d29be5ab7c02ca7ca1d6473bd58977aabb713efd6e3644d2f77113e7f69 | Rust | 8,110 | 222 | use super::common::{ConfigField, ConfigProcessor, FieldValue, InteractiveSetup};
use dbt_common::FsResult;
use dbt_schemas::schemas::profiles::RedshiftDbConfig;
use dbt_schemas::schemas::serde::StringOrInteger;
impl InteractiveSetup for RedshiftDbConfig {
fn get_fields() -> Vec<ConfigField> {
vec![
... |
3ed3fd1905a386e849315e6a863c2bf7db571b22da928ca7b0c24e6a153eb101 | Rust | 8,149 | 200 | //! Table provider that defers data registration until execution time.
use datafusion::{
datasource::listing::{ListingTable, ListingTableConfig, ListingTableUrl},
execution::options::ReadOptions,
prelude::{NdJsonReadOptions, ParquetReadOptions},
};
use datafusion_catalog::{Session, TableProvider};
use data... |
ae6094ed7b48fafa2238a38c357bb09ac861a6279fb42bf45c05810dfb952877 | Rust | 8,195 | 242 | use crate::model::network::{AdjacencyLists, Network, UpdateSequence};
use crate::utils::function_pointer::UpdateStep;
pub fn set_update_sequence(network: &Network) -> UpdateSequence {
let predictions = get_predictions_sequence(network);
let updates = get_updates_sequence(network);
UpdateSequence {
... |
6124f2e9084ef0da3588806d7009b2277455b22d0b9875a3eed62a80d64368e6 | Rust | 8,210 | 129 | /*
* dbt Cloud API v3
*
* # How to use this API The dbt Cloud API v3 contains endpoints for programmatic administration of your dbt Cloud account. With it, you can replicate resources across projects, accounts, and environments, or standardize project creation for business teams. For endpoints related to jobs and r... |
8bca66e1fed909927d70f25c204385d87fb1195fc9ff0d768c36b6facc73a46a | Rust | 8,258 | 252 | use rshgf::model::network::Network;
/// Helper to check approximate equality of f64 values.
fn assert_close(actual: f64, expected: f64, label: &str) {
let tol = 1e-10;
assert!(
(actual - expected).abs() < tol,
"{}: expected {}, got {} (diff = {:.2e})",
label,
expected,
a... |
f4e222e4da76234fb6947d1fc275cecfc6751414eb961816b4e4e3fd757c7ca5 | Rust | 8,276 | 239 | use std::{collections::BTreeMap, path::Path};
use dbt_common::FsResult;
use dbt_jinja_utils::{
jinja_environment::JinjaEnv,
phases::load::LoadContext,
serde::{into_typed_with_jinja, value_from_file_async},
};
use dbt_schemas::schemas::packages::DbtPackageEntry;
use serde_json::{Map, Value};
use sha1::Diges... |
897f30a6340babb065cd54e1f1a68353c97664e81f9714b6878d24008fc55514 | Rust | 8,284 | 240 | //! ADBC Statement
//!
//!
use std::fmt;
use crate::driver_manager::ManagedStatement as ManagedAdbcStatement;
use adbc_core::{
Optionable, PartitionedResult, Statement as _,
error::{Error, Result, Status},
options::{OptionStatement, OptionValue},
};
use arrow_array::{RecordBatch, RecordBatchReader};
use a... |
fb9207043e01770d4d562d5a65d14b33ea554a59b455fc494d8af53ed8a361cb | Rust | 8,321 | 224 | //! `salmon-core`: shared foundational types for the Rust port of salmon.
//!
//! This crate holds the vocabulary types used across the mapping, alignment,
//! modeling, and inference crates: library formats, mate status, log-space math
//! helpers, and the shared error type. It deliberately has no heavy
//! dependenci... |
b6108db90a03c304833087af795c67087be1a2cb02278bab5920cbf7ec0d94cb | Rust | 8,364 | 207 | //! Criterion benchmark for the EM/VBEM step over equivalence classes.
//!
//! Builds a synthetic power-law equivalence-class set (many singletons, a heavy
//! tail of multi-transcript classes drawn with a Zipf-like bias so a handful of
//! "hot" transcripts recur — the scatter-contention shape the real M-step guards
/... |
cde17a3d75cbb03fa4e6cc7abb8eff9e26229b50c468dc9d2f9566f976b44286 | Rust | 8,405 | 242 | use crate::errors::{AdapterError, AdapterErrorKind, AdapterResult};
use crate::relation::config_v2::{
ComponentConfig, ComponentConfigLoader, SimpleComponentConfigImpl, diff, impl_loader,
};
use arrow_schema::Schema;
use chrono::{DateTime, TimeDelta, Utc, format::SecondsFormat};
use dbt_adbc::duration::parse_durat... |
e55666644d884f1db5df3507c7ad231cee812a8aa3d549cbdf62cecf113ea498 | Rust | 8,419 | 241 | use std::collections::BTreeMap;
use std::rc::Rc;
use std::sync::Arc;
use minijinja::arg_utils::ArgsIter;
use minijinja::listener::RenderingEventListener;
use minijinja::value::{Object, ValueKind};
use minijinja::{Error, ErrorKind, State, Value};
use serde::Serialize;
use crate::utils::yml_value_to_minijinja;
/// Sha... |
cade56be5ae8835be1779ac187306a0d89d08ca12ea9fb500f13cc712ab2de7c | Rust | 8,454 | 190 | //! Diagnostic: trace why specific read pairs map in kallisto but not in our
//! sketch path. For each pair we run piscem's `map_read` on each mate
//! independently and report the per-mate accepted-target sets, the
//! `has_matching_kmers` flag, and the target-set intersection — the exact
//! signal the sketch pairing... |
e7487af263101eac00c23d543c2a68c552cc70fd9e73ba68067f6dc98e32cbd6 | Rust | 8,467 | 200 | //! Transparent decompression of user-supplied input files.
//!
//! # Why this is shared
//!
//! salmon takes files from users in several places — the transcriptome FASTA,
//! the reads, an alignment record stream, a gene map — and users compress them
//! with whatever their pipeline uses. Deciding "is this compressed,... |
a050ba7ed266600b69075f0680968027eed0027cdf6d625766ad299d2ba54a38 | Rust | 8,479 | 136 | // from https://github.com/apache/arrow-adbc/blob/9a10e6791db6d54b813fde4df3925c354822192e/go/adbc/driver/bigquery/driver.go#L31
pub const AUTH_TYPE: &str = "adbc.bigquery.sql.auth_type";
pub const API_ENDPOINT: &str = "adbc.bigquery.sql.api_endpoint";
pub const LOCATION: &str = "adbc.bigquery.sql.location";
pub const... |
daef3fbc0ccad7503c57d4c36dc774dc589e1060a7caa7d169d44f37642b1b11 | Rust | 8,493 | 249 | use regex::Regex;
use std::sync::LazyLock;
/// Replace non-deterministic dbt temporary-table identifiers with a stable
/// canonical form so record/replay comparisons are order-independent.
///
/// Two producer patterns need to be handled — both call sites are dbt-adapters
/// upstream, dispatched via `make_temp_relat... |
170f7f345f3af7e439ab3796c63d02310486adf555ff43ad831fed30a5bb3bc6 | Rust | 8,540 | 242 | //! Custom CSV reading for dbt seeds
//!
//! This crate is a fork of arrow-csv, designed for reading CSV files with
//! Python/dbt/agate-compatible inference and parsing logic.
//!
//! # Usage
//!
//! ```ignore
//! use dbt_csv::reader::{Format, ReaderBuilder};
//! use std::io::Cursor;
//!
//! let data = std::fs::read("... |
2a8c7771d58ac556b3fd75f25de098d4ba5ca90c5ffd9cda66e5f91705788e2d | Rust | 8,553 | 232 | use crate::AdapterEngine;
use crate::cast_util::downcast_value_to_dyn_base_relation;
use crate::relation::{RelationObject, do_create_relation};
use crate::value::empty_mutable_vec_value;
use dashmap::{DashMap, DashSet};
use dbt_adapter_core::AdapterType;
use dbt_common::FsError;
use dbt_schemas::schemas::dbt_catalogs:... |
9700dac9dcee447adab604b7522cb9fbba0b2f2e70fc0bc1940f2e44962805a2 | Rust | 8,623 | 232 | use std::fmt;
use std::path::PathBuf;
use std::rc::Rc;
use std::sync::Arc;
use crate::arg_utils::ArgParser;
use crate::error::{Error, ErrorKind};
use crate::listener::RenderingEventListener;
use crate::machinery::Span;
use crate::value::mutable_map::MutableMap;
use crate::value::{Enumerator, Kwargs, Object, Value};
us... |
1c263cb155a056be258265eb1a27532d8d6094f0dd9e4550b44abcdede58c2fb | Rust | 8,724 | 214 | //! Util methods for creating query context.
use crate::errors::AdapterResult;
use dbt_adapter_core::DBT_EXECUTION_PHASES;
use dbt_adbc::QueryCtx;
use dbt_schemas::schemas::{
CommonAttributes, DbtModel, DbtSeed, DbtSnapshot, DbtTest, DbtUnitTest, manifest::DbtOperation,
};
use minijinja::{
State,
constant... |
d3e2a39d9b648e269cdb9b0249b1277689bb9123406bc9fc038c2ebc69193cb6 | Rust | 8,796 | 222 | //! Databricks compatibility tests for the MetricFlow semantic query compiler.
//!
//! Two modes:
//!
//! - **Replay** (default): loads pre-recorded results from
//! `tests/data/databricks_recordings.parquet`. No Databricks connection needed.
//! ```sh
//! cargo test -p dbt-metricflow --test databricks_compat
//... |
2e63bff033bf47cf45b9267175e7e88945087c137fc47dec53d93dec5c3c17a6 | Rust | 8,876 | 327 | use std::io::Write;
use std::process::Command;
fn dbt_metricflow() -> Command {
let bin = env!("CARGO_BIN_EXE_dbt-metricflow");
Command::new(bin)
}
fn example_manifest() -> tempfile::NamedTempFile {
let manifest = serde_json::json!({
"semantic_models": [{
"name": "orders",
... |
cfc4f907aaa83132fd436d42cf3b8c231bc947b357a67a735a72b6493ec23c1f | Rust | 8,876 | 232 | //! Redshift compatibility tests for the MetricFlow semantic query compiler.
//!
//! Two modes:
//!
//! - **Replay** (default): loads pre-recorded results from
//! `tests/data/redshift_recordings.parquet`. No Redshift connection needed.
//! ```sh
//! cargo test -p dbt-metricflow --test redshift_compat
//! ```
... |
f8ec90d908e326e9850e1278f66170cac276dd0834624f87b8641241cac23eea | Rust | 8,944 | 252 | //! Dbt-specific tracing initialization built on top of the generic subscriber setup.
use std::sync::Arc;
use dbt_error::{ErrorCode, FsError, FsResult, fs_err};
use super::{
config::FsTraceConfig,
dbt_data_layer::{dbt_data_layer_config, dbt_process_span_attributes},
dbt_emit::print_err_from_fs_error,
... |
e2af8093bd93bfa3b558b96accbd8395f579d55898bbcf958aa0f62a90f7f305 | Rust | 8,971 | 222 | // ----------------------------------------------------------------------------------------------
// dbt brand name (shown in --version banners and JSON log lines)
pub const DBT_BRAND_NAME: &str = "dbt";
pub const DBT_SA_CLI: &str = "dbt-sa-cli";
// ---------------------------------------------------------------------... |
efc2c6e3a5d4867250ed9cd54afcb89b4e62c3e3be06645c414918b107f13be3 | Rust | 8,982 | 259 | use dbt_profile::{ResolveArgs, resolve, resolve_metadata};
fn fixture(body: &str) -> (tempfile::TempDir, ResolveArgs) {
let dir = tempfile::tempdir().unwrap();
std::fs::write(dir.path().join("profiles.yml"), body).unwrap();
let args = ResolveArgs {
profiles_dir: Some(dir.path().to_path_buf()),
... |
fd23776c887494bc2993467f049a68c92ecfcec37510f8e140c37e279d4fba55 | Rust | 9,016 | 268 | #![cfg(test)]
use crate::AdapterType;
use crate::sql_types::{DefaultTypeOps, TypeOps};
use arrow_schema::{Field, Fields, Schema};
use chrono::{DateTime, TimeDelta};
use dbt_schemas::schemas::{common::*, manifest::*, nodes::*, project::*};
use dbt_yaml::Spanned;
use serde_json;
use std::collections::HashMap;
#[derive(... |
fba56804c5641bb2de9fac73018e639aa21b27d85d18ae9f6b7987b8f5a96e19 | Rust | 9,032 | 237 | //! Tests covering `RunNodeCtx` end-to-end:
//!
//! 1. The typed ctx serializes to exactly the same key set today's
//! `build_run_node_context<S>` BTreeMap produces — 18 base keys plus the
//! optional `pre_hooks` / `post_hooks` / `load_agate_table` (skipped via
//! `#[serde(skip_serializing_if = "Option::is_... |
d927499a15eb08fd2e2db3cb577829e5502684630b078a38bca2978fcd997a58 | Rust | 9,048 | 240 | //! Append-only parquet for run result records.
//!
//! Files land at:
//! ```text
//! target/
//! metadata/run/results/v1_{N}.parquet ← append-only, one row per node per invocation
//! ```
//!
//! ## Design
//! * **Append-only** — each invocation appends a new file with one row per executed node.
//! * **File cons... |
c2072e00a1cb4a98e2cb4ccf920a42ab2da0c73ba8679ecb9d760b722a3511bf | Rust | 9,055 | 278 | //! This module implements `DynJinjaObject`, dynamic Jinja object that can have methods,
//! values and state attached to it at runtime without the need for Rust structs, `Serialize`
//! or other boilerplate code.
use minijinja::{
listener::RenderingEventListener,
value::{Enumerator, Object, Value, ValueMap},
... |
c4b79d31ea19a0eec4296901282daf595e797d4e0479961883c304681010a9cc | Rust | 9,080 | 237 | //! Projection: source record batches -> information schema record batches.
//!
//! Output Arrow types come from the source field, so a rename never changes a
//! column's type. Output fields are always declared nullable: a projected array
//! keeps its own null buffer, and a nullable field accepts an array with no
//!... |
d6a9e4702d364c19704d8e1b995074d2a96095ee22cd21dba438c07706d22517 | Rust | 9,082 | 242 | //! COPY-path coverage that needs a DuckDB driver.
//!
//! Empty-metadata tests in `tests.rs` stay on Arrow so they pass without a
//! driver. This module checks the COPY writer when one is present.
use std::path::Path;
use std::sync::Arc;
use arrow_schema::{DataType, Field, Schema, TimeUnit};
use serde_json::{Value,... |
fc0763e0326a75ed69ebbb33c706abb7b5f70ad75ca0d1aa4f3eed322a06bb67 | Rust | 9,092 | 232 | //! BigQuery compatibility tests for the MetricFlow semantic query compiler.
//!
//! Two modes:
//!
//! - **Replay** (default): loads pre-recorded results from
//! `tests/data/bigquery_recordings.parquet`. No BigQuery connection needed.
//! ```sh
//! cargo test -p dbt-metricflow --test bigquery_compat
//! ```
... |
2a44eb26316a44602fbfccf5c271835b21e94e5a001a55286326e313fb64562c | Rust | 9,110 | 209 | //! Aux-output dump helpers shared by reads-mode and alignment-mode quant.
//!
//! These files are diagnostics: they let a user (or a parity test against C++
//! salmon) inspect what the bias models actually learned from a run, rather than
//! only seeing the corrected abundances that came out the far end.
//!
//! salm... |
7f12bfd79825fa52a1e4f61dfb6ff02451b07aced57e294131c1f52c2e3b4cb6 | Rust | 9,184 | 265 | use crate::{AdapterConfig, Auth, AuthError, AuthWarningPrinter, auth_configure_pipeline};
use database::Builder as DatabaseBuilder;
use dbt_adbc::{Backend, database, lake_compute};
#[derive(Debug)]
enum LakeComputeAuthIR<'a> {
Token {
token: &'a str,
},
// not yet verified
ApiKey {
api... |
5df4162f9007bd1b3346b5c397c6e6720a7daaf70f414f11676e7b5d4c4ff1c8 | Rust | 9,186 | 304 | use crate::expr::Expr;
use crate::expr::ir::{ArithmeticOp, ComparisonOp, Function};
use std::borrow::Borrow;
use std::hash::Hash;
pub struct Evaluator {
// Using dyn dispatch might be faster than match-based
expr: Expr,
}
#[derive(Debug, PartialEq)]
pub enum Value {
Int(i64),
Bool(bool),
}
pub trait ... |
019308cd18738bdc685ef0849cabe4b5d4c6dfb24371a4344fdbe4156af58629 | Rust | 9,232 | 201 | //! Building the [`RadPrelude`] (header + tag sections) and matching file-tag
//! [`TagMap`] for a salmon RAD file.
//!
//! # What a "prelude" is
//!
//! Every RAD file starts with a self-describing header: how many references
//! there are and what they are called, plus three *tag sections* that declare
//! the fields... |
915a996158bcd1fcb0d26008c725f9dbc35b6331040b1ac25d3b05e73679da4b | Rust | 9,277 | 283 | //! GitHub-specific fast path: archive download + GraphQL ref resolution.
//!
//! Ref resolution tries GraphQL first and falls back to `git ls-remote` on any
//! failure. Downloads use the GitHub archive endpoint; on failure the caller
//! falls back to `git clone`.
use std::path::Path;
use async_trait::async_trait;
... |
435fbdde650c443cb6d2e66031209039a7665d7338343024909eb88166ca4c99 | Rust | 9,306 | 259 | use std::collections::BTreeMap;
use std::sync::Arc;
use dbt_adapter::relation::RelationObject;
use dbt_adapter_core::AdapterType;
use dbt_jinja_utils::mock_object::MockJinjaObject;
use dbt_schemas::dbt_types::RelationType;
use minijinja::Value;
use crate::macro_test_harness::{MacroTestHarness, assert_executed_contain... |
0f33c1e71ebf202d054ef5da359bfed17c2eba1ab531a1467d2b625d093902c9 | Rust | 9,367 | 282 | //! dbt specific Jinja filters.
//!
//! Also provides [`register_filter_types`] for static type-checking integration.
use minijinja::{
Environment, Error as MinijinjaError, ErrorKind as MinijinjaErrorKind, Value, value::ValueKind,
};
/// Register all four dbt filters on the given [`Environment`].
pub fn register_... |
e0def6fc00a5fafc711a7423f9c472cdedbadd5851db77757f8cecf07420e850 | Rust | 9,385 | 250 | use crate::common::{ConfigField, ConfigProcessor, FieldValue, InteractiveSetup};
use dbt_common::FsResult;
use dbt_schemas::schemas::profiles::FabricDbConfig;
// Index → authentication string. Order is the order the user sees in the select prompt.
//
// Values come from `dbt-fabric/dbt/adapters/fabric/fabric_connecti... |
249c41cd714a2e1835ca6d606363e2a72100a6ef3a590729e24c9e6f72cc74e5 | Rust | 9,418 | 255 | use std::{
collections::{BTreeMap, BTreeSet},
fmt,
};
use dbt_common::{io_args::ListOutputFormat, node_selector::SelectExpression};
use dbt_schemas::schemas::Nodes;
#[cfg(debug_assertions)]
use dbt_schemas::schemas::telemetry::NodeType;
use serde_json::Map;
type JsonValue = serde_json::Value;
/// Represents ... |
33ecf9d09ac78d208d7ec85a83df8b2a2ac4047820874009d5f2f77f716e11b2 | Rust | 9,449 | 233 | //! https://github.com/databricks/dbt-databricks/blob/main/dbt/adapters/databricks/relation_configs/view.py
use crate::AdapterType;
use crate::relation::config_v2::ComponentConfigChange;
use crate::relation::config_v2::{ComponentConfigLoader, RelationConfigLoader};
use crate::relation::databricks::config::{DatabricksR... |
18b3619a8f96f1b2568fa1c1447fb3225a3f1b5215302374079f0bad96145fe3 | Rust | 9,509 | 263 | //! Fetching and resolving dbt's published version manifest (`versions.json`)
//! from the CDN -- the canonical source for "what does 'latest' mean right
//! now" and "what does alias/version X resolve to". Consolidated here
//! because both `dbt-dist` (this crate) and `dbt-main` need this exact
//! resolution, and `db... |
84d1a5cd67899154926324b636e886eca7b62dbcfcb77f447bcb63c0e956087c | Rust | 9,566 | 259 | //! https://github.com/databricks/dbt-databricks/blob/main/dbt/adapters/databricks/relation_configs/column_tags.py
use crate::errors::AdapterResult;
use crate::relation::config_v2::{
ComponentConfig, ComponentConfigLoader, RelationConfig, SimpleComponentConfigImpl, impl_loader,
};
use crate::relation::databricks::... |
e1d9c11e2f1e910212551d408eef9551ffba5993fc04b92b8f926f2899872f8f | Rust | 9,567 | 264 | //! Generic git client — clone + ls-remote fallback.
//!
//! Works with any git host. Used as fallback when host-specific
//! fast paths fail or aren't available.
use std::path::Path;
use async_trait::async_trait;
use dbt_common::{ErrorCode, FsResult, fs_err, tokiofs};
use tokio::process::Command;
use super::ParsedG... |
0600dd9a6f9a79177eaba686ad05f11fb0ae7b75430cdc27ffc2a8ab46a3e5c3 | Rust | 9,628 | 279 | use crate::errors::{AdapterError, AdapterErrorKind, AdapterResult};
use crate::relation::config_v2::{
ComponentConfig, ComponentConfigLoader, SimpleComponentConfigImpl, diff, impl_loader,
};
use crate::value::none_value;
use arrow_schema::Schema;
use dbt_schemas::schemas::{
DbtModel, InternalDbtNodeAttributes,... |
1384486ee8ec8fd3bf0f3cd5fb32e09a7903b505fe406ae5f7d98cb80390fd7b | Rust | 9,677 | 290 | use console::Style;
use regex::Regex;
use std::error::Error;
use std::fmt::Display;
use std::sync::LazyLock;
pub static CYAN: LazyLock<Style> = LazyLock::new(|| Style::new().cyan().bold());
pub static BLUE: LazyLock<Style> = LazyLock::new(|| Style::new().blue().bold());
pub static RED: LazyLock<Style> = LazyLock::new(... |
a56e14f0d160c3d02bf07b3142390e2ae4049a304995e504bbbe4b01ad39854f | Rust | 9,735 | 289 | //! Relation and RelationConfig implementations for different data warehouses.
pub(crate) mod config;
pub use config::{BaseRelationChangeSet, BaseRelationConfig, ComponentConfig, RelationChangeSet};
pub mod bigquery;
pub mod databricks;
pub mod redshift;
pub mod snowflake;
pub mod spark;
pub mod factory;
mod relati... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.