moose-lib 0.6.25__py3-none-any.whl → 0.6.26__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of moose-lib might be problematic. Click here for more details.

@@ -89,7 +89,7 @@ class IngestPipeline(TypedMooseResource, Generic[T]):
89
89
  raise ValueError("Stream was not configured for this pipeline")
90
90
  return self.stream
91
91
 
92
- def get_dead_letter_queue(self) -> Stream[T]:
92
+ def get_dead_letter_queue(self) -> DeadLetterQueue[T]:
93
93
  """Retrieves the pipeline's dead letter queue.
94
94
 
95
95
  Raises:
@@ -8,6 +8,7 @@ from typing import Any, Optional, Union, Generic, TypeVar
8
8
  from pydantic import BaseModel, ConfigDict, model_validator
9
9
 
10
10
  from moose_lib import ClickHouseEngines
11
+ from ..utilities.sql import quote_identifier
11
12
  from .types import BaseTypedResource, T
12
13
  from .olap_table import OlapTable, OlapConfig
13
14
  from .sql_resource import SqlResource
@@ -94,10 +95,10 @@ class MaterializedView(SqlResource, BaseTypedResource, Generic[T]):
94
95
  raise ValueError("Target table name cannot be the same as the materialized view name")
95
96
 
96
97
  setup = [
97
- f"CREATE MATERIALIZED VIEW IF NOT EXISTS {options.materialized_view_name} TO {target_table.name} AS {options.select_statement}",
98
- f"INSERT INTO {target_table.name} {options.select_statement}"
98
+ f"CREATE MATERIALIZED VIEW IF NOT EXISTS {quote_identifier(options.materialized_view_name)} TO {quote_identifier(target_table.name)} AS {options.select_statement}",
99
+ f"INSERT INTO {quote_identifier(target_table.name)} {options.select_statement}"
99
100
  ]
100
- teardown = [f"DROP VIEW IF EXISTS {options.materialized_view_name}"]
101
+ teardown = [f"DROP VIEW IF EXISTS {quote_identifier(options.materialized_view_name)}"]
101
102
 
102
103
  super().__init__(
103
104
  options.materialized_view_name,
@@ -13,6 +13,7 @@ from pydantic import BaseModel
13
13
  from typing import List, Optional, Any, Literal, Union, Tuple, TypeVar, Generic, Iterator
14
14
  from moose_lib import ClickHouseEngines
15
15
  from ..config.runtime import RuntimeClickHouseConfig
16
+ from ..utilities.sql import quote_identifier
16
17
  from .types import TypedMooseResource, T
17
18
  from ._registry import _tables
18
19
  from ..data_models import Column, is_array_nested_type, is_nested_type, _to_columns
@@ -462,7 +463,7 @@ class OlapTable(TypedMooseResource, Generic[T]):
462
463
  settings["input_format_allow_errors_ratio"] = options.allow_errors_ratio
463
464
 
464
465
  if is_stream:
465
- return table_name, data, settings
466
+ return quote_identifier(table_name), data, settings
466
467
 
467
468
  if not isinstance(validated_data, list):
468
469
  validated_data = [validated_data]
@@ -475,9 +476,9 @@ class OlapTable(TypedMooseResource, Generic[T]):
475
476
  preprocessed_record = self._map_to_clickhouse_record(record_dict)
476
477
  dict_data.append(preprocessed_record)
477
478
  if not dict_data:
478
- return table_name, b"", settings
479
+ return quote_identifier(table_name), b"", settings
479
480
  json_lines = self._to_json_each_row(dict_data)
480
- return table_name, json_lines, settings
481
+ return quote_identifier(table_name), json_lines, settings
481
482
 
482
483
  def _create_success_result(
483
484
  self,
@@ -536,7 +537,7 @@ class OlapTable(TypedMooseResource, Generic[T]):
536
537
  ) -> InsertResult[T]:
537
538
  successful: List[T] = []
538
539
  failed: List[FailedRecord[T]] = []
539
- table_name = self._generate_table_name()
540
+ table_name = quote_identifier(self._generate_table_name())
540
541
  records_dict = []
541
542
  for record in records:
542
543
  if hasattr(record, 'model_dump'):
@@ -685,7 +686,8 @@ class OlapTable(TypedMooseResource, Generic[T]):
685
686
 
686
687
  if len(batch) >= 1000: # Batch size
687
688
  json_lines = self._to_json_each_row(batch)
688
- sql = f"INSERT INTO {table_name} FORMAT JSONEachRow"
689
+ quoted = quote_identifier(table_name)
690
+ sql = f"INSERT INTO {quoted} FORMAT JSONEachRow"
689
691
  # Add wait_end_of_query to batch settings using helper function
690
692
  batch_settings = self._with_wait_end_settings(settings)
691
693
  client.command(sql, data=json_lines, settings=batch_settings)
@@ -694,7 +696,8 @@ class OlapTable(TypedMooseResource, Generic[T]):
694
696
 
695
697
  if batch: # Insert any remaining records
696
698
  json_lines = self._to_json_each_row(batch)
697
- sql = f"INSERT INTO {table_name} FORMAT JSONEachRow"
699
+ quoted = quote_identifier(table_name)
700
+ sql = f"INSERT INTO {quoted} FORMAT JSONEachRow"
698
701
  # Add wait_end_of_query to final batch settings using helper function
699
702
  final_settings = self._with_wait_end_settings(settings)
700
703
  client.command(sql, data=json_lines, settings=final_settings)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moose_lib
3
- Version: 0.6.25
3
+ Version: 0.6.26
4
4
  Home-page: https://www.fiveonefour.com/moose
5
5
  Author: Fiveonefour Labs Inc.
6
6
  Author-email: support@fiveonefour.com
@@ -15,10 +15,10 @@ moose_lib/dmv2/__init__.py,sha256=3DVAtNMZUoP94CMJBFhuXfYEQXDbQUNKSgg9XnKqae0,27
15
15
  moose_lib/dmv2/_registry.py,sha256=RweMQWHSvhxgSceZ5mfd0NGnJ-49VZORbaFmw-O0bFY,611
16
16
  moose_lib/dmv2/consumption.py,sha256=KJV9MKgrnVLIRhlFVZMDhTsXvOaZoMiHk4hnRePdPWA,8745
17
17
  moose_lib/dmv2/ingest_api.py,sha256=Snek9NGwaJl_BuImSWGtQq91m9D3AJ4qBoGiKZ-9yTQ,2323
18
- moose_lib/dmv2/ingest_pipeline.py,sha256=q7k8B50Dp_jpJA86Rr9dOGl7-EaGF0LR81TuFXlktxc,7024
18
+ moose_lib/dmv2/ingest_pipeline.py,sha256=2tDM4gCjQMdDRDjvymI5Z1DlkXULx9nY4nG9M3YXpjk,7033
19
19
  moose_lib/dmv2/life_cycle.py,sha256=wl0k6yzwU1MJ_fO_UkN29buoY5G6ChYZvfwigP9fVfM,1254
20
- moose_lib/dmv2/materialized_view.py,sha256=xlYNXiOHhjGq5pE8z0dMrVs-Db01DnOlY14CmLwMDGE,4851
21
- moose_lib/dmv2/olap_table.py,sha256=4DfF_KMCspCvQLf7DwmkmfyFswCv8J-3NhDcnNTWvKg,31304
20
+ moose_lib/dmv2/materialized_view.py,sha256=sNwYwNlNNoaYdmlNHBNuJXp7uc4CThxtYkYPNUaeQpw,4968
21
+ moose_lib/dmv2/olap_table.py,sha256=WT2ZQ-G4xwLOfpKSG1Duk-DHlFFTtQQzGiMG8hc-uWg,31525
22
22
  moose_lib/dmv2/registry.py,sha256=janjYszIXDnMfuwkNhoiBmMLar3umQ3Npw9Ms-u6p-8,2373
23
23
  moose_lib/dmv2/sql_resource.py,sha256=kUZoGqxhZMHMthtBZGYJBxTFjXkspXiWLXhJRYXgGUM,1864
24
24
  moose_lib/dmv2/stream.py,sha256=jiUWBsjFalLLP63mikOxyHRdieiDAlzf9lXfLye-Wjc,10761
@@ -31,7 +31,7 @@ tests/__init__.py,sha256=0Gh4yzPkkC3TzBGKhenpMIxJcRhyrrCfxLSfpTZnPMQ,53
31
31
  tests/conftest.py,sha256=ZVJNbnr4DwbcqkTmePW6U01zAzE6QD0kNAEZjPG1f4s,169
32
32
  tests/test_moose.py,sha256=mBsx_OYWmL8ppDzL_7Bd7xR6qf_i3-pCIO3wm2iQNaA,2136
33
33
  tests/test_redis_client.py,sha256=d9_MLYsJ4ecVil_jPB2gW3Q5aWnavxmmjZg2uYI3LVo,3256
34
- moose_lib-0.6.25.dist-info/METADATA,sha256=Hq_MwwVkWIuvtATrnipVeGmricUmokjIhJa5Oh1NShY,730
35
- moose_lib-0.6.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
- moose_lib-0.6.25.dist-info/top_level.txt,sha256=XEns2-4aCmGp2XjJAeEH9TAUcGONLnSLy6ycT9FSJh8,16
37
- moose_lib-0.6.25.dist-info/RECORD,,
34
+ moose_lib-0.6.26.dist-info/METADATA,sha256=ckDoVeS60CWtZ2jx-PRM0lWTPlmwq89UIJltD87cmxc,730
35
+ moose_lib-0.6.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ moose_lib-0.6.26.dist-info/top_level.txt,sha256=XEns2-4aCmGp2XjJAeEH9TAUcGONLnSLy6ycT9FSJh8,16
37
+ moose_lib-0.6.26.dist-info/RECORD,,