sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
16cafc26489f52a58ac10aa24376ee8b2c7ddbbefb4d256b4446ee15f2b42ba2 | Rust | 2,358 | 68 | use std::borrow::Cow;
use super::{
color::{DIM, maybe_apply_color},
constants::{ACTION_WIDTH, DEFAULT_TERMINAL_WIDTH},
};
/// Formats a centered delimiter line with '=' padding characters and optional DIM color.
///
/// This is used to create section headers in terminal output, such as
/// "Execution Summary"... |
ca0eda029805fbd036a1f3799d254a05d1f6beb80ed75f57bba281a60b07bcd3 | Rust | 2,360 | 75 | use std::collections::{HashMap, HashSet};
use std::sync::Arc;
use dbt_adapter::Adapter;
use dbt_adapter::engine::SidecarClient;
use dbt_common::FsError;
use dbt_common::FsResult;
use dbt_common::cancellation::CancellationToken;
use dbt_common::io_args::EvalArgs;
use dbt_common::io_args::IoArgs;
use dbt_common::io_args... |
1c8c9d271adf956353826bd097a2f8034f07605b6c3220d2172e2f2763bf6b29 | Rust | 2,366 | 70 | //! This module contains the functions for initializing the Jinja environment for the load phase.
use std::{collections::BTreeMap, sync::Arc};
use chrono::DateTime;
use chrono_tz::Tz;
use dbt_adapter::{Adapter, sql_types::DefaultTypeOps};
use dbt_adapter_core::AdapterType;
use dbt_common::{
ErrorCode, FsResult, ... |
b689ee4219cded460ea110cf23ac379c5fb7a2614f3c735189f2f61c08e59d3f | Rust | 2,380 | 63 | //! Snapshot tests for `compose_v2_catalog_attach_stmts`.
//!
//! Each scenario under `tests/duckdb_attach_fixtures/<scenario>/catalogs.yml`
//! is parsed and the joined ATTACH (and optional `INSTALL ducklake`) statements
//! are snapshotted to a sibling `output.snap` for side-by-side reviewability.
//! Update goldens:... |
dbef73759152b56821b94d059539b4307a58d24fc9a91426f21b14367eaa40d5 | Rust | 2,400 | 72 | //! Formatter for log messages.
//!
//! This module provides formatters that add error code prefixes and optional
//! color formatting to messages.
use dbt_error::ErrorCode;
use dbt_tracing::SeverityNumber;
use crate::{constants, pretty_string::color_quotes};
use super::color::{maybe_apply_color, severity_to_color_s... |
bb0dc1e32bb0273d093fdd569076e1455c0b2669d9d761b2297ede2c7ff62d8e | Rust | 2,401 | 93 | use std::sync::Arc;
use std::{env, fmt};
use minijinja::value::{Enumerator, Object, Value};
use minijinja::{context, Environment, Error, ErrorKind, State};
#[derive(Debug)]
struct NestedConfig {
active: bool,
}
#[derive(Debug)]
struct Config {
manifest_dir: &'static str,
version: &'static str,
nested... |
df5c8d5a9fda12507fca6ea5ef994a061772acd340d06146d4254e160cf27c0f | Rust | 2,402 | 64 | //! Guards that BGZF compression actually runs on the number of workers we ask
//! for.
//!
//! This has silently broken twice on a noodles bump, and neither break was
//! catchable by output comparison, because the bytes are identical no matter how
//! many threads produced them:
//!
//! - noodles 0.48 deprecated `wit... |
1deae0513f99e6677866d7d0fbd98f2a89813cdf047663f42844885cfd59af3c | Rust | 2,415 | 58 | /// Databricks ADBC Connection Options
/// Referenced from: github.com/dbt-labs/arrow-adbc/go/driver/databricks/driver.go
/// Authentication type options
pub const AUTH_TYPE: &str = "databricks.auth_type";
pub mod auth_type {
/// OAuth M2M authentication
pub const OAUTH_M2M: &str = "oauth-m2m";
/// Persona... |
31ddb31bce5396a37a3876b001db0f809417339bf068d2bfd9cd5b2b985a1920 | Rust | 2,429 | 64 | //! SidecarClient trait for subprocess-based adapter execution. See [`SidecarClient`] for
//! the design rationale.
use std::fmt::Debug;
use arrow::record_batch::RecordBatch;
use dbt_adbc::{Connection, QueryCtx};
use dbt_schemas::{dbt_types::RelationType, schemas::common::ResolvedQuoting};
use minijinja::State;
use ... |
58093b37b964dada3e97711e0eb0d91f9eb244971461d9c9caeb54aec85dcae6 | Rust | 2,452 | 78 | use std::path::PathBuf;
use std::sync::RwLock;
use crate::warn_error_options::WarnErrorOptions;
/// Serves as a handle to tracing configuration that is mutable at runtime.
pub trait TracingConfigProvider: Send + Sync {
fn set_warn_error_options(&self, warn_error_options: WarnErrorOptions);
/// Call `f` with ... |
fc4e6caa7ea221773f0ece9ce5031021eeb561c691a6e7640b46242d5eb0abe8 | Rust | 2,457 | 87 | use std::{cell::RefCell, fmt, rc::Rc};
/// Tracks the current location (line, column, byte index) in the output buffer.
/// This is used for macro span tracking during rendering.
#[derive(Debug)]
pub struct OutputTrackerLocation {
line: RefCell<u32>,
col: RefCell<u32>,
index: RefCell<u32>,
}
impl Default ... |
65ae51e70f9a0ae5bd13b07430b25d716abbdf90cb71a3a4cd3016e019055253 | Rust | 2,483 | 79 | use dbt_common::{AdapterError, AdapterResult};
use dbt_schemas::schemas::{DbtModel, InternalDbtNodeAttributes};
use minijinja::Value;
use crate::relation::config_v2::{
ComponentConfig, ComponentConfigLoader, SimpleComponentConfigImpl, diff, impl_loader,
};
use crate::relation::snowflake::config::SnowflakeDescribeR... |
6e96f37036846dd69e457046bb94839dd893262de820a27b79ebee3fa864e51d | Rust | 2,496 | 78 | use std::sync::Arc;
use arrow_schema::{FieldRef, Schema};
use dbt_adapter_core::AdapterType;
use dbt_adapter_sql::types::metadata_sql_type_key;
use indexmap::IndexMap;
use crate::AdapterResult;
pub(crate) fn ingest_schema_with_column_overrides(
arrow_schema: &Schema,
column_overrides: &IndexMap<String, Strin... |
edb73d07c1ed02e1ad105851d733708eb486906a36f230323d60ffb87949959f | Rust | 2,499 | 77 | use core::fmt;
use std::sync::Arc;
use minijinja::value::{from_args, Kwargs, Object, ObjectRepr};
use minijinja::{args, Environment, Error, ErrorKind, State, Value};
use syntect::highlighting::ThemeSet;
use syntect::html::highlighted_html_for_string;
use syntect::parsing::SyntaxSet;
struct Highlighter {
ss: Synta... |
bdd527502f5a2881075eea4f2b51059c20db3c5f595c04cf7825559103fdf08e | Rust | 2,512 | 76 | use dbt_common::{ErrorCode, FsResult, fs_err};
use reqwest::header::{ACCEPT, AUTHORIZATION, HeaderMap, HeaderName, HeaderValue};
use reqwest_middleware::{ClientBuilder, ClientWithMiddleware};
use reqwest_retry::{
RetryTransientMiddleware, policies::ExponentialBackoff as RetryExponentialBackoff,
};
pub const MAX_CL... |
ee006950ea6b3725c25157a775eaec4f13169d25316e0a245d4b4c7cd1baa412 | Rust | 2,523 | 79 | use crate::errors::{AdapterError, AdapterErrorKind};
use crate::response::ResultObject;
use arrow::array::RecordBatch;
use dbt_agate::AgateTable;
use minijinja::{State, Value};
use std::error::Error;
use std::sync::Arc;
// All four panic if the named macro doesn't exist in the template state.
pub fn execute_macro_w... |
65e945626e1461de10760bf406140192edbb848c85da33d0f680e63289b5f101 | Rust | 2,530 | 74 | //! Custom CSV reading for dbt seeds using agate-compatible inference.
//!
//! This module provides utilities for reading CSV files with Python/dbt/agate-compatible
//! type inference and parsing logic, designed for dbt seed files.
use datafusion::datasource::MemTable;
use datafusion::datasource::TableProvider;
use da... |
4ecc28f1aec91ab75d0318f518be78c4ccf2bac39e9e4ad4edec8f5f82086350 | Rust | 2,532 | 72 | use crate::AdapterResult;
use crate::metadata::databricks::schemas::DatabricksDescribeTableExtended;
use crate::metadata::*;
use crate::record_batch::RecordBatchExt;
use crate::sql_types::{TypeOps, make_arrow_field_v2};
use arrow::array::{RecordBatch, StringArray};
use arrow_schema::{Field, Schema};
use std::collectio... |
5b9e40d3bd95cc694bfe88b70bf99e7537c2b40214054ac1e40173cfb9d800ba | Rust | 2,555 | 86 | /// Returns the fully qualified name of the current function.
#[macro_export]
macro_rules! current_function_name {
() => {{
fn f() {}
fn type_name_of_val<T>(_: T) -> &'static str {
::std::any::type_name::<T>()
}
let mut name = type_name_of_val(f).strip_suffix("::f").unwra... |
39822af315a370c3118ff96450edda46cad1195a6c8e3191ffcdcb76f29d63eb | Rust | 2,563 | 60 | /// The auth provider.
pub const AUTH_PROVIDER: &str = "redshift.auth.provider";
/// If specified, driver uses AWS SDK to fetch credentials.
pub const CLUSTER_TYPE: &str = "redshift.cluster_type";
pub mod cluster_type {
pub const REDSHIFT: &str = "redshift";
pub const REDSHIFT_IAM: &str = "redshift-iam";
p... |
e0dc9df4db4369d871f394afb2e27c75883556d1836463f030311451682409a6 | Rust | 2,576 | 72 | use std::collections::HashMap;
use dbt_adapter_core::AdapterType;
use dbt_jinja_ctx::DbtNamespace;
use minijinja::Value;
use crate::macro_test_harness::MacroTestHarness;
/// Render the shared batched-`unique` macro for `adapter_type`, lowercased.
///
/// The per-adapter variation lives entirely in the `aggregated_un... |
35bfaffd88f52733122a574671c56bb6450087195399999e069e3878714cb457 | Rust | 2,581 | 69 | // Demonstrates building an interactive AuthChain via AuthChainBuilder.
//
// Resolution order:
// 1. EnvVarResolver — env vars
// 2. OAuthPassiveResolver — ~/.dbt/oauth_sessions.json (cached session or refresh)
// 3. CloudYamlResolver — dbt_cloud.yml
// 4. OAuthInteractiveResolver — browser-based logi... |
da96da8913ec547e575c475586fae86ec32265c30cd3445012b251beed45fc9d | Rust | 2,590 | 68 | use dbt_platform_auth::{AuthChainBuilder, AuthError, Credential, OAUTH_CLIENT_ID};
#[tokio::main]
async fn main() {
match AuthChainBuilder::new(OAUTH_CLIENT_ID)
.build()
.resolve()
.await
{
Ok(cred) => {
let kind = match &cred {
Credential::ServiceTok... |
cfb6041651d6953ae9207abda3da71ed6330c5be8032c75c6482a68a500ba5c4 | Rust | 2,621 | 76 | use dbt_telemetry::{HookOutcome, HookProcessed};
use std::{borrow::Cow, time::Duration};
use super::{
color::{BLUE, GREEN, PLAIN, RED, YELLOW, maybe_apply_color},
duration::format_duration_fixed_width,
layout::right_align_static_action,
};
/// Format hook name with optional coloring
fn format_hook_name(ho... |
cae763b5bb52193181ba06258ed84f79d602d9d81d5e1d467d79d92ac030e5e5 | Rust | 2,649 | 89 | use dbt_common::{CodeLocationWithFile, ErrorCode, FsError};
use minijinja::TypecheckingEventListener;
use minijinja::machinery::Span;
use std::cell::RefCell;
use std::path::PathBuf;
/// A side-effect-free typechecking listener that collects YAML diagnostics.
///
/// Collected diagnostics can be accessed with [`Self::d... |
e04947eafeaa50941cb6dedba729c8dacf05bad81b8c3f370e63794620fec681 | Rust | 2,652 | 79 | use std::sync::Arc;
use dbt_error::ErrorCode;
use dbt_tracing::{LogRecordInfo, SeverityNumber};
use crate::{
tracing::{
TracingConfigProvider, data_provider::DataProvider, fs_error_log::get_log_message,
layer::TelemetryMiddleware,
},
warn_error_options::{ErrorCtx, WarnErrorDecision, WarnEr... |
0be266681d8be7af094beacc510831ee629986a996b9db4f6e42517cb9c29a2f | Rust | 2,671 | 79 | //! Python file information collection
//!
//! This module contains structures for collecting information from Python model files,
//! analogous to SqlFileInfo for SQL models.
use dbt_frontend_common::error::CodeLocation;
use dbt_schemas::schemas::{common::DbtChecksum, project::ResolvableConfig, serde::NodeVersion};
... |
de7fe191e3aba701833fbb15f1256f558f6f695da7429c95962f6947d8cb4bdb | Rust | 2,706 | 79 | //! Cross-model registry for user-declared (YAML `columns:`) schema — ground
//! truth the project already states, independent of anything learned from
//! usage or inference.
//!
//! Distinct from `InferSchemaRegistry`: that one records columns *inferred*
//! from how a relation is used during binding; this one record... |
7b3682e26db852835d544e849a478cc3464bb8212f24406269fb000c42c8c848 | Rust | 2,707 | 77 | //! Source-available feature trait surfaces for `dbt-index`.
//!
//! This crate defines the **abstract interfaces** for features whose
//! implementation lives in the proprietary `dbt-index` crate
//! (column lineage, column impact, etc.). It does **not** ship
//! implementations or any infrastructure (no DuckDB primit... |
a4b1e1a728ff4ea977871922cd3674e38344f8739cff52e1a3d4e89b97ecf766 | Rust | 2,708 | 90 | use std::sync::Arc;
use minijinja::value::{Enumerator, Object, Value, ValueKind};
use minijinja::{context, Environment, Error, State};
use tokio::runtime::Handle;
use tokio::task::spawn_blocking;
/// Utility object to hold a reference to the runtime and the context.
#[derive(Debug)]
struct ContextWithRuntime {
rt... |
b5091e447ff40fe641efbf6c95be30b90211726030b369fde5e7c24faf78330d | Rust | 2,710 | 80 | use std::hash::{BuildHasher, DefaultHasher, Hasher, RandomState};
/// A distinct type wrapper around Rust's [DefaultHasher], that simply forwards
/// all hashing operations to it.
///
/// Note that we are not modifying the (SipHash13) hashing algorithm in any way,
/// only the *seed*. The purpose of this type is to ma... |
5b94ff500549ee8b4d16adce287b5140311b0cfe27c4956eecc0805ea6e9e20d | Rust | 2,716 | 91 | use std::collections::BTreeMap;
use std::sync::Arc;
use dbt_adapter_core::AdapterType;
use dbt_jinja_utils::mock_object::MockJinjaObject;
use minijinja::Value;
use crate::macro_test_harness::MacroTestHarness;
fn render_writer_options(clustered_by: Value, buckets: Option<i64>) -> String {
let python_macros =
... |
3f893867a176beaa8bfb58d369b8ee027bfe968a2144f65e115534188eba3307 | Rust | 2,738 | 85 | use std::sync::Arc;
use dbt_index_core::{
Backend, ColumnImpactProvider, ColumnLineageProvider, UnavailableBackend,
UnavailableColumnImpact, UnavailableColumnLineage,
};
use serde::Serialize;
/// Metadata about the running distribution. Returned by `GET /api/v1/distribution`.
#[derive(Debug, Clone, Serialize)... |
1f073cc4c304189926fe6cf44edb026ca6cdefebec67bb61a8148dad7ff1e794 | Rust | 2,756 | 81 | pub(crate) mod sqlite;
#[deprecated(note = "File-based storage is legacy. Use SQLite storage for new recordings.")]
pub(crate) mod file;
pub(crate) static RECORDS_NAME: &str = "recordings.db";
use arrow_schema::{DataType, Field, Schema};
use std::sync::Arc;
pub(crate) fn fix_decimal_precision_in_schema(schema: &Sch... |
85f2a360d747d661b8a77078af1d15f312a610029ef1e025a70d58f9a7f15178 | Rust | 2,760 | 85 | use minijinja::{AutoEscape, State};
use pyo3::exceptions::PyRuntimeError;
use pyo3::prelude::*;
use std::ffi::c_void;
use std::sync::atomic::{AtomicPtr, Ordering};
use crate::environment::{with_environment, Environment};
use crate::typeconv::to_python_value;
thread_local! {
static CURRENT_STATE: AtomicPtr<c_void>... |
0637a828f785ad08d2927a7cea3a4e0528d81c62f57c2ea18eef5b0e2cbac1a1 | Rust | 2,766 | 108 | use dbt_error::ErrorCode;
use dbt_tracing::{AnyTelemetryEvent, TelemetryEventRecType, TelemetryOutputFlags};
/// Private type to wrap messages intended for stdout printing only (essentially alternative to `println!`).
#[derive(Debug)]
pub(in crate::tracing) struct StdoutMessage;
impl AnyTelemetryEvent for StdoutMessa... |
c0762730d6633aeb9eebd63691770aa05b838d4507c0480939d310cb2988362a | Rust | 2,773 | 106 | use std::cell::RefCell;
use minijinja::{Error, ErrorKind};
use once_cell::sync::OnceCell;
use pyo3::ffi::PyErr_WriteUnraisable;
use pyo3::prelude::*;
use pyo3::types::PyTuple;
static TEMPLATE_ERROR: OnceCell<Py<PyAny>> = OnceCell::new();
thread_local! {
static STASHED_ERROR: RefCell<Option<PyErr>> = const { RefC... |
e1d4c9eb387e258e587576c2a717a14ad9149849cd7e9cca6810a0652ac90e67 | Rust | 2,884 | 109 | use crate::columns::ColumnNamesAsTuple;
use crate::table::TableRepr;
use crate::{MappedSequence, Tuple, TupleRepr};
use minijinja::listener::RenderingEventListener;
use minijinja::value::{Enumerator, Object, ObjectRepr};
use minijinja::{State, Value};
use std::fmt;
use std::rc::Rc;
use std::sync::Arc;
#[derive(Debug)]... |
1e5d3be29a117e8b986ddabc606e2e0f9897adde4739e7e811416dbe36e976c7 | Rust | 2,906 | 83 | //! Cross-model registry for `--infer-schemas`: records, for each relation
//! referenced by the SQL being bound, which columns were confidently
//! inferred from usage. Shared across every model bound in a run.
//!
//! Writers populate the registry during binding. Once binding finishes,
//! consumers only read it; lat... |
56f3d2892c5e59fbb85febf28cf9cb910ee884aa9b1c5ea8f09de94d6bc05954 | Rust | 2,909 | 99 | #[macro_use]
pub mod macros;
pub mod adapter;
pub mod artifact_io;
pub mod atomic;
pub mod cancellation;
pub mod constants;
pub mod hashing;
pub mod io_utils;
pub mod node_selector;
pub mod pretty_string;
pub mod static_analysis;
pub mod stats;
pub mod stdfs;
pub mod string_utils;
pub mod tokiofs;
#[macro_use]
pub ext... |
082110b858cc939136b5125bde1316c77d35e27d0cbb5d6e71256e8c25933cef | Rust | 2,924 | 89 | use dbt_common::{AdapterError, AdapterResult};
use dbt_schemas::schemas::{DbtModel, InternalDbtNodeAttributes};
use minijinja::Value;
use crate::relation::config_v2::diff;
use crate::relation::snowflake::config::SnowflakeDescribeResults;
use crate::{
relation::config_v2::{
ComponentConfig, ComponentConfigL... |
851cef3f1abbff692bbbe3a341ec5ccba86453f1cf57f8b4ce8fb6363be267e8 | Rust | 2,925 | 85 | //! Generic provider trait + the one no-op stub used for every feature.
//!
//! A `Provider` represents one feature ("column lineage", "column impact",
//! "sample data", etc.) parameterised by its input and output types. The
//! default [`Provider::is_available`] returns `false`, so an unimplemented
//! stub reports u... |
cbb761174608262778ee6ef36c1085a377f229f22d00d2a9ee06144af3b1e2eb | Rust | 2,927 | 73 | //! HTTP server that powers dbt docs v2.
//!
//! Two jobs: turn a parquet index into a statically hostable site
//! ([`export_site`]), and serve that site locally (`dbt docs serve`). There is no
//! API — the browser queries the parquet itself with DuckDB-WASM, so everything
//! this once computed server-side now runs ... |
8c7ec7bccbb0682c96ebc2ea4a3dc7ab4ee7b323568e3bd541de1dd9ddd2d93f | Rust | 2,936 | 134 | use std::hash::{Hash, Hasher};
use std::{fmt, ops};
use serde::Serialize;
use crate::FullyQualifiedName;
/// Wrapper type for references to named SQL entities, such as tables, views,
/// functions, etc.
#[derive(Debug, Clone, Serialize)]
pub struct NamedReference<T> {
inner_ref: T,
pub is_prefix: bool,
}
im... |
3dc59798236fb126cc34fc9afbe3d54006e23c9f402b4d36bec2fbcd05ef2ff7 | Rust | 2,946 | 90 | use super::*;
#[test]
fn test_sql_find_statement_delimiters() {
let input = "SELECT 1; SELECT 2; SELECT 3;";
let result = sql_find_statement_delimiters(input, None);
assert_eq!(result, vec![8, 18, 28]);
let input = "-- a comment;\nSELECT 1 -- another comment;";
let result = sql_find_statement_deli... |
2e8288f5b02fc64b5cc1676b8e05eccc1f2c03ffa2ddf38f6beaca44afaa929c | Rust | 2,955 | 86 | //! Read-only access to `target/private/metadata/parse/nodes/` parquet files.
//!
//! Only the fields needed by `dbt agent schema` are read:
//! `unique_id`, `name`, `resource_type`, `original_path`, `depends_on`.
//!
//! Uses column projection so the large `payload` column is never decoded.
use std::collections::Hash... |
70c4fbf335c02f7a24d41917211722d3000dd861e2c9f0bfb20839cf11ca057f | Rust | 2,965 | 80 | //! Smoke coverage for bias correction through the direct alignment-mode entry
//! point. RAD has more exhaustive invariance coverage; this test ensures the
//! shared correction remains wired into BAM/SAM quantification.
use salmon_align::{quantify_alignments, AlignQuantOptions};
use std::io::Write;
use std::path::{P... |
bb28cb209e0fcf37848cd098a0334cc29f7c0b9cf7fac54a8c6cf256582dcc30 | Rust | 2,979 | 85 | //! ClickHouse-specific connection bootstrap for [`super::AdbcEngine`].
use std::borrow::Cow;
use dbt_adbc::Connection;
use dbt_auth::AdapterConfig;
use dbt_common::AdapterResult;
use crate::errors::{AdapterError, AdapterErrorKind, adbc_error_to_adapter_error};
use crate::metadata::clickhouse;
/// The profile `sche... |
88e0c18742108a11853b44964a629ad795b65729a275cd83abfecf61bd763052 | Rust | 2,989 | 75 | //! Helpers for wiring DataFusion `SessionContext` to the schema store.
use datafusion::{
execution::SessionStateBuilder,
prelude::{SessionConfig, SessionContext},
};
use datafusion_common::Result;
use dbt_schema_store::{DataStoreTrait, SchemaStoreTrait};
use std::sync::Arc;
use crate::catalog_list::SchemaSto... |
d0b97faa1bc29893ff28780e7ce830c5d936ade5ac01bd5edb6474204a1fcdb5 | Rust | 3,008 | 83 | use std::collections::BTreeMap;
use minijinja::Value;
pub mod bound_method;
pub mod date;
pub mod datetime;
pub mod strptime;
pub mod time;
pub mod timedelta;
pub mod tzinfo;
/// Byte index of the first `%f` conversion in a `strftime` format string, or
/// `None` if it contains none.
///
/// Python's `%f` is six zer... |
09c332bcdef767c6cbb5d7a3ae539a3520762f818deb9af636bfdd59ebe4bdeb | Rust | 3,035 | 99 | use serde::{Deserialize, Serialize};
use std::time::SystemTime;
/// An active OAuth session for a dbt platform user.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OAuthSession {
pub access_token: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub refresh_token: Option<String>,
p... |
04eb26ae9335b4a4251c84e7e259f76181b9cf1bca04d44c2df4a137757a2b43 | Rust | 3,053 | 91 | use dbt_common::{AdapterError, AdapterResult};
use dbt_schemas::schemas::{DbtModel, InternalDbtNodeAttributes};
use minijinja::Value;
use crate::relation::config_v2::diff;
use crate::relation::snowflake::config::SnowflakeDescribeResults;
use crate::{
relation::config_v2::{
ComponentConfig, ComponentConfigL... |
5042f14611c49b0c30d90144bc742bea0d6d7e6308669a04b943de71c7e9db7e | Rust | 3,059 | 88 | //! Function object type for dbt functions in Jinja templates.
//!
//! This module provides a wrapper type for function relations that renders as
//! function calls instead of relation names. This is specifically designed for
//! dbt functions which need to be rendered as qualified function names rather
//! than generi... |
dec55adb2b6fbe0d458283382a8095a438a0b6d6cfd57a8aecdda0b5fa370d13 | Rust | 3,073 | 97 | use std::cell::RefCell;
use actix_web::http::header::ContentType;
use actix_web::{web, App, HttpRequest, HttpResponse, HttpServer, Responder};
use minijinja::value::{Rest, Value};
use minijinja::{context, path_loader, Environment, Error, ErrorKind};
thread_local! {
static CURRENT_REQUEST: RefCell<Option<HttpReque... |
c8a1f65f246859b2c868e5cfd4da89deb9743c3bffbec311b91df078d6e1f88e | Rust | 3,078 | 88 | //! MiniJinja-Contrib is a utility crate for [MiniJinja](https://github.com/mitsuhiko/minijinja)
//! that adds support for certain utilities that are too specific for the MiniJinja core. This is
//! usually because they provide functionality that Jinja2 itself does not have.
//!
//! To add all of these to an environme... |
0de51ab9a291d70db809301a1980af37dbbb2d44493fcc20bf7171211723b6c6 | Rust | 3,121 | 100 | use dbt_common::{AdapterError, AdapterResult};
use dbt_schemas::schemas::{DbtModel, InternalDbtNodeAttributes};
use minijinja::Value;
use crate::{
relation::config_v2::{
ComponentConfig, ComponentConfigLoader, SimpleComponentConfigImpl, diff, impl_loader,
},
value::none_value,
};
use crate::relati... |
66cb7db91590eba23164e542098b9607a474a9e6dd1ec79d273c8eb407cd864c | Rust | 3,123 | 110 | #[derive(Debug, PartialEq, Eq, Clone)]
pub enum Expr {
Integer(i64),
Variable(String),
ArithmeticBinary(Box<Expr>, ArithmeticOp, Box<Expr>),
ComparisonBinary(Box<Expr>, ComparisonOp, Box<Expr>),
Call(Function, Vec<Expr>),
}
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum ArithmeticOp {
Add,
... |
4fbea9258db218d30ee1cb0235253ed60073b4fad672fde1c8ee6b5fb95d2bce | Rust | 3,125 | 91 | #![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg))]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/apache/arrow/refs/heads/main/docs/source/_static/favicon.ico",
html_favicon_url = "https://raw.githubusercontent.com/apache/arrow/refs/heads/main/docs/source/_static/favicon.ico"
)]
#![doc = include_s... |
f7b9eebfe66ab7bbf10c07693b86c79f85dbd01f4d442e4ae747b8c0753d522b | Rust | 3,139 | 124 | use arc_swap::{ArcSwap, ArcSwapOption};
use std::sync::Arc;
#[derive(Debug)]
pub struct Atomic<T> {
value: ArcSwap<T>,
}
impl<T> Atomic<T> {
pub fn new(value: Arc<T>) -> Self {
Self {
value: ArcSwap::new(value),
}
}
/// Loads the underlying value atomically.
pub fn loa... |
3740ce9b5f25fbb56bce780087b352c0f20d47e463850f9fb2374efa1edadc4e | Rust | 3,152 | 81 | //! Column-level lineage feature surface.
//!
//! Single-hop column lineage — every direct edge in `dbt.column_lineage`
//! that touches the requested node (and optionally a specific column).
//! Multi-hop downstream traversal for a column is a *different* surface;
//! see [`super::column_impact`].
//!
//! The propriet... |
791dec8b8135a2cad02e1c2856c9955b46ad0e3e2348f0c4efe708d2fc51db92 | Rust | 3,187 | 101 | use anyhow::{Result, bail};
use sha2::{Digest, Sha256};
use std::env;
use std::fs;
use std::path::{Path, PathBuf};
use std::time::Duration;
use toml_edit::DocumentMut;
/// Lowercase hex sha256 of `data`; the one hashing form shared across the crate.
pub(crate) fn sha256_hex(data: &[u8]) -> String {
hex::encode(Sha... |
3dfe8434e6946ec86eed4eaa5f470d4a3b5aa13703038ce9a95e739a1661fcf3 | Rust | 3,199 | 98 | use regex::Regex;
use std::io::{BufRead, BufReader};
use std::path::{Path, PathBuf};
use crate::{ErrorCode, FsError, FsResult};
/// Extracts a substring enclosed in the given regex pattern
pub fn find_enclosed_substring(msg: &str, re: &Regex) -> Option<String> {
if let Some(captures) = re.captures(msg)
&&... |
d4c74325847ea282c46cbb43d675e51598438cca7ba37218d6e213efa920e134 | Rust | 3,207 | 101 | //! Parse-time listener that warns when a `{% snapshot %}`/`{% docs %}` block
//! name is followed by a non-empty suffix dbt-core silently discards.
use std::path::PathBuf;
use dbt_common::tracing::dbt_emit::emit_warn_log_from_fs_error;
use dbt_common::{CodeLocationWithFile, ErrorCode, FsError, fs_err};
use minijinja... |
7964370ba1021fb53551b70bde6612ae47028ba8aeb9a746caf8137c34243f88 | Rust | 3,211 | 86 | use std::collections::BTreeMap;
use dbt_common::{ErrorCode, FsResult, err};
use dbt_schemas::schemas::{data_tests::DataTests, dbt_column::ColumnProperties};
use crate::resolve::resolve_tests::persist_generic_data_tests::{
ColumnTestEntry, LegacyTestSyntaxHandling,
};
type ModelDataTestVec = Vec<DataTests>;
pub ... |
4f8b0241e0e6ff46d53e04688618cf30b2ffc9bbb297bb2f521271bf8a6c9868 | Rust | 3,262 | 97 | //! Loads and validates `<project_root>/catalogs.yml` into a global holder.
use dbt_common::tracing::dbt_emit::emit_warn_log_message;
use dbt_common::warn_error_options::project_flags_get_value;
use dbt_common::{ErrorCode, FsResult, fs_err};
use dbt_schemas::schemas::{
dbt_catalogs::DbtCatalogs, dbt_catalogs_v2::v... |
fb373a7681312044262629bcc8178f41db76405a0fdffe5f4cfacb4edbb826d0 | Rust | 3,273 | 83 | //! Public classifier definition shapes and built-in defaults.
//!
//! The data types here are the on-the-wire description of a classifier (its
//! name, labels, propagation flag, etc.) plus the static list of built-ins
//! shipped with dbt. Registry assembly, YAML loading, validation, and merge
//! semantics live in t... |
cdb3f984240dc01fb417a465a98786a3a29be27c53f016fc514462bf72d45b6c | Rust | 3,293 | 101 | //! A validation module for MiniJinja, intended to provide validation utilities.
//!
//! This module provides functions to validate values against a set of possible values or types,
//! similar to dbt's validation module.
use minijinja::value::{Object, ObjectRepr};
use minijinja::{Error, ErrorKind, State, Value};
use ... |
d7f911069f439be0a83a4d747165260f178e487ad34755f55d986acc2adb63ed | Rust | 3,298 | 113 | 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};
use... |
eaca602e40cce4d0bf94522e96440bbdf9a7ac3d91ed839f8815995c8fffe75d | Rust | 3,324 | 96 | use dbt_cloud_api::apis::Error as CloudApiError;
use dbt_platform_auth::AuthError;
/// Errors surfaced by the dbt platform metadata SDK.
#[derive(Debug, thiserror::Error)]
pub enum PlatformError {
/// Credential resolution failed. Inspect [`AuthError::login_hint`] for a
/// user-facing next step.
#[error("... |
99b0f84b01e7e10bf10c2e7384d0ec219dae63eec55dc9d43ae003e83582e958 | Rust | 3,341 | 96 | use dbt_telemetry::{CallTrace, Invocation, LogMessage, Unknown, create_process_event_data};
use dbt_tracing::TelemetryAttributes;
use dbt_tracing::layers::data_layer::{
RootSpanTraceContext, TelemetryDataLayerConfig, UnstructuredLogAttributesInput,
UnstructuredSpanAttributesInput,
};
/// Creates the dbt data ... |
3774250f318acf471765edfaf85fe0e773d399780c23a370836fdf986264f484 | Rust | 3,349 | 81 | //! Invocation-scoped storage for the Jinja `graph` mapping.
//!
//! In dbt-core, `graph` is `manifest.flat_graph` — a single plain `dict` that
//! hangs off the one `Manifest` instance and lives for the whole invocation.
//! It is empty during parsing and filled in with the flat graph afterwards,
//! but it is the *sa... |
2e3aaed717917954a4c9aa902030bb0a9ecc9a66a8b47e34d1979557774a0be0 | Rust | 3,354 | 121 | use std::error;
use std::fmt;
#[derive(Debug, Clone)]
pub struct ResponseContent<T> {
pub status: reqwest::StatusCode,
pub content: String,
pub entity: Option<T>,
}
#[derive(Debug)]
pub enum Error<T> {
Reqwest(reqwest::Error),
Serde(serde_json::Error),
Io(std::io::Error),
ResponseError(Res... |
26041a11cfdb9514010fe48dc54ef4ed0e61d38f1aae1beb7435d47b4ee0d0b4 | Rust | 3,362 | 94 | mod resolve;
use std::{
io::ErrorKind,
path::{Path, PathBuf},
};
pub use dbt_schemas::schemas::{DbtCloudConfig, DbtCloudContext, DbtCloudProject};
pub use resolve::{
CloudCredentials, ResolvedCloudConfig, detect_unlinked_project, resolve_cloud_config,
};
/// Test-only env var honored by [`get_cloud_proje... |
b0460802eb61aec3b5cdfcf352e7831d5b290ad532ee4def9049804c47fbeaec | Rust | 3,374 | 111 | use adbc_core::error::{Error, Result, Status};
use std::env;
const TRUE_VALUES: [&str; 4] = ["1", "true", "yes", "on"];
const FALSE_VALUES: [&str; 5] = ["0", "false", "no", "off", ""];
/// [`env_var_bool`] for opt-in flags: unset or unparseable is `false`, with a
/// warning. For flags read deep in the loader, where... |
fc73a704b9e8396961f40afc392ef3c86c22e9602cd7bf7467a760a7b7945950 | Rust | 3,376 | 84 | use std::collections::BTreeMap;
use chrono::{FixedOffset, NaiveDate, NaiveTime, TimeZone as _};
use dbt_yaml::Value as YmlValue;
use minijinja::Value as MinijinjaValue;
use minijinja_contrib::modules::py_datetime::{date::PyDate, datetime::PyDateTime};
/// Converts a resolved YAML 1.1 timestamp into a Jinja date or da... |
32f3a23bf5f48539df8182070833ae7c54a8908f6e189edc6acdf129392b05fa | Rust | 3,399 | 113 | #![cfg(feature = "unstable_machinery")]
use minijinja::{
machinery::{tokenize, Span, Token, WhitespaceConfig},
syntax::SyntaxConfig,
};
use std::fmt::Write;
use serde::Deserialize;
#[derive(Deserialize, Default)]
#[serde(default)]
struct TestSettings {
keep_trailing_newline: bool,
lstrip_blocks: bool... |
e7cd36607f96890af34cc9a9100001a2bc1f07eb14718575ee0188cfe6a3f2d9 | Rust | 3,418 | 71 | //! Phase initializers construct their typed ctx struct and feed it into the
//! Jinja env via either:
//!
//! * [`to_jinja_btreemap`] — converts a `Serialize` ctx struct into the
//! `BTreeMap<String, Value>` shape minijinja consumes. Used in two places:
//! * **Env globals**: `JinjaEnvBuilder.with_globals(...)` a... |
74547ba8d95f8058c616f00660475b1d88b9cb4d6ebff4d6a1399bad917019e8 | Rust | 3,424 | 125 | /// fs_err!(code,msg) construct a user-facing [FsError], to be used for further
/// processing, e.g. typically used in `.map_err(|_| fs_err!(..))`, etc
#[macro_export]
macro_rules! fs_err {
($code:expr, $($arg:tt)*) => {
Box::new($crate::FsError::new(
$code,
format!($($arg)*),
... |
b2e4928870ad588134a8b2625f99c9785f5b063e0706751456993156fbff2665 | Rust | 3,429 | 82 | use dbt_common::{
ErrorCode, FsResult,
constants::{DBT_DEPENDENCIES_YML, DBT_PACKAGES_YML},
err, tokiofs,
};
use dbt_schemas::schemas::packages::DbtPackages;
use std::path::Path;
#[derive(Clone, Copy, Debug)]
pub enum DbtPackageType {
PackageYml,
DependenciesYml,
}
impl AsRef<str> for DbtPackageTy... |
b33387f40723c98e91d57e2c14efe89bd7a1b79a3a9b37eb71d5a1425ed6b687 | Rust | 3,463 | 94 | use std::collections::BTreeMap;
use std::sync::Arc;
use dbt_common::cancellation::{CancellationToken, CancelledError};
use dbt_common::io_args::IoArgs;
use dbt_jinja_utils::jinja_environment::JinjaEnv;
use dbt_schemas::schemas::ResolvedCloudConfig;
use dbt_schemas::schemas::packages::DbtPackagesLock;
use crate::git_c... |
6e938a426664f28d978d2ab360f52dbf1057938cc3c1469acfb2bd59eed1e5d0 | Rust | 3,477 | 117 | 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};
use... |
39284868111fd9f11b4161c98fdce5b2155ad562f4d292c446cbda6c0f572a9b | Rust | 3,478 | 91 | use std::path::{Path, PathBuf};
use dbt_common::io_args::{
ReplayMode, TimeMachineMode, TimeMachineModeKind, TimeMachineRecordConfig,
TimeMachineReplayConfig,
};
use uuid::Uuid;
use crate::CommonArgs;
/// Find the latest time machine recording in a directory.
///
/// Recordings are stored in subdirectories n... |
4c45e6f594ce690559fb5b8584ccb8a1bf385ef7eed1bf4ab900a37ec2b7ff0d | Rust | 3,481 | 88 | use std::sync::{Arc, Mutex};
use dbt_telemetry::Invocation;
use dbt_tracing::{
TelemetryOutputFlags,
emit::create_info_span,
layer::{ConsumerLayer, MiddlewareLayer},
test_support::mocks::{MockDynSpanEvent, TestLayer, test_data_layer},
};
use tracing::level_filters::LevelFilter;
use crate::{
ErrorC... |
42809569cc542a00606a1f56c4aa229f98b6acfc62de9fb29352e8e23013fd4f | Rust | 3,494 | 79 | use arrow_schema::ArrowError;
use dbt_auth::AuthError;
pub use dbt_common::error::{
AdapterError, AdapterErrorKind, AdapterResult, AsyncAdapterResult, Cancellable, into_fs_error,
};
/// Convert [AuthError] to [AdapterError].
///
/// Use with `.map_err(auth_error_to_adapter_error)` where needed.
#[inline]
pub fn a... |
d6df6774f3ae8e406d7c210d7554f5b46e3feda6fd150540ba66db1d0b90f387 | Rust | 3,500 | 99 | //! `JinjaObject<T>` — a serializable wrapper that preserves minijinja `Object`
//! identity through serde.
//!
//! Plain `serde::Serialize` on a struct field of type `T: Object` would emit
//! `T`'s data shape, losing the dispatch needed for callables like `ref(...)`.
//! `JinjaObject<T>` instead serializes by wrappin... |
3370b9f23b5c6c1db3bb17bfc4849d24b73e55f05b0459f6c0e3347899aab565 | Rust | 3,524 | 113 | use std::path::Path;
use crate::machinery::Span;
/// Trait for typechecking event listeners.
pub trait TypecheckingEventListener {
/// Returns a reference to the underlying Any type.
fn as_any(&self) -> &dyn std::any::Any;
/// Called when a warning is issued during typechecking.
fn warn(&self, messag... |
41076a6c0f3e5beef678038eb41b5d1498cf61bdb4ee70d33e1a06ce33019956 | Rust | 3,543 | 93 | use std::fmt;
use dbt_common::DiscreteEventEmitter;
use crate::adapter::AdapterFeature;
use crate::antlr_parser::AntlrParserFeature;
use crate::cli::CliFeature;
use crate::index::IndexFeature;
use crate::jinja::JinjaFeature;
use crate::lake_compute::LakeComputeFeature;
use crate::loader::LoaderFeature;
use crate::log... |
f27e36b36338672b4f56bb64804d9e65d26c372537faddd946019d6bb930fc70 | Rust | 3,561 | 78 | //! `salmon-model`: statistical models used during quantification.
//!
//! # What these models are for
//!
//! Sequencing is not a uniform sampler. A fragment's chance of being observed
//! depends on how long it is, what sequence sits at its ends, how GC-rich it is,
//! and where in the transcript it starts. Left unco... |
2b28357353b6188e7e4776f93ecaf58ac4f710418961948065ce6a4fd583eaa5 | Rust | 3,584 | 107 | use std::collections::HashMap;
use dbt_common::{FsResult, hashing::code_hash, io_args::IoArgs, stdfs};
use dbt_schemas::state::{DbtAsset, DbtState};
use crate::types::InputKind;
// Helper function to convert asset path to project-relative path
fn asset_to_relative_path(io: &IoArgs, asset: &DbtAsset) -> std::path::Pa... |
556d2fba741e417f999468871cff017901c46289e5fa3f05a3637584ac08eb63 | Rust | 3,586 | 119 | use std::collections::HashMap;
use std::fmt;
use std::sync::Arc;
use minijinja::value::{from_args, Kwargs, Object, Value};
use minijinja::{Environment, Error};
/// A copy-on-write object that holds an assembled query.
#[derive(Debug, Clone)]
pub struct Query {
table: Arc<str>,
filters: Arc<HashMap<String, Val... |
b0b1bc96436512c0f93f699ff4e3b3e8154481f841c44b5e96b59d4a72efe738 | Rust | 3,587 | 116 | use std::marker;
use std::pin::Pin;
use std::result::Result;
use std::task::{Context, Poll};
use tokio::sync::watch;
/// Fail-fast signal.
///
/// Fusion is highly parallel. It's desirable to have a fail-fast mechanism to
/// quickly cancel ongoing operations when a critical error is detected without
/// waiting for ... |
5e7ed91c2e144baad2a79ed5255b41d29889754492ca42329b0a42b84e2486ca | Rust | 3,593 | 120 | //! A builder for a [`Connection`]
//!
//!
use std::fmt;
use adbc_core::{
error::Result,
options::{OptionConnection, OptionValue},
};
use crate::{Connection, Database, builder::BuilderIter};
/// A builder for [`Connection`].
///
/// The builder can be used to initialize a [`Connection`] with
/// [`Builder::... |
c67d308a11325b13147970907d777f1b33fb4afb7280dda361b09fb2fe45cb10 | Rust | 3,594 | 97 | use std::env;
use std::sync::OnceLock;
use dbt_schemas::schemas::ResolvedCloudConfig;
#[derive(Debug)]
pub struct InvocationConfig {
pub dbt_version: String,
pub environment: String,
pub account_identifier: String,
pub project_id: String,
pub environment_id: String,
pub job_id: String,
}
#[de... |
d446888c8acdedc970edf465a5c44cfa5a6e5916fca081541c2bbebc0a8e608e | Rust | 3,596 | 131 | use crate::{AdapterConfig, Auth, AuthError, AuthWarningPrinter, auth_configure_pipeline};
use database::Builder as DatabaseBuilder;
use dbt_adbc::{Backend, database};
use std::borrow::Cow;
#[derive(Debug)]
enum PostgresAuthIR<'a> {
Database {
user: &'a str,
password: &'a str,
host: &'a str... |
63244c2082bf7584921b0e5089a8b4e47e09312681631750b15aaa5c134c2615 | Rust | 3,602 | 111 | use std::path::{Path, PathBuf};
use std::sync::Arc;
use chrono::{DateTime, SecondsFormat, Utc};
use crate::providers::Providers;
pub use dbt_docs_core::{DistInfo, TelemetryHydration};
/// Shared application state held by the axum router.
pub struct AppState {
/// The information schema's versioned directory, whi... |
20b18170d0e88511f568da20835d8634e893b0ffda876d96cd3bfaf874142136 | Rust | 3,614 | 142 | #![cfg(feature = "deserialization")]
use std::{collections::BTreeMap, sync::Arc};
use serde::{Deserialize, Serialize};
use similar_asserts::assert_eq;
use minijinja::value::{Enumerator, Object, ObjectRepr, Value};
#[test]
fn test_into_deserializer() {
use serde::de::IntoDeserializer;
let v = Value::from(42)... |
5149d746a603524fc9903e0f1058368971fee66c645e4ed6ae8e4899537cc8d1 | Rust | 3,619 | 111 | use dbt_common::{AdapterError, AdapterResult};
use dbt_schemas::schemas::{DbtModel, InternalDbtNodeAttributes};
use minijinja::Value;
use crate::relation::config_v2::{
ComponentConfig, ComponentConfigLoader, SimpleComponentConfigImpl, diff, impl_loader,
};
use crate::relation::snowflake::config::{
SnowflakeDes... |
335e41302558e76343dc6f840cd12b1cf9fb55fba820c9f19930484292fbd716 | Rust | 3,624 | 129 | use std::collections::HashMap;
use std::hash::{Hash, Hasher};
use arrow_array::RecordBatch;
use arrow_schema::ArrowError;
use siphasher::sip128;
use crate::hashers::ColumnHasher;
use crate::hashers::TableHasher;
pub struct Grouper {
/// Initial hasher state based on the schema of the grouping/join keys
initi... |
fcafc707d0314c5d0ebb3d3af9de4663fe2aafa365a93373556753886b47ad29 | Rust | 3,624 | 78 | //! Typed Jinja contexts for dbt-fusion phase environments.
//!
//! This crate defines the typed shape of every value that becomes available to
//! Jinja templates across the load, resolve (parse), render (compile), and run
//! phases. It replaces the historical pattern of constructing per-phase
//! `BTreeMap<String, M... |
817e817129c96c14e1d85d1009b499b813e728998e96c4eb12e54a2cba51557d | Rust | 3,634 | 104 | use crate::args::BumpCargoVersionArgs;
use crate::release_version::validate_release_version;
use crate::utils::cargo_workspace_root;
use anyhow::{Context, Result, anyhow};
use std::fs;
use std::path::Path;
use std::process::{Command, ExitCode};
use toml_edit::{DocumentMut, value};
pub fn execute(args: BumpCargoVersion... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.