tellaro-query-language 0.2.5__tar.gz → 0.2.6__tar.gz
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.
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/PKG-INFO +1 -1
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/pyproject.toml +2 -1
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/cache/base.py +36 -2
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/cache/memory.py +52 -5
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/cache/redis.py +52 -11
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/LICENSE +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/README.md +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/__init__.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/analyzer.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/cache/__init__.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/cli.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/core.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/core_components/README.md +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/core_components/__init__.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/core_components/file_operations.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/core_components/opensearch_operations.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/core_components/stats_operations.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/core_components/validation_operations.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/evaluator.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/evaluator_components/README.md +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/evaluator_components/__init__.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/evaluator_components/field_access.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/evaluator_components/special_expressions.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/evaluator_components/value_comparison.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/exceptions.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/field_type_inference.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/geoip_normalizer.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/mutator_analyzer.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/mutators/__init__.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/mutators/base.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/mutators/dns.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/mutators/encoding.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/mutators/geo.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/mutators/list.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/mutators/network.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/mutators/security.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/mutators/string.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/opensearch.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/opensearch_components/README.md +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/opensearch_components/__init__.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/opensearch_components/field_mapping.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/opensearch_components/lucene_converter.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/opensearch_components/query_converter.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/opensearch_mappings.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/opensearch_stats.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/parser.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/parser_components/README.md +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/parser_components/__init__.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/parser_components/ast_builder.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/parser_components/error_analyzer.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/parser_components/field_extractor.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/parser_components/grammar.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/post_processor.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/scripts.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/stats_evaluator.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/stats_transformer.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/streaming_file_processor.py +0 -0
- {tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/validators.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tellaro-query-language
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.6
|
|
4
4
|
Summary: A flexible, human-friendly query language for searching and filtering structured data
|
|
5
5
|
Home-page: https://github.com/tellaro/tellaro-query-language
|
|
6
6
|
License: Proprietary
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "tellaro-query-language"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.6"
|
|
4
4
|
description = "A flexible, human-friendly query language for searching and filtering structured data"
|
|
5
5
|
authors = ["Justin Henderson <justin@tellaro.io>"]
|
|
6
6
|
license = "Proprietary"
|
|
@@ -77,6 +77,7 @@ types-setuptools = "^75.8.2.20250305"
|
|
|
77
77
|
opensearch-dsl = "^2.1.0"
|
|
78
78
|
python-dotenv = "^1.1.0"
|
|
79
79
|
jupyter = "^1.1.1"
|
|
80
|
+
redis = "^7.1.0"
|
|
80
81
|
|
|
81
82
|
[build-system]
|
|
82
83
|
requires = ["poetry-core"]
|
|
@@ -40,7 +40,7 @@ class CacheManager:
|
|
|
40
40
|
"""
|
|
41
41
|
return None
|
|
42
42
|
|
|
43
|
-
def set(self, key: str, value: Any, ttl: Optional[int] = None) ->
|
|
43
|
+
def set(self, key: str, value: Any, ttl: Optional[int] = None) -> bool:
|
|
44
44
|
"""Store a value in the cache.
|
|
45
45
|
|
|
46
46
|
Args:
|
|
@@ -48,20 +48,54 @@ class CacheManager:
|
|
|
48
48
|
value: The value to cache. Can be any Python object.
|
|
49
49
|
ttl: Time-to-live in seconds. If None or 0, the value never expires.
|
|
50
50
|
|
|
51
|
+
Returns:
|
|
52
|
+
True if the value was successfully stored.
|
|
53
|
+
|
|
51
54
|
Example:
|
|
52
55
|
>>> cache.set("config", {"debug": True}, ttl=300) # Cache for 5 minutes
|
|
53
56
|
>>> cache.set("permanent", {"version": "1.0"}) # Never expires
|
|
54
57
|
"""
|
|
58
|
+
return True
|
|
55
59
|
|
|
56
|
-
def delete(self, key: str) ->
|
|
60
|
+
def delete(self, key: str) -> bool:
|
|
57
61
|
"""Remove a value from the cache.
|
|
58
62
|
|
|
59
63
|
Args:
|
|
60
64
|
key: The cache key to delete.
|
|
61
65
|
|
|
66
|
+
Returns:
|
|
67
|
+
True if the key existed and was deleted, False otherwise.
|
|
68
|
+
|
|
62
69
|
Example:
|
|
63
70
|
>>> cache.delete("expired_key")
|
|
64
71
|
"""
|
|
72
|
+
return False
|
|
73
|
+
|
|
74
|
+
def exists(self, key: str) -> bool: # pylint: disable=unused-argument
|
|
75
|
+
"""Check if a key exists in the cache.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
key: The cache key to check.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
True if the key exists and hasn't expired, False otherwise.
|
|
82
|
+
|
|
83
|
+
Example:
|
|
84
|
+
>>> if cache.exists("my_key"):
|
|
85
|
+
... value = cache.get("my_key")
|
|
86
|
+
"""
|
|
87
|
+
return False
|
|
88
|
+
|
|
89
|
+
def clear(self) -> bool:
|
|
90
|
+
"""Clear all items from the cache.
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
True if the cache was successfully cleared.
|
|
94
|
+
|
|
95
|
+
Example:
|
|
96
|
+
>>> cache.clear()
|
|
97
|
+
"""
|
|
98
|
+
return True
|
|
65
99
|
|
|
66
100
|
def clear_pattern(self, pattern: str) -> int: # pylint: disable=unused-argument
|
|
67
101
|
"""Clear all keys matching a pattern.
|
|
@@ -78,7 +78,7 @@ class LocalCacheManager(CacheManager):
|
|
|
78
78
|
self._misses += 1
|
|
79
79
|
return None
|
|
80
80
|
|
|
81
|
-
def set(self, key: str, value: Any, ttl: Optional[int] = None) ->
|
|
81
|
+
def set(self, key: str, value: Any, ttl: Optional[int] = None) -> bool:
|
|
82
82
|
"""Store value in cache with optional TTL.
|
|
83
83
|
|
|
84
84
|
Args:
|
|
@@ -87,6 +87,9 @@ class LocalCacheManager(CacheManager):
|
|
|
87
87
|
ttl: Time-to-live in seconds. If None, uses default_ttl.
|
|
88
88
|
If 0, the item never expires.
|
|
89
89
|
|
|
90
|
+
Returns:
|
|
91
|
+
True if the value was successfully stored.
|
|
92
|
+
|
|
90
93
|
Note:
|
|
91
94
|
When the cache is full (reaches max_size), the oldest item
|
|
92
95
|
is evicted to make room for the new one (LRU eviction).
|
|
@@ -104,18 +107,62 @@ class LocalCacheManager(CacheManager):
|
|
|
104
107
|
else:
|
|
105
108
|
expiry_time = time.time() + (ttl if ttl is not None else self.default_ttl)
|
|
106
109
|
self._expiry[key] = expiry_time
|
|
110
|
+
return True
|
|
107
111
|
|
|
108
|
-
def delete(self, key: str) ->
|
|
112
|
+
def delete(self, key: str) -> bool:
|
|
109
113
|
"""Remove value from cache.
|
|
110
114
|
|
|
111
115
|
Args:
|
|
112
116
|
key: The cache key to delete.
|
|
113
117
|
|
|
118
|
+
Returns:
|
|
119
|
+
True if the key existed and was deleted, False otherwise.
|
|
120
|
+
|
|
121
|
+
Note:
|
|
122
|
+
If the key doesn't exist, this method returns False (no error raised).
|
|
123
|
+
"""
|
|
124
|
+
if key in self._cache:
|
|
125
|
+
del self._cache[key]
|
|
126
|
+
self._expiry.pop(key, None)
|
|
127
|
+
return True
|
|
128
|
+
return False
|
|
129
|
+
|
|
130
|
+
def exists(self, key: str) -> bool:
|
|
131
|
+
"""Check if a key exists in the cache and hasn't expired.
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
key: The cache key to check.
|
|
135
|
+
|
|
136
|
+
Returns:
|
|
137
|
+
True if the key exists and hasn't expired, False otherwise.
|
|
138
|
+
|
|
114
139
|
Note:
|
|
115
|
-
|
|
140
|
+
This method automatically removes expired keys when accessed.
|
|
116
141
|
"""
|
|
117
|
-
self._cache
|
|
118
|
-
|
|
142
|
+
if key in self._cache:
|
|
143
|
+
expiry = self._expiry.get(key, float("inf"))
|
|
144
|
+
if expiry == 0 or expiry > time.time():
|
|
145
|
+
return True
|
|
146
|
+
else:
|
|
147
|
+
# Expired - clean up
|
|
148
|
+
del self._cache[key]
|
|
149
|
+
del self._expiry[key]
|
|
150
|
+
return False
|
|
151
|
+
|
|
152
|
+
def clear(self) -> bool:
|
|
153
|
+
"""Clear all items from the cache.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
True if the cache was successfully cleared.
|
|
157
|
+
|
|
158
|
+
Note:
|
|
159
|
+
This also resets hit/miss statistics.
|
|
160
|
+
"""
|
|
161
|
+
self._cache.clear()
|
|
162
|
+
self._expiry.clear()
|
|
163
|
+
self._hits = 0
|
|
164
|
+
self._misses = 0
|
|
165
|
+
return True
|
|
119
166
|
|
|
120
167
|
def clear_pattern(self, pattern: str) -> int:
|
|
121
168
|
"""Clear all keys matching a glob pattern.
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
import json
|
|
4
4
|
from typing import Any, Dict, Optional
|
|
5
5
|
|
|
6
|
+
from .base import CacheManager
|
|
7
|
+
|
|
8
|
+
redis: Any
|
|
6
9
|
try:
|
|
7
10
|
import redis
|
|
8
11
|
except ImportError:
|
|
9
12
|
redis = None
|
|
10
13
|
|
|
11
|
-
from .base import CacheManager
|
|
12
|
-
|
|
13
14
|
|
|
14
15
|
class RedisCacheManager(CacheManager):
|
|
15
16
|
"""Redis-based distributed cache."""
|
|
@@ -33,16 +34,56 @@ class RedisCacheManager(CacheManager):
|
|
|
33
34
|
return json.loads(value)
|
|
34
35
|
return None
|
|
35
36
|
|
|
36
|
-
def set(self, key: str, value: Any, ttl: Optional[int] = None) ->
|
|
37
|
-
"""Store value in Redis with TTL.
|
|
38
|
-
full_key = self._make_key(key)
|
|
39
|
-
ttl = ttl or self.default_ttl
|
|
40
|
-
self.redis.setex(full_key, ttl, json.dumps(value))
|
|
37
|
+
def set(self, key: str, value: Any, ttl: Optional[int] = None) -> bool:
|
|
38
|
+
"""Store value in Redis with TTL.
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
Returns:
|
|
41
|
+
True if the value was successfully stored.
|
|
42
|
+
"""
|
|
43
|
+
try:
|
|
44
|
+
full_key = self._make_key(key)
|
|
45
|
+
ttl = ttl or self.default_ttl
|
|
46
|
+
self.redis.setex(full_key, ttl, json.dumps(value))
|
|
47
|
+
return True
|
|
48
|
+
except Exception:
|
|
49
|
+
return False
|
|
50
|
+
|
|
51
|
+
def delete(self, key: str) -> bool:
|
|
52
|
+
"""Remove value from Redis.
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
True if the key existed and was deleted, False otherwise.
|
|
56
|
+
"""
|
|
57
|
+
try:
|
|
58
|
+
full_key = self._make_key(key)
|
|
59
|
+
result = self.redis.delete(full_key)
|
|
60
|
+
return result > 0
|
|
61
|
+
except Exception:
|
|
62
|
+
return False
|
|
63
|
+
|
|
64
|
+
def exists(self, key: str) -> bool:
|
|
65
|
+
"""Check if a key exists in Redis.
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
True if the key exists, False otherwise.
|
|
69
|
+
"""
|
|
70
|
+
try:
|
|
71
|
+
full_key = self._make_key(key)
|
|
72
|
+
return self.redis.exists(full_key) > 0
|
|
73
|
+
except Exception:
|
|
74
|
+
return False
|
|
75
|
+
|
|
76
|
+
def clear(self) -> bool:
|
|
77
|
+
"""Clear all keys in the Redis database.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
True if the cache was successfully cleared.
|
|
81
|
+
"""
|
|
82
|
+
try:
|
|
83
|
+
self.redis.flushdb()
|
|
84
|
+
return True
|
|
85
|
+
except Exception:
|
|
86
|
+
return False
|
|
46
87
|
|
|
47
88
|
def clear_pattern(self, pattern: str) -> int:
|
|
48
89
|
"""Clear all keys matching pattern."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/core_components/README.md
RENAMED
|
File without changes
|
{tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/core_components/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/evaluator_components/README.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/field_type_inference.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/opensearch_mappings.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/parser_components/README.md
RENAMED
|
File without changes
|
{tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/parser_components/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/parser_components/grammar.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tellaro_query_language-0.2.5 → tellaro_query_language-0.2.6}/src/tql/streaming_file_processor.py
RENAMED
|
File without changes
|
|
File without changes
|