sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
a1ed85e8f64131977dfa23a7bc45b25220c69028724ac0edd7bbde8ffd9d8125 | Rust | 546 | 16 | use std::collections::BTreeMap;
use dbt_yaml::UntaggedEnumDeserialize;
use serde::Serialize;
/// Variable values in a dbt project.
#[derive(Clone, Debug, Serialize, UntaggedEnumDeserialize, PartialEq, Eq)]
#[serde(untagged)]
pub enum DbtVars {
/// Null YAML values (bare `key:` or `key: null`). Must be listed befo... |
c38e8afdd3cf9e2e0ecd0f5a01927c328945c4268c987216401fb7b2951450a7 | Rust | 553 | 14 | //! DataFusion provider implementations backed by the dbt schema store.
//!
//! These types bridge the gap between canonicalized schemas persisted by
//! `dbt-schema-store` and DataFusion's catalog/table abstractions. They lazily
//! provision catalogs, schemas, and table providers so that the Fusion runtime
//! can r... |
29f638f68e3a06b6f94d237d962b733aae7b5b6194df041fa4974040880634c0 | Rust | 558 | 25 | /// Support for graceful shutdown on Ctrl+C or fail-fast trigger.
pub mod ctrl_c;
// Re-export the main library functionality
pub mod compilation;
pub mod dbt_lib;
pub mod driver;
pub use driver::{DbtCompilationDriver, DbtTaskExecutionDriver};
pub mod freshness;
pub mod retry;
pub mod vars;
pub mod version_check;
pu... |
cd52d5af9d2531817ced81b8c57258e2c9afe927e900b796cad6ee033cc4f2d4 | Rust | 563 | 25 | use std::sync::Arc;
use dbt_common::FsResult;
mod execute;
mod execute_status;
mod state_guidance;
pub use execute::execute_login;
pub use execute_status::execute_login_status;
#[async_trait::async_trait]
pub trait LoginHooks: Send + Sync {
/// Called after a successful login to dispatch async post-login action... |
8af29fede30642e3ea1b011d335fc5130ee99ca0185cce6330f543328c49f44e | Rust | 566 | 21 | use minijinja::{context, syntax::SyntaxConfig, Environment};
fn main() {
let mut env = Environment::new();
env.set_syntax(
SyntaxConfig::builder()
.line_statement_prefix("#")
.line_comment_prefix("##")
.build()
.unwrap(),
);
env.add_template("hell... |
852d488ca338c7321b16ce2aacba805ea7ae4c532d78c28f727d08bbdd240a7a | Rust | 568 | 17 | #![cfg(feature = "unstable_machinery")]
use minijinja::machinery::parse;
#[test]
fn test_parser() {
insta::glob!("parser-inputs/*.txt", |path| {
let contents = std::fs::read_to_string(path).unwrap();
let filename = path.file_name().unwrap().to_str().unwrap();
let ast = parse(&contents, file... |
0aa33169dc3c510deebe611b4de9a8f9ad7367f97ad18246c889a017131b6d3b | Rust | 574 | 16 | pub mod config;
mod defaults;
pub use defaults::{DEFAULT_DATABRICKS_DATABASE, INFORMATION_SCHEMA_SCHEMA, SYSTEM_DATABASE};
pub mod typed_constraint;
/// Whether a raw Databricks/Unity Catalog table-type string denotes a shallow clone.
/// Case-insensitive: callers may pass either the `information_schema.tables.table... |
32ebd081d0b0f9799bd4dc055e57439c5662ea2c867e44d888dc3101f6e8358b | Rust | 578 | 22 | #![expect(unused_imports)]
pub(crate) mod cluster_by;
pub(crate) use cluster_by::{ClusterBy, ClusterByLoader};
pub(crate) mod description;
pub(crate) use description::{Description, DescriptionLoader};
pub(crate) mod kms_key;
pub(crate) use kms_key::{KmsKey, KmsKeyLoader};
pub(crate) mod labels;
pub(crate) use label... |
e52167371a5128eed8605f2743e931265aa11ed4ca17eeca949be725117c2274 | Rust | 582 | 18 | use crate::math::sufficient_statistics;
use crate::model::network::Network;
/// Updating an exponential family state node
pub fn prediction_error_exponential_state_node(
network: &mut Network,
node_idx: usize,
_time_step: f64,
) {
let mean = network.attributes.states[node_idx].mean;
let nus = netwo... |
2ea7fc2d6428d14dd100bd3224010d95002eff9e53b10dbf1e2c08e689314f0f | Rust | 584 | 12 | use crate::io_args::LogLevel;
pub fn log_level_filter_to_tracing(level_filter: &LogLevel) -> tracing::level_filters::LevelFilter {
match *level_filter {
LogLevel::Off => tracing::level_filters::LevelFilter::OFF,
LogLevel::Error => tracing::level_filters::LevelFilter::ERROR,
LogLevel::Warn =... |
2d2532b16318f411adef0a84982bc67523bc0c2f64a8fee5480d070272f33c91 | Rust | 588 | 20 | pub mod constraint;
pub mod dialect;
pub mod error;
pub mod expr;
pub mod ident;
pub mod span;
pub mod types;
pub mod utils;
// Don't re-export symbols for new sub-modules. See note below.
pub mod named_reference;
pub mod sources_extractor;
// TODO we should decide whether inner mods are pub, or we re-export individu... |
f57df81e54af490982f5aa26e1eb140cbebf1f4ca8cca47f41dacd89cfa4e194 | Rust | 589 | 23 | use minijinja::{context, Environment};
use serde::Serialize;
#[derive(Serialize)]
pub struct Page {
title: String,
content: String,
}
fn main() {
let mut env = Environment::new();
env.add_template("layout.html", include_str!("layout.html"))
.unwrap();
env.add_template("index.html", include... |
dc350facabc12747aca7684de7260bd48855639e6b6e75023a6ecced849cd31d | Rust | 594 | 14 | //! Prediction error for binary leaf layers, mirroring
//! `pyhgf/updates/vectorised/binary/prediction_error.py`.
use crate::vectorised::layer::LayerState;
/// Binary leaf prediction error: `δ = (mean − μ̂) / π̂`, with the posterior
/// precision set equal to the expected precision (no precision update).
///
/// Mirr... |
30eef8f204d8146490a66cb2161835a38cf6224580822e02c50280c56e4fa541 | Rust | 596 | 24 | use minijinja::compiler::cfg::build_cfg;
use minijinja::compiler::instructions::Instruction;
#[cfg(test)]
#[test]
fn simple_cfg() {
use minijinja::machinery::Span;
let code = vec![
Instruction::LoadConst(1.into()),
Instruction::JumpIfFalse(4, Span::default()),
Instruction::LoadConst(2.... |
7aba664a5263a8ec8cb8fd229e7669d657226311bbd24b69d9a3bf6712c918cb | Rust | 602 | 27 | use minijinja::{context, Environment};
fn make_env() -> Environment<'static> {
let mut env = Environment::new();
#[cfg(feature = "bundled")]
{
minijinja_embed::load_templates!(&mut env);
}
#[cfg(not(feature = "bundled"))]
{
env.set_loader(minijinja::path_loader("src/templates"... |
fbc24ba699cafcc7326dc5fbb6aa7a0e422afcb0652850bed268ae22265af852 | Rust | 603 | 14 | //! Prediction error for categorical leaf layers, mirroring
//! `pyhgf/updates/vectorised/categorical/prediction_error.py`.
use crate::vectorised::layer::LayerState;
/// Categorical leaf prediction error: the raw residual `δ = one_hot − softmax`
/// (the logit-space cross-entropy gradient), posterior precision left a... |
f3e41a85efc5606b784f294c9c8948218f02cc5cf46660be8ad39243b2803ded | Rust | 620 | 19 | //! Shared Jinja variable and environment helpers for dbt.
//!
//! Provides `env_var`, `Var`, `VarFunction`, `ConfiguredVar`, and `DbtVars`
//! without depending on `dbt-common`, `dbt-jinja-utils`, or `dbt-schemas`.
mod configured_var;
mod dbt_vars;
mod env_var;
mod utils;
mod var;
pub use configured_var::ConfiguredV... |
20d4118542e5b0a499bb37a861f43e8eba1593f7b0e0c58b7a4011f79701d465 | Rust | 629 | 27 | use clap::Parser;
use std::path::PathBuf;
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
struct Args {
/// Path to TOML config file
#[arg(long, default_value = "adbc_conf.toml")]
config: PathBuf,
/// Profile name in config file
#[arg(long, default_value = "default")]
p... |
98d49667dcdbd6d37e6a52a1a674ef202d016eb14d16cf877ca8512e0c8c7054 | Rust | 634 | 19 | use dbt_telemetry::StateModifiedDiff;
pub fn format_state_modified_diff_lines(diff: &StateModifiedDiff) -> Vec<String> {
let unique_id = diff.unique_id.as_deref().unwrap_or("unknown");
let mut lines = vec![format!(
"[state_mod_diff] unique_id={}, node_type_or_category={}, check={}",
unique_id, ... |
202145b389ec364a6052b18dfb21542de6b02214df9a89f6b07826a3653c0ec2 | Rust | 635 | 22 | //! Dump the contents of a record/replay `recordings.db` sqlite file.
//!
//! Usage: `dump-recordings <path/to/recordings.db>`
use std::path::PathBuf;
use std::process::ExitCode;
fn main() -> ExitCode {
let mut args = std::env::args_os().skip(1);
let Some(path) = args.next() else {
eprintln!("usage: d... |
4177641320a169439c101551cc868e3acb73e29e473e60187475321e4e7a03ce | Rust | 638 | 18 | mod chain;
mod credential;
mod error;
pub mod resolver;
mod session_cache;
/// Serializes all tests that read or write process-global environment variables,
/// across every module in this crate, preventing false failures from parallel execution.
#[cfg(test)]
pub(crate) static TEST_ENV_LOCK: std::sync::Mutex<()> = std... |
dbd961505d8d1aaf756a56f7a115d5cb835b52a4ee09658f1344da3413980d8a | Rust | 638 | 24 | use std::fmt;
use dbt_frontend_common::span::Span;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MacroSpan {
pub macro_span: Span,
pub expanded_span: Span,
}
// format macrospan as (macro_span.start-macro_span.end) => (expanded_span.start-expanded_span.end)
i... |
ee0929811a602b7a261469ed593cba4d959e41e6b359c7690da9748b0621093f | Rust | 646 | 10 | //! Re-export of minijinja's generic taint-propagation wrapper.
//!
//! `IntrospectiveValue` used to live here, but it has zero dependency on
//! anything `dbt-adapter`-specific (see its doc comment in minijinja), and
//! minijinja's own VM (`Macro::call`) now needs to manufacture tainted
//! values too (see the "any t... |
37445923568ff6de32dd5d0fd8bad6ca9caa8c3046379331a75a1e667db7e4ea | Rust | 658 | 20 | use dbt_tracing::error::TracingError;
use crate::{ErrorCode, FsError};
/// Fusion error bridge for tracing-owned errors.
impl From<TracingError> for FsError {
fn from(error: TracingError) -> Self {
let code = match error {
TracingError::AlreadyInitialized
| TracingError::SetGlobalS... |
d9033b997ea24d9fe744c9e7b27e80e478bcdf808e6261e0d99ecd2d62c9be35 | Rust | 659 | 23 | // Force-link the BLAS provider when the `blas` feature routes ndarray's
// `.dot()` through DGEMM; nothing references it directly otherwise.
#[cfg(feature = "blas")]
extern crate blas_src;
pub mod math;
pub mod model;
pub mod optimiser;
pub mod updates;
pub mod utils;
pub mod vectorised;
use pyo3::prelude::*;
/// T... |
87d7bf9f18125b566b3280a0d625e351843773e901ce9a5a1d371a757e636fbd | Rust | 677 | 22 | pub use crate::pretty_string::{BLUE, CYAN, DIM, GREEN, MAGENTA, PLAIN, RED, WHITE, YELLOW};
use console::Style;
use dbt_tracing::SeverityNumber;
pub fn severity_to_color_style(severity_number: SeverityNumber) -> &'static Style {
match severity_number {
SeverityNumber::Error => &RED,
SeverityNumber:... |
b75a5faa2cbb9bc7b964ae286ee9d47f6e5e660093c77fb30a53c8ede69597ab | Rust | 703 | 25 | use std::sync::Arc;
use async_trait::async_trait;
use dbt_adapter::engine::SidecarClient;
use dbt_common::FsResult;
use dbt_common::io_args::IoArgs;
use dbt_schemas::state::ResolverState;
/// Factory for creating a [SidecarClient] at runtime.
#[async_trait]
pub trait SidecarClientFactory: Send + Sync {
async fn c... |
db82df3464f9e2e83c24cf4c8001171da989bc6c42f0db9417d7039435b54522 | Rust | 706 | 27 | /*
* dbt Cloud API v3
*
* The version of the OpenAPI document: 3.0.0
* Contact: support@getdbt.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ProjectEnveloped {
#[ser... |
81dadc502acdcc1b97e4ed0bb80c71c3c081b0ab8239ba4b11d900f4b65abbb0 | Rust | 709 | 22 | //! GitHub token resolution.
//!
//! We intentionally read from env only (`GITHUB_TOKEN`) and avoid shelling out
//! to git credential helpers in this layer.
/// Get a GitHub token from the environment, if present.
pub fn get_github_token() -> Option<String> {
std::env::var("GITHUB_TOKEN")
.ok()
.f... |
24d9de2faf7b00c00b087b01d030d0fb55eb4aa27817d3b8d63cf45ff101447e | Rust | 717 | 15 | use crate::model::network::Network;
/// Prediction error for a binary state node
pub fn prediction_error_binary_state_node(network: &mut Network, node_idx: usize, _time_step: f64) {
let mean = network.attributes.states[node_idx].mean;
let expected_mean = network.attributes.states[node_idx].expected_mean;
l... |
5eb5c63f447deac738423ca19d3a39079f4bf32516e5c79ebc07eae76a5b5070 | Rust | 753 | 26 | use crate::{Auth, AuthError, config::AdapterConfig};
use dbt_adbc::{Backend, database};
/// DuckDB authentication (no-op - local file database)
pub struct DuckDBAuth;
impl Auth for DuckDBAuth {
fn backend(&self) -> Backend {
Backend::DuckDBExtended
}
fn configure(&self, config: &AdapterConfig) ->... |
bf0e5a26771c5d5fc81d11e4670fec98199ff848e30a4eb4119d3d7026fdb5ab | Rust | 762 | 18 | use std::collections::BTreeMap;
use dbt_schemas::schemas::profiles::TargetContext;
use minijinja::value::Value as MinijinjaValue;
pub fn build_target_context_map(
profile: &str,
target: &str,
target_context: TargetContext,
) -> BTreeMap<String, MinijinjaValue> {
let target_context_val = dbt_yaml::to_v... |
507cb789d50ea7c9e485bdbb53a13653d1b295dba85baa28cac9c863d2bb326a | Rust | 770 | 26 | mod assets {
#![allow(clippy::disallowed_methods)] // RustEmbed generates calls to std::path::Path::canonicalize
use rust_embed::{EmbeddedFile, RustEmbed};
#[derive(RustEmbed)]
#[folder = "assets/"]
pub struct Asset;
impl Asset {
pub fn load_file(filename: &str) -> Option<EmbeddedFile... |
3805ebb2f1c5dd1f9b0cb1cb52637e72d18240212f9093aff06a37361291b3eb | Rust | 790 | 26 | pub mod cloud_http_client;
mod deps;
mod load_packages;
mod load_profiles;
mod load_vars;
mod upload_artifact_ingest;
pub mod loader;
pub mod loader_hooks;
pub use deps::execute_deps_command;
pub use load_packages::{
build_internal_dbt_project, construct_internal_packages, internal_macro_package_names,
intern... |
79b0b8ffe61d199dcfc3e31a086f99f6c21fad55d11725739b220f7d348cfa2d | Rust | 797 | 23 | //! This is a small example program that evaluates an expression and returns
//! the result on stdout in JSON format. The values provided to the script
//! are the environment variables in the `env` dict.
use std::collections::BTreeMap;
use std::env;
use minijinja::{context, Environment};
fn main() {
let args = ... |
ebee82bda815064963623f04471fe917cada78be448de9d72c1569331eb5b69b | Rust | 801 | 30 | //! This module contains the rendering functionality for the load phase.
use std::collections::BTreeMap;
use minijinja::Value;
use serde::Serialize;
use crate::{functions::Var, phases::load::secret_renderer::secret_context_env_var};
pub mod init;
pub mod secret_renderer;
/// A struct that contains the context for ... |
b6d1615636bf4ef5eb8b01347e729e218449a3644e2460fe1b4cbfd83c951b4a | Rust | 803 | 28 | #[macro_use]
pub mod macros;
mod adapter_errors;
mod code_location;
mod codes;
mod compiled_spans;
mod preprocessor_location;
mod tracing;
mod types;
mod utils;
// Re-export all public types and utilities
pub use adapter_errors::{
AdapterError, AdapterErrorKind, AdapterResult, AsyncAdapterResult, into_fs_error,
}... |
3c0f5823b07da0c8aecd69724c752a064650fbe1f43e53e51fd0bec9d48d7bbf | Rust | 806 | 30 | use crate::{
model::network::Network, updates::nodalised::observations::observation_update,
utils::function_pointer::UpdateStep,
};
/// Single time slice belief propagation.
#[inline(always)]
pub fn belief_propagation(
network: &mut Network,
observations_set: &[f64],
predictions: &[(usize, UpdateSt... |
8c9d3bd94e05de11038922a0fbad894243043bb203ff2a0d3ffeb1a0b01cb6e3 | Rust | 809 | 36 | use std::time::Duration;
use minijinja::{context, Environment, Value};
const TEMPLATE: &str = r#"
The stream we will iterate over: {{ stream }}
Results as they come in:
<ul>
{%- for item in stream %}
<li>Item {{ item }}</li>
{%- endfor %}
</ul>
"#;
fn generate_items() -> impl Iterator<Item = Value> {
(0..20)... |
310280ffe9d094e0bdc2b10d0274e27b4bf13a31ff1b2e91e7ffcef70df1894f | Rust | 811 | 34 | use dbt_clap_core::CommonArgs;
/// Configuration for the ANTLR parser.
pub trait AntlrParserConfig: Send + Sync {
/// The ANTLR parser configuration is a set of globals initialized by this trait's
/// implementation.
fn apply_configuration(&self, common_args: &CommonArgs);
}
pub struct AntlrParserFeature ... |
5b3060080895ddc8b4e8462834933493336c179badd36dbab8478bc2786124ef | Rust | 831 | 17 | // Names of ClickHouse driver options -------------------------------------
/// Key prefix for passing a ClickHouse server setting through the driver:
/// `clickhouse.setting.<name>`, string-valued, accepted at Database,
/// Connection and Statement level; sent as a URL query parameter on every
/// HTTP request.
pub c... |
aeb210231c34715921e69675f8b6b360c9fe01debe84354c2f8bebe7c364e400 | Rust | 831 | 34 | use minijinja::{context, Environment, Value};
use minijinja_contrib::add_to_environment;
fn render_template(env: &Environment, tmpl: &str, ctx: Value) -> String {
let tmpl = env.get_template(tmpl).unwrap();
tmpl.render(context! {
// This variable is used by `datetimeformat` to pick the right
//... |
80a37508fc5252a3b5d9e02032eb4999e4a7b84cbd6382576525c181405b3f05 | Rust | 837 | 30 | //! This example dumps out YAML by using auto escaping.
use std::collections::BTreeMap;
use std::env;
use minijinja::syntax::SyntaxConfig;
use minijinja::{context, Environment};
fn main() {
let mut env = Environment::new();
env.set_syntax(
SyntaxConfig::builder()
.block_delimiters("{%", "%... |
459c91e905475c35de3681ab01815997ed4a65a43bcbed9e210e9847e0c76785 | Rust | 844 | 20 | //! A small, dependency-light toolkit for coordinating access to files shared
//! between independent OS processes.
//!
//! This crate provides two independently useful pieces:
//!
//! - [`lease`]: a file-based lease (lock with a TTL, not a hold-forever mutex)
//! so a crashed or hung process can never wedge other pr... |
aff55532144b191e33bfdb1b864f201118bc7981d5774a8d1ca98ac2cb51c253 | Rust | 850 | 20 | use crate::AdapterType;
use crate::relation::config_v2::{
ComponentConfigChange, ComponentConfigLoader, RelationConfigLoader,
};
use crate::relation::databricks::config::{DatabricksRelationMetadata, components};
use indexmap::IndexMap;
fn requires_full_refresh(components: &IndexMap<&'static str, ComponentConfigCha... |
f15b6ace25ae179891638d7bae1dfbd2b4fa92e205890c78abd3a23a765e2bcd | Rust | 856 | 27 | use std::iter::FromIterator;
use minijinja::value::{Kwargs, Value};
use minijinja::{args, Environment, Error, ErrorKind, State};
fn custom_loop(state: &State, num: i64, kwargs: Kwargs) -> Result<String, Error> {
let mut rv = String::new();
let caller = kwargs.get::<Value>("caller")?;
kwargs.assert_all_use... |
3a0b0c3be69d3327b84281841ac5c0c9ac40f6e16226cf25d696863aade84e08 | Rust | 859 | 21 | use dbt_error::ErrorCode;
use dbt_tracing::LogRecordInfo;
use super::fs_error_log::get_log_message;
/// Checks if this log record is a pseudo error that has already been reported
/// elsewhere and should be treated as control flow by dbt-facing sinks.
///
/// This covers:
/// - ExitWithStatus: signals main() to exit ... |
56dd4d652f45426fefe52a5eba1fe62766b10b901b0e928763365159bdf31154 | Rust | 859 | 36 | use std::rc::Rc;
use crate::{
types::{Object, Type},
TypecheckingEventListener,
};
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct IterableType {
pub element: Box<Type>,
}
impl IterableType {
pub fn new(element: Type) -> Self {
Self {
element: Box::new(ele... |
59754b078c009c0930c9b016af9422cf55de4bdf508499af1fbd64c3090e3e7a | Rust | 866 | 34 | /*
* dbt Cloud API v3
*
* The version of the OpenAPI document: 3.0.0
* Contact: support@getdbt.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ProjectListEnveloped {
#... |
153800b9637bdcad161a45f1558a3cd54b96fefd64265f4b8c755fe1b50ccc89 | Rust | 869 | 35 | //! A module for macro units.
use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use crate::{machinery::Span, ArgSpec};
/// A unit of a macro.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct MacroUnit {
/// The info of the macro.
pub info: MacroInfo,
/// The SQL of the macro.
pu... |
d3f3a61f31c850ad26941ffabab997c4797374177e92c122bcef85fe16801e61 | Rust | 882 | 20 | //! Artifacts cross to Python as msgpack; the schemas live in `dbt/artifacts/schemas/`.
use pyo3::exceptions::PyValueError;
use pyo3::prelude::*;
use pyo3::types::PyBytes;
use serde::Serialize;
/// Serialize to msgpack for the Python dataclasses.
///
/// Via `dbt_yaml::Value` as the JSON writer does: that flattens `_... |
ded1ea36e89987c6629ebf52593043dae8c8d4c9b1cb39f401140f2faf9cf763 | Rust | 887 | 38 | #![no_main]
use std::collections::BTreeMap;
use arbitrary::Arbitrary;
use libfuzzer_sys::fuzz_target;
use serde::Serialize;
#[derive(Debug, Serialize, Arbitrary)]
enum Value {
None,
Bool(bool),
Integer(i64),
Float(f64),
String(String),
List(Vec<Value>),
Map(BTreeMap<String, Value>),
}
fuz... |
f5c3555978ffc1fe0c22afcff95cc02b1a1d650ea8eda0ea0e2bef60774a6e32 | Rust | 887 | 40 | //! Cache key for use in suspend vm errors
use crate::Value;
/// Cache key for execution cache
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct CacheKey {
node_id: String,
function_name: String,
args: Vec<Value>,
}
impl CacheKey {
/// Creates a new cache key from a string
pub fn new<S1, S2>... |
cfa61aceb899e6917dd793304e8412363d5658e27533af050dfba2db618d9b1a | Rust | 888 | 35 | use std::rc::Rc;
use crate::{
types::{
function::{ArgSpec, FunctionType},
Type,
},
TypecheckingEventListener,
};
#[derive(Default, Clone, Eq, PartialEq)]
pub struct PyDateTimeStrftimeFunction {}
impl std::fmt::Debug for PyDateTimeStrftimeFunction {
fn fmt(&self, f: &mut std::fmt::Form... |
0ab8384c7c23e25e41e677412e822630a629fc379beab7256288915f1e096ede | Rust | 894 | 30 | use std::collections::BTreeSet;
use std::sync::Arc;
use crate::value::{Enumerator, Object, Value};
/// Utility struct used by [`context!`](crate::context) to merge
/// multiple values.
#[derive(Clone, Debug)]
pub struct MergeObject(pub Vec<Value>);
impl Object for MergeObject {
fn get_value(self: &Arc<Self>, key... |
5f27a6053a1ff759592fdcf2c1acc0fb92e66e44fcb680e7d95f390de5e46b3f | Rust | 911 | 35 | use minijinja::{context, Environment, Value};
fn slugify(value: String) -> String {
value
.to_lowercase()
.split_whitespace()
.collect::<Vec<_>>()
.join("-")
}
fn get_nav() -> Value {
vec![
context! { href => "/", title => "Index" },
context! { href => "/downloa... |
16c2cffa9fef834a14f0eea3045909641d3e3c0136e8a471946b39b73d743846 | Rust | 913 | 19 | use std::sync::Arc;
use dbt_compilation::schema_hydration::SchemaHydratorFactory;
use dbt_frontend_common::sources_extractor::SourcesExtractor;
use dbt_jinja_utils::listener::RenderingEventListenerFactory;
use dbt_tasks_core::context_factory::TaskRunnerCtxFactory;
use dbt_tasks_core::task_runner_hooks::TaskRunnerHooks... |
268b06c9850d592deb676b78006d1a15faf936c07d7aaa8a9e3a5b5062e9c237 | Rust | 921 | 33 | use dbt_adapter_core::AdapterType;
use dbt_common::{FsResult, io_args::IoArgs};
use dbt_schemas::schemas::{Nodes, ResolvedCloudConfig, common::DbtQuoting};
/// Hooks called within the resolve phase
pub trait ResolverHooks: Send + Sync {
/// Hook called before the resolve phase begins.
fn pre_resolve(
&... |
9624009aec1280211f318e46ca1ffcdcab36006c1a1f1ac8c270d6599817e73d | Rust | 933 | 28 | /// Declares an ffi function:
///
/// ```rust
/// ffi_fn! {
/// fn my_func() {}
/// }
/// ```
macro_rules! ffi_fn {
($(#[$doc:meta])* unsafe fn $name:ident($scope:ident $(,$arg:ident: $arg_ty:ty)* $(,)?) -> $ret:ty $body:block) => {
$(#[$doc])*
#[no_mangle]
pub unsafe extern "C" fn $name... |
078dd032a2877f5edfa1bba41a2b0c70e598dc44b00cc22003cedc8620cfbf4a | Rust | 961 | 27 | use uuid::Uuid;
/// Parse a UUID from a string (UUID format) or number.
pub fn parse_invocation_id(s: &str) -> Result<Uuid, String> {
// First try to parse as a UUID string
if let Ok(uuid) = Uuid::try_parse(s) {
return Ok(uuid);
}
let err_msg = "Must be a valid UUID string or number (up to 2^1... |
2360f0228dca735f05641e388f48f27a9558ec17fce99fd0cdb194ca85c15d4b | Rust | 964 | 35 | use std::path::Path;
use std::{env, fs};
use minijinja::{render, Environment};
fn main() {
// This environment has a formatter that formats unsafe values in Rust's
// debug format, and safe values as normal strings.
let mut env = Environment::new();
env.set_formatter(|out, _state, value| {
if ... |
b024485c0459b462a3ea766da3b5b03add7f26de67c8c2fb775890f38039639e | Rust | 973 | 16 | use dbt_adapter_core::AdapterType;
/// Returns true if the identifier SHOULD be quoted when formatting to
/// source code to preserve the casing of the provided identifier in this
/// backend's dialect.
pub fn need_quotes(adapter_type: AdapterType, id: &str) -> bool {
dbt_adapter_sql::ident::must_be_quoted(id, ada... |
f589e0b83106bb5892c2b5b41cc090c14ee05f824a4ddd6fe200bba82caa4a51 | Rust | 983 | 35 | use arrow_schema::ArrowError;
use datafusion::{arrow::array::RecordBatch, prelude::DataFrame};
use datafusion_common::DataFusionError;
use futures::StreamExt;
/// Extension trait that normalizes streaming Arrow output across DataFusion types.
#[async_trait::async_trait]
pub trait ArrowSendable {
async fn arrow_sen... |
8bcea686770bedb13461d2bc3acb04d1596b024d045186365dba1a605099e1dc | Rust | 992 | 28 | pub mod bigquery_config;
pub mod clickhouse_config;
pub mod common;
pub mod databricks_config;
pub mod exasol_config;
pub mod fabric_config;
pub mod headless;
pub mod postgres_config;
pub mod profile;
pub mod redshift_config;
pub mod snowflake_config;
// Re-export the commonly used items so a single `use dbt_profile_s... |
f728339ec8491df2e46c8a6284abc3ad6b59809fcec8c24f62c738dcde081e33 | Rust | 994 | 32 | use std::collections::BTreeMap;
use std::sync::{Arc, Mutex};
use crate::value::{Enumerator, Object, Value};
/// This object exists for the `namespace` function.
///
/// It's special in that it behaves like a dictionary in many ways but it's the only
/// object that can be used with `{% set %}` assignments. This is u... |
2607e16b8b520923bd4b464fd83a66f7a893d37b916d24282c5bc737fdbed412 | Rust | 1,003 | 26 | use arrow_array::RecordBatch;
use arrow_cast::display::{ArrayFormatter, FormatOptions};
// ---------------------------------------------------------------------------
// Shared batch utilities
// ---------------------------------------------------------------------------
/// Format options for Arrow display — no null... |
cf312cb7320b080a66c049d49a639bf9676970ce77cdb2e5d33b9b5e5b4c692f | Rust | 1,011 | 34 | use adbc_core::options::{OptionDatabase, OptionValue};
use dbt_adbc::database;
pub(crate) fn option_str_value(option_value: &OptionValue) -> &str {
match option_value {
OptionValue::String(s) => s.as_str(),
_ => panic!("Expected OptionValue to be String"),
}
}
pub(crate) fn other_option_value<... |
06f6031a64686cce366a884ced348ef779de992ed603175e52948349052bcecf | Rust | 1,014 | 33 | use minijinja::{context, Environment};
use serde::Serialize;
/// This struct makes no sense, and serde will fail serializing it.
#[derive(Serialize, Clone)]
pub struct BadStruct {
a: i32,
#[serde(flatten)]
b: i32,
}
fn main() {
let mut env = Environment::new();
env.add_template("good.txt", "good={... |
9d132be075a0aae38b97a87a69002e8798cf60fa706bd9b4f1785812900ad18b | Rust | 1,021 | 31 | //! Lightweight dbt `profiles.yml` resolver with Jinja `env_var`/`var` support.
//!
//! Standalone — no dependency on `dbt-jinja-utils` or `dbt-common`.
//! Suitable for `dbt-db-runner`, MCP tools, or any consumer that needs
//! profile credentials without pulling in the full dbt compilation stack.
//!
//! # Usage
//!
... |
5a1d6c1ae05159ab5bd85983d9f4bc3a183f7071de516945b25a2bf1087a4429 | Rust | 1,025 | 31 | use dbt_telemetry::AssetParsed;
use super::{
color::{CYAN, GREEN, maybe_apply_color},
duration::format_duration_fixed_width,
layout::right_align_static_action,
};
/// Format an asset parsing start message using legacy style.
/// TODO: either remove any formatting for parsing start, or unify style
/// with... |
97b0305dcde3de3b394d4d10565cc955e9c0f54d874e39dde18d9c73c50cb6cd | Rust | 1,027 | 38 | pub(crate) mod column_comments;
pub(crate) use column_comments::ColumnCommentsLoader;
pub(crate) mod column_masks;
pub(crate) use column_masks::ColumnMasksLoader;
pub(crate) mod column_tags;
pub(crate) use column_tags::ColumnTagsLoader;
pub(crate) mod constraints;
pub(crate) use constraints::ConstraintsLoader;
pub(... |
e3deff907035138979d58622c353b96d516de0f83b0b511a275fa42fff6c6db7 | Rust | 1,035 | 44 | //! Extension points for customizing loader behavior.
use std::path::Path;
use async_trait::async_trait;
use dbt_cloud_config::ResolvedCloudConfig;
use dbt_common::{FsResult, io_args::IoArgs};
use dbt_schemas::schemas::packages::UpstreamProject;
use dbt_schemas::state::DbtPackage;
use crate::args::LoadArgs;
/// Hook... |
0969657a8b51c839ec5a5ed2a7023b0018d4a3c478c774b09c3c04844550f526 | Rust | 1,039 | 23 | use dbt_adapter_core::AdapterType;
use dbt_frontend_common::dialect::Dialect;
pub fn dialect_of(adapter_type: AdapterType) -> Option<Dialect> {
use AdapterType::*;
let dialect = match adapter_type {
Postgres => Dialect::Postgresql,
Snowflake => Dialect::Snowflake,
Bigquery => Dialect::B... |
32df14c2f2e14110624ae7b47f8549436450b96d27fda40c19fc7bc72ed7be07 | Rust | 1,050 | 24 | /// Default terminal width used for formatting when actual terminal width is unavailable
pub(super) const DEFAULT_TERMINAL_WIDTH: usize = 60;
/// Maximum length for displaying schema information in formatted outputs
pub(super) const MAX_QUALIFIER_DISPLAY_LEN: usize = 200;
/// Minimum width allocated for node type dis... |
af00f647c6c250c880ac09e37283918a41eaeacd3eb30154ae4652bc1587250e | Rust | 1,081 | 32 | mod config;
pub mod dbt_convert;
mod dbt_data_layer;
pub mod dbt_emit;
pub mod dbt_init;
pub mod dbt_metrics;
pub mod event_classifiers;
pub mod formatters;
pub mod fs_error_log;
pub mod invocation;
pub mod layers;
pub mod middlewares;
mod private_events;
pub mod tracing_feature_handles;
pub use config::{
FsTraceC... |
aaabd0eade69ebcd8b1ff99b313e0bd483130f3c8fb831c12262691e162e67f2 | Rust | 1,082 | 30 | use std::env;
use std::fs;
use minijinja::{Environment, Error, ErrorKind, Value};
fn load_data(filename: &str) -> Result<Value, Error> {
let mut rv = env::current_dir().unwrap().join("src");
for segment in filename.split('/') {
if segment.starts_with('.') || segment.contains('\\') {
return... |
89459a77200b0a2a340ff2d459dab81b01215fb9a4ca8f4d65d391eef583d4f2 | Rust | 1,086 | 35 | #[cfg(test)]
mod tests {
use crate::adapter::adapter_impl::AdapterImpl;
use crate::sql_types::DefaultTypeOps;
use dbt_adapter_core::AdapterType;
use dbt_schemas::schemas::relations::SNOWFLAKE_RESOLVED_QUOTING;
use std::collections::BTreeMap;
use std::sync::Arc;
#[test]
fn test_adapter... |
2af4e1f5e8a97c1fa1b37f97f09652d2188b6fd1015b58b482f42a0ff9fe1592 | Rust | 1,093 | 43 | use std::fmt;
use std::rc::Rc;
use std::sync::Arc;
use minijinja::listener::RenderingEventListener;
use minijinja::value::Object;
use minijinja::{Error, State, Value};
/// A callable that captures a receiver object and the name of one of its
/// methods, so it can be passed around and invoked later — mirroring Python... |
a361b7ddbb99222d9528d6524f27b76b7ea57b955b4882bd13e0a4d116b16f4d | Rust | 1,097 | 19 | /// Name of the [Statement] option that carries the dbt node unique ID.
pub const DBT_NODE_ID: &str = "dbt.node_id";
/// Name of the [Statement] option that carries the dbt execution phase.
pub const DBT_EXECUTION_PHASE: &str = "dbt.execution_phase";
/// Name of the [Statement] option that carries whether the query is ... |
4e37130b3a9c2363a7c645ca17a48d266aee169c371fe9e47493424c292ff231 | Rust | 1,098 | 34 | //! This mod is not used currently, but we'll bring this back when we can let the guard to use
//! TypedBaseAdapter instead, then we can remove the adapter.restore_warehouse
//! This requires us to move the ConnectionGuard to TypedBaseAdapter
//! More details see https://github.com/dbt-labs/fs/pull/4039#discussion_r215... |
268e92d1626069e265f94f129ea65c69dd6dccaf9f0c03bec7922560ea49ba72 | Rust | 1,109 | 38 | //! Builder utilities
//!
//!
use adbc_core::options::OptionValue;
use std::iter::{Chain, Flatten};
/// An iterator over the builder options.
///
/// `COUNT` is the number of `Option<T>` fields in the builder.
///
/// In the implementation of this trait, the `COUNT` options are iterated first.
/// All the `None` valu... |
c3f029e6066bad7926d91e700f5c0fa7041717b6c9c5a0e7363dc11713649a5c | Rust | 1,115 | 23 | //! Build-time wiring for the SPA bundle.
//!
//! `web/dist/` is a committed build of the SPA whose source lives next to it in
//! `web/src/`. Cargo does **not** run the JS build — rebuild with
//! `pnpm build` in `web/` and commit the result alongside any source change.
//! Keeping the bundle in-tree is what lets `car... |
79212f57791bdca5bc7ca23d8ecb25d3bfc42742522b8694a4643bc86d6ed983 | Rust | 1,118 | 25 | //! Shared live-progress counters for the quantification drivers.
use std::sync::atomic::AtomicU64;
/// Lock-free counters a quant driver updates as it runs, so a UI (e.g. a CLI
/// progress bar) can poll mapping progress while quantification is in flight.
/// Shared by both the reads-mode (`salmon-quant`) and alignm... |
14ef619e3ef8861e1a548c0fd0b18acb2975a26e5a64da9b237f5d334d85bfb3 | Rust | 1,119 | 35 | use std::sync::Arc;
use dbt_adapter_core::AdapterType;
use crate::relation::RelationStatic;
use crate::relation::StaticBaseRelationObject;
use dbt_schemas::schemas::common::ResolvedQuoting;
use minijinja::Value;
/// Create a static relation value from an adapter type
/// To be used as api.Relation in the Jinja envi... |
2d83d96ec630bb90cc8e7d1fe268940e74797bf92f015faf1f0e84a4008ceec8 | Rust | 1,130 | 34 | use dbt_telemetry::ConnectionLimitWait;
use super::duration::format_duration_fixed_width;
fn format_connection_limit_wait_detail(wait: &ConnectionLimitWait) -> String {
match (wait.active_nodes, wait.active_connections) {
(Some(active_nodes), Some(active_connections)) => {
format!(" ({active_n... |
1ee2e9aef3eb143e48822e7eee7b00f992c78559cd860e984503c97bca275657 | Rust | 1,158 | 50 | use minijinja::{context, escape_formatter, Environment, Value};
use serde::Serialize;
/// Similar to the regular `default` filter but also handles `none`.
pub fn none_default(value: Value, other: Option<Value>) -> Value {
if value.is_undefined() || value.is_none() {
other.unwrap_or_else(|| Value::from(""))... |
f0cb3b0a543d18232f55c9a51aa6cd187c89ecc8a38a8ba01086feff9d966dbd | Rust | 1,161 | 26 | use crate::model::network::Network;
/// Prediction from a binary state node
pub fn prediction_binary_state_node(network: &mut Network, node_idx: usize, _time_step: f64) {
let mut expected_mean: f64 = 0.0;
if let Some(ref vp_idxs) = network.edges[node_idx].value_parents {
for &parent_idx in vp_idxs {
... |
dd75b2cd298801c4665cab593c2def48328622efbb802c877bbf4350f32f8a0a | Rust | 1,162 | 35 | use dbt_adapter_core::AdapterType;
use minijinja::Value;
use crate::macro_test_harness::MacroTestHarness;
fn build_harness() -> MacroTestHarness {
let sql = include_str!("../../src/dbt_macro_assets/dbt-databricks/macros/adapters/catalog.sql");
MacroTestHarness::for_adapter(AdapterType::Databricks)
.wi... |
46b54da351df0ac8742215da0543fded27d3b73fe044acc1de92f673644b46ca | Rust | 1,164 | 40 | //! This is a small example program that evaluates an expression and returns
//! the result on stdout in JSON format. The values provided to the script
//! are the environment variables in the `env` dict.
use std::fs;
use std::path::PathBuf;
use argh::FromArgs;
use minijinja::Environment;
/// A small application tha... |
70fcdd6437fdcad758b200d0f55ab21aaf4aec5549916c6362b6d39dd16fabd5 | Rust | 1,176 | 43 | use std::fs;
use minijinja::{context, Environment, Error, ErrorKind};
fn main() {
let mut env = Environment::new();
let template_path = std::env::current_dir().unwrap().join("templates");
env.set_loader(move |name| {
let pieces = name.split('/');
let mut path = template_path.clone();
... |
1e5e35bed3299896d438051620780ec79e9ce58c7eb1c941f810582ec211b4c0 | Rust | 1,179 | 25 | use std::sync::Arc;
use dbt_tasks_core::lake_compute_catalog_attach::LakeComputeCatalogAttachChecker;
use dbt_tasks_core::lake_compute_mdls::LakeComputeMdlsChecker;
use dbt_tasks_core::lake_compute_propagation::LakeComputePropagationChecker;
pub struct LakeComputeFeature {
/// A checker for verifying propagation ... |
92ee39b48cff964b61bd996040cdd60552f3e4e1bb33f91ba6237ec3e8cf0f0f | Rust | 1,194 | 30 | //! Vectorised kernels for volatile-node layers (a value level plus an internal
//! volatility level), mirroring `pyhgf/updates/vectorised/volatile/`.
use crate::vectorised::mat::Float;
pub mod posterior;
pub mod prediction;
pub mod prediction_error;
/// Values of the log-volatility exponentials below this are treate... |
448bd7c4eb2966b1cea9a267c6b9369d37f322ff539daef10172ed7edc3ed922 | Rust | 1,196 | 35 | use std::collections::HashSet;
// compares two sets of files and returns a changeset
// the changeset contains:
// - files that are the same in both sets
// - files that are different in both sets
// - files that are missing in the filesystem
// - files that are missing in the content-addressable storage (CAS)
// - whe... |
7a7bc46d82c7dc1d5638696c6f2cb1cc732eef1f81191d1034d3079f22a816df | Rust | 1,215 | 50 | use std::sync::Arc;
use minijinja::value::{from_args, Object, Value};
use minijinja::{render, Error, ErrorKind, State};
use tokio::runtime::Handle;
use tokio::task::spawn_blocking;
#[derive(Debug)]
struct Site {
rt: Handle,
}
impl Site {
async fn get_config(self: Arc<Self>, key: Arc<str>) -> Option<Value> {
... |
a1ddebf6ae9a1e1a647a34360fafe0c55bc80d21f13d2c844dfee0fb9c2a0751 | Rust | 1,228 | 46 | use minijinja::{context, Environment};
fn execute() -> Result<(), minijinja::Error> {
let mut env = Environment::new();
env.set_debug(true);
env.add_template("include.txt", "Hello {{ item_squared + bar }}!")?;
env.add_template(
"hello.txt",
r#"
first line
{% for item in ... |
53079c90daaafaadfaeefa6205389b034e149797eeb1dbeb8144288d2e9b6d12 | Rust | 1,234 | 43 | use std::collections::HashMap;
use std::env;
use std::sync::Arc;
use minijinja::value::{Enumerator, Object, Value};
use minijinja::Environment;
#[derive(Debug)]
struct DynamicContext;
impl Object for DynamicContext {
fn get_value(self: &Arc<Self>, field: &Value) -> Option<Value> {
Some(match field.as_str... |
d62963e9bad2629164a8b46000bf3d33c882aeb16cbe3fc4a1f10f16aa7a0adb | Rust | 1,237 | 33 | use crate::model::network::Network;
/// Prediction error from a continuous state node
pub fn prediction_error_continuous_state_node(
network: &mut Network,
node_idx: usize,
_time_step: f64,
) {
let n_volatility_parents = network.edges[node_idx]
.volatility_parents
.as_ref()
.map... |
50b174a275cb655feceefeb8deca8ab7e770ddb254cc907a1992ae751433e66b | Rust | 1,242 | 35 | //! Top-down prediction for categorical leaf layers, mirroring
//! `pyhgf/updates/vectorised/categorical/prediction.py`.
use crate::math::{with_coupling, CouplingFn};
use crate::updates::vectorised::{push, softmax_inplace};
use crate::vectorised::layer::LayerState;
use crate::vectorised::mat::{Float, Matrix};
use ndar... |
5758b12ed99ac43a319e89d9c65a50a039b0cd10470e9d54540557e3ea9306d8 | Rust | 1,245 | 46 | use dbt_frontend_common::span::ReclassifySpan;
use crate::preprocessor_location::MacroSpan;
/// Spans captured while rendering a node, carried as a single dyn value through
/// `SqlInstruction` and the compiled-SQL cache.
pub trait CompiledSpans: std::fmt::Debug + Send + Sync {
/// Macro expansion spans for the r... |
1d3b1bbc3694c1d421cb054996e80b894b1f7e9cc16d068adf5c5dbf56c19562 | Rust | 1,268 | 68 | use std::ffi::{c_char, CStr};
use std::ptr;
use minijinja::{Error, ErrorKind};
use crate::error::LAST_ERROR;
pub(crate) trait AbiResult {
fn err_value() -> Self;
}
impl AbiResult for bool {
fn err_value() -> Self {
false
}
}
impl<T> AbiResult for *mut T {
fn err_value() -> Self {
pt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.