Skip to content

Commit fc0d810

Browse files
TIHanfa-assistant
authored andcommitted
Reverted dbt-labs/fs#3829 as there is an issue with chrono-tz referencing uncased (#4143)
* Reverted #145 as there is an issue with chrono-tz referencing uncased * Added changelog * Fix consistency GitOrigin-RevId: 6e1f6ae9728f12383ae75d2fe7f373e11d3e6710
1 parent 65ee25f commit fc0d810

File tree

4 files changed

+8
-53
lines changed

4 files changed

+8
-53
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Fixes
2+
body: Reverted timezone compatibility change due to 'chrono-tz' crate having an issue referencing 'uncased' crate
3+
time: 2025-06-25T13:57:38.676795-07:00

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ base64 = "0.22.1"
301301
bigdecimal = "0.4.7"
302302
blake3 = "1.5.0"
303303
chrono = { version = "0.4.31", features = ["std", "clock", "serde"] }
304-
chrono-tz = { version = "0.10", features = ["case-insensitive"] }
304+
chrono-tz = { version = "0.10" }
305305
clap = { version = "4.4.4", features = ["derive"] }
306306
counter = "0.6.0"
307307
dashmap = "6.1.0"
@@ -345,8 +345,8 @@ tonic-build = "0.11.0"
345345
jsonschema-valid = "0.5.2"
346346

347347
# phf
348-
phf = { version = "0.11", features = ["uncased"] }
349-
phf_shared = { version = "0.11", features = ["uncased"] }
348+
phf = { version = "0.11" }
349+
phf_shared = { version = "0.11" }
350350

351351
# error handling
352352
anyhow = { version = "1.0.74" }

crates/dbt-jinja/Cargo.lock.msrv

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/dbt-jinja/minijinja-contrib/src/modules/pytz.rs

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use chrono_tz::Tz;
33
use minijinja::{Error, ErrorKind, Value};
44
use std::collections::BTreeMap;
55
use std::fmt;
6+
use std::str::FromStr;
67
use std::sync::Arc;
78

89
/// A Python-like "pytz" timezone object that wraps a `chrono_tz::Tz`.
@@ -80,7 +81,7 @@ fn timezone(args: &[Value]) -> Result<Value, Error> {
8081
})?;
8182

8283
// Try to parse it as a Chrono Tz.
83-
match Tz::from_str_insensitive(tz_name) {
84+
match Tz::from_str(tz_name) {
8485
Ok(tz) => Ok(Value::from_object(PytzTimezone::new(tz))),
8586
Err(_) => Err(Error::new(
8687
ErrorKind::InvalidArgument,
@@ -115,42 +116,3 @@ impl minijinja::value::Object for PytzTimezone {
115116
write!(f, "{}", self.tz)
116117
}
117118
}
118-
119-
#[cfg(test)]
120-
mod tests {
121-
use crate::modules::pytz::{timezone, PytzTimezone};
122-
use chrono_tz::Tz;
123-
use minijinja::Value;
124-
125-
#[test]
126-
fn test_valid_timezone_utc() {
127-
let args = vec![Value::from("UTC")];
128-
let result = timezone(&args);
129-
assert!(result.is_ok());
130-
131-
let actual = result.unwrap();
132-
let expected = Value::from_object(PytzTimezone::new(chrono_tz::UTC));
133-
assert_eq!(actual, expected);
134-
}
135-
136-
#[test]
137-
fn test_valid_timezone_case_insensitive() {
138-
let args = vec![Value::from("asia/ho_chi_minh")];
139-
let result = timezone(&args);
140-
assert!(result.is_ok());
141-
142-
let actual = result.unwrap();
143-
let expected = Value::from_object(PytzTimezone::new(Tz::Asia__Ho_Chi_Minh));
144-
assert_eq!(actual, expected);
145-
}
146-
147-
#[test]
148-
fn test_invalid_timezone() {
149-
let args = vec![Value::from("Invalid/Zone")];
150-
let result = timezone(&args);
151-
assert!(result.is_err());
152-
153-
let err = result.unwrap_err();
154-
assert!(err.to_string().contains("Invalid timezone name"));
155-
}
156-
}

0 commit comments

Comments
 (0)