Commit f19bbfee authored by Wei Shoulin's avatar Wei Shoulin
Browse files

pkl

parent 18630b0f
import os import os
import pickle
from typing import Optional, Tuple, Literal from typing import Optional, Tuple, Literal
from .common import request, Result from .common import request, Result
...@@ -174,4 +175,9 @@ def write(local_file: str, ...@@ -174,4 +175,9 @@ def write(local_file: str,
return request.post_file("/api/level2/file", local_file, params) return request.post_file("/api/level2/file", local_file, params)
def catalog_query(sql: str, limit: int = 0) -> Result: def catalog_query(sql: str, limit: int = 0) -> Result:
return request.post("/api/level2/catalog/query", {'sql': sql, 'limit': limit}) datas = request.post("/api/level2/catalog/query", {'sql': sql, 'limit': limit})
if datas and isinstance(datas, Result):
return datas
records = pickle.loads(datas._content)
df, total_count = records['records'], records['totalCount']
return Result.ok_data(data = df).append("totalCount", total_count)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment