tapdb-maxcompute-mcp 0.1.9__py3-none-any.whl → 0.1.10__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.
- tapdb_maxcompute_mcp/server.py +15 -1
- {tapdb_maxcompute_mcp-0.1.9.dist-info → tapdb_maxcompute_mcp-0.1.10.dist-info}/METADATA +1 -1
- tapdb_maxcompute_mcp-0.1.10.dist-info/RECORD +7 -0
- tapdb_maxcompute_mcp-0.1.9.dist-info/RECORD +0 -7
- {tapdb_maxcompute_mcp-0.1.9.dist-info → tapdb_maxcompute_mcp-0.1.10.dist-info}/WHEEL +0 -0
- {tapdb_maxcompute_mcp-0.1.9.dist-info → tapdb_maxcompute_mcp-0.1.10.dist-info}/entry_points.txt +0 -0
- {tapdb_maxcompute_mcp-0.1.9.dist-info → tapdb_maxcompute_mcp-0.1.10.dist-info}/licenses/LICENSE +0 -0
tapdb_maxcompute_mcp/server.py
CHANGED
|
@@ -9,6 +9,8 @@ from mcp.server.models import InitializationOptions
|
|
|
9
9
|
from odps import ODPS
|
|
10
10
|
import sqlglot
|
|
11
11
|
from sqlglot import exp, parse_one,Expression
|
|
12
|
+
from datetime import datetime,date,timedelta
|
|
13
|
+
from decimal import Decimal
|
|
12
14
|
|
|
13
15
|
logger = logging.getLogger('tapdb-maxcompute-mcp')
|
|
14
16
|
# logger.setLevel(logging.DEBUG)
|
|
@@ -16,6 +18,18 @@ logger = logging.getLogger('tapdb-maxcompute-mcp')
|
|
|
16
18
|
|
|
17
19
|
logger.info("Starting MaxCompute MCP Server(tapdb revised)")
|
|
18
20
|
|
|
21
|
+
def dd_json_serializer(obj):
|
|
22
|
+
if isinstance(obj, datetime):
|
|
23
|
+
if obj.microsecond == 0:
|
|
24
|
+
return obj.strftime('%Y-%m-%d %H:%M:%S')
|
|
25
|
+
else:
|
|
26
|
+
return obj.strftime('%Y-%m-%d %H:%M:%S.%f')
|
|
27
|
+
elif isinstance(obj, date):
|
|
28
|
+
return obj.strftime('%Y-%m-%d')
|
|
29
|
+
elif isinstance(obj, Decimal):
|
|
30
|
+
return float(obj)
|
|
31
|
+
else:
|
|
32
|
+
raise TypeError("%r is not JSON serializable" % obj)
|
|
19
33
|
|
|
20
34
|
|
|
21
35
|
def validate_readonly_sql(sql_text:str):
|
|
@@ -69,7 +83,7 @@ class MaxCompute:
|
|
|
69
83
|
logger.debug(f"Read query returned {len(results)} rows")
|
|
70
84
|
|
|
71
85
|
if save_file is not None:
|
|
72
|
-
save_file.write(json.dumps(results))
|
|
86
|
+
save_file.write(json.dumps(results,default=dd_json_serializer))
|
|
73
87
|
return []
|
|
74
88
|
else:
|
|
75
89
|
return results
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
tapdb_maxcompute_mcp/__init__.py,sha256=j0-l3GKDkk17_-h9EfvAsxZ4eskj7qEusam9RPq3hGM,215
|
|
2
|
+
tapdb_maxcompute_mcp/server.py,sha256=quwH9M5IsGobivp7vKQ6G5GuCq6SWQC2zg8HE-2QyK0,7149
|
|
3
|
+
tapdb_maxcompute_mcp-0.1.10.dist-info/METADATA,sha256=GsnDPBKneKuw2hVtKovB3iXyG7yUxG6Xfr8MRMlr9TU,2526
|
|
4
|
+
tapdb_maxcompute_mcp-0.1.10.dist-info/WHEEL,sha256=KGYbc1zXlYddvwxnNty23BeaKzh7YuoSIvIMO4jEhvw,87
|
|
5
|
+
tapdb_maxcompute_mcp-0.1.10.dist-info/entry_points.txt,sha256=uooKPBbMis_h5b1_XYKUwF4yzpnJl8UGO0-22lPj-z8,67
|
|
6
|
+
tapdb_maxcompute_mcp-0.1.10.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
7
|
+
tapdb_maxcompute_mcp-0.1.10.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
tapdb_maxcompute_mcp/__init__.py,sha256=j0-l3GKDkk17_-h9EfvAsxZ4eskj7qEusam9RPq3hGM,215
|
|
2
|
-
tapdb_maxcompute_mcp/server.py,sha256=EUbs2LwyY-Z2dgZKp-7f_pohInf_g4-8K876CFZskic,6626
|
|
3
|
-
tapdb_maxcompute_mcp-0.1.9.dist-info/METADATA,sha256=DOqiaABJRmW4QECYc6FsF0mg5xkyvlDJ-bAAhrhR7SI,2525
|
|
4
|
-
tapdb_maxcompute_mcp-0.1.9.dist-info/WHEEL,sha256=KGYbc1zXlYddvwxnNty23BeaKzh7YuoSIvIMO4jEhvw,87
|
|
5
|
-
tapdb_maxcompute_mcp-0.1.9.dist-info/entry_points.txt,sha256=uooKPBbMis_h5b1_XYKUwF4yzpnJl8UGO0-22lPj-z8,67
|
|
6
|
-
tapdb_maxcompute_mcp-0.1.9.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
7
|
-
tapdb_maxcompute_mcp-0.1.9.dist-info/RECORD,,
|
|
File without changes
|
{tapdb_maxcompute_mcp-0.1.9.dist-info → tapdb_maxcompute_mcp-0.1.10.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{tapdb_maxcompute_mcp-0.1.9.dist-info → tapdb_maxcompute_mcp-0.1.10.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|