Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-dfs
csst-dfs-client
Commits
f19bbfee
Commit
f19bbfee
authored
Dec 28, 2024
by
Wei Shoulin
Browse files
pkl
parent
18630b0f
Changes
1
Show whitespace changes
Inline
Side-by-side
csst_dfs_client/level2.py
View file @
f19bbfee
import
os
import
pickle
from
typing
import
Optional
,
Tuple
,
Literal
from
.common
import
request
,
Result
...
...
@@ -174,4 +175,9 @@ def write(local_file: str,
return
request
.
post_file
(
"/api/level2/file"
,
local_file
,
params
)
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
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment