singlestoredb 1.15.0__py3-none-any.whl → 1.15.2__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 singlestoredb might be problematic. Click here for more details.
- singlestoredb/__init__.py +1 -1
- singlestoredb/ai/chat.py +14 -0
- singlestoredb/apps/_python_udfs.py +18 -3
- singlestoredb/apps/_stdout_supress.py +1 -1
- singlestoredb/apps/_uvicorn_util.py +4 -0
- singlestoredb/config.py +24 -0
- singlestoredb/converters.py +1 -1
- singlestoredb/docstring/__init__.py +33 -0
- singlestoredb/docstring/attrdoc.py +126 -0
- singlestoredb/docstring/common.py +230 -0
- singlestoredb/docstring/epydoc.py +267 -0
- singlestoredb/docstring/google.py +412 -0
- singlestoredb/docstring/numpydoc.py +562 -0
- singlestoredb/docstring/parser.py +100 -0
- singlestoredb/docstring/py.typed +1 -0
- singlestoredb/docstring/rest.py +256 -0
- singlestoredb/docstring/tests/__init__.py +1 -0
- singlestoredb/docstring/tests/_pydoctor.py +21 -0
- singlestoredb/docstring/tests/test_epydoc.py +729 -0
- singlestoredb/docstring/tests/test_google.py +1007 -0
- singlestoredb/docstring/tests/test_numpydoc.py +1100 -0
- singlestoredb/docstring/tests/test_parse_from_object.py +109 -0
- singlestoredb/docstring/tests/test_parser.py +248 -0
- singlestoredb/docstring/tests/test_rest.py +547 -0
- singlestoredb/docstring/tests/test_util.py +70 -0
- singlestoredb/docstring/util.py +141 -0
- singlestoredb/functions/decorator.py +19 -18
- singlestoredb/functions/ext/asgi.py +304 -32
- singlestoredb/functions/ext/timer.py +2 -11
- singlestoredb/functions/ext/utils.py +55 -6
- singlestoredb/functions/signature.py +374 -241
- singlestoredb/fusion/handlers/files.py +4 -4
- singlestoredb/fusion/handlers/models.py +1 -1
- singlestoredb/fusion/handlers/stage.py +4 -4
- singlestoredb/management/cluster.py +1 -1
- singlestoredb/management/manager.py +15 -5
- singlestoredb/management/region.py +12 -2
- singlestoredb/management/workspace.py +17 -25
- singlestoredb/tests/ext_funcs/__init__.py +39 -0
- singlestoredb/tests/test_connection.py +18 -8
- singlestoredb/tests/test_management.py +24 -57
- singlestoredb/tests/test_udf.py +43 -15
- {singlestoredb-1.15.0.dist-info → singlestoredb-1.15.2.dist-info}/METADATA +1 -1
- {singlestoredb-1.15.0.dist-info → singlestoredb-1.15.2.dist-info}/RECORD +48 -29
- {singlestoredb-1.15.0.dist-info → singlestoredb-1.15.2.dist-info}/LICENSE +0 -0
- {singlestoredb-1.15.0.dist-info → singlestoredb-1.15.2.dist-info}/WHEEL +0 -0
- {singlestoredb-1.15.0.dist-info → singlestoredb-1.15.2.dist-info}/entry_points.txt +0 -0
- {singlestoredb-1.15.0.dist-info → singlestoredb-1.15.2.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
+
import datetime
|
|
2
3
|
import json
|
|
3
4
|
import logging
|
|
4
5
|
import re
|
|
@@ -30,14 +31,62 @@ except ImportError:
|
|
|
30
31
|
return super().formatMessage(recordcopy)
|
|
31
32
|
|
|
32
33
|
|
|
34
|
+
class JSONFormatter(logging.Formatter):
|
|
35
|
+
"""Custom JSON formatter for structured logging."""
|
|
36
|
+
|
|
37
|
+
def format(self, record: logging.LogRecord) -> str:
|
|
38
|
+
# Create proper ISO timestamp with microseconds
|
|
39
|
+
timestamp = datetime.datetime.fromtimestamp(
|
|
40
|
+
record.created, tz=datetime.timezone.utc,
|
|
41
|
+
)
|
|
42
|
+
# Keep only 3 digits for milliseconds
|
|
43
|
+
iso_timestamp = timestamp.strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z'
|
|
44
|
+
|
|
45
|
+
log_entry = {
|
|
46
|
+
'timestamp': iso_timestamp,
|
|
47
|
+
'level': record.levelname,
|
|
48
|
+
'logger': record.name,
|
|
49
|
+
'message': record.getMessage(),
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
# Add extra fields if present
|
|
53
|
+
allowed_fields = [
|
|
54
|
+
'app_name', 'request_id', 'function_name',
|
|
55
|
+
'content_type', 'accepts', 'metrics',
|
|
56
|
+
]
|
|
57
|
+
for field in allowed_fields:
|
|
58
|
+
if hasattr(record, field):
|
|
59
|
+
log_entry[field] = getattr(record, field)
|
|
60
|
+
|
|
61
|
+
# Add exception info if present
|
|
62
|
+
if record.exc_info:
|
|
63
|
+
log_entry['exception'] = self.formatException(record.exc_info)
|
|
64
|
+
|
|
65
|
+
return json.dumps(log_entry)
|
|
66
|
+
|
|
67
|
+
|
|
33
68
|
def get_logger(name: str) -> logging.Logger:
|
|
34
|
-
"""Return a
|
|
69
|
+
"""Return a logger with JSON formatting."""
|
|
35
70
|
logger = logging.getLogger(name)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
71
|
+
|
|
72
|
+
# Only configure if not already configured with JSON formatter
|
|
73
|
+
has_json_formatter = any(
|
|
74
|
+
isinstance(getattr(handler, 'formatter', None), JSONFormatter)
|
|
75
|
+
for handler in logger.handlers
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
if not logger.handlers or not has_json_formatter:
|
|
79
|
+
# Clear handlers only if we need to reconfigure
|
|
80
|
+
logger.handlers.clear()
|
|
81
|
+
handler = logging.StreamHandler()
|
|
82
|
+
formatter = JSONFormatter()
|
|
83
|
+
handler.setFormatter(formatter)
|
|
84
|
+
logger.addHandler(handler)
|
|
85
|
+
logger.setLevel(logging.INFO)
|
|
86
|
+
|
|
87
|
+
# Prevent propagation to avoid duplicate messages or different formatting
|
|
88
|
+
logger.propagate = False
|
|
89
|
+
|
|
41
90
|
return logger
|
|
42
91
|
|
|
43
92
|
|