diff --git a/sqlglot/dialects/dialect.py b/sqlglot/dialects/dialect.py index 8e11050db6..651279d952 100644 --- a/sqlglot/dialects/dialect.py +++ b/sqlglot/dialects/dialect.py @@ -410,13 +410,15 @@ def format_time( return expression def __init__(self, **kwargs) -> None: - normalization_strategy = kwargs.get("normalization_strategy") + normalization_strategy = kwargs.pop("normalization_strategy", None) if normalization_strategy is None: self.normalization_strategy = self.NORMALIZATION_STRATEGY else: self.normalization_strategy = NormalizationStrategy(normalization_strategy.upper()) + self.settings = kwargs + def __eq__(self, other: t.Any) -> bool: # Does not currently take dialect state into account return type(self) == other diff --git a/tests/dialects/test_dialect.py b/tests/dialects/test_dialect.py index aaeb7b08c9..4bb3208813 100644 --- a/tests/dialects/test_dialect.py +++ b/tests/dialects/test_dialect.py @@ -121,6 +121,12 @@ def test_get_or_raise(self): self.assertEqual(str(cm.exception), "Unknown dialect 'asdfjasodiufjsd'.") + oracle_with_settings = Dialect.get_or_raise( + "oracle, normalization_strategy = lowercase, version = 19.5" + ) + self.assertEqual(oracle_with_settings.normalization_strategy.value, "LOWERCASE") + self.assertEqual(oracle_with_settings.settings, {"version": "19.5"}) + def test_compare_dialects(self): bigquery_class = Dialect["bigquery"] bigquery_object = BigQuery()