Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Data Flow
Data Loading
osdu-cli
Commits
335c4b32
Commit
335c4b32
authored
Nov 01, 2021
by
Mark Hewitt
Browse files
search query supports limit
parent
ba7192f5
Pipeline
#74953
passed with stages
in 2 minutes and 35 seconds
Changes
5
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
README.rst
View file @
335c4b32
...
...
@@ -28,6 +28,11 @@ For more information, specify the `-h` flag:
Change Log
==========
0.0.22
------
- search query supports limit
0.0.21
------
...
...
setup.py
View file @
335c4b32
...
...
@@ -51,6 +51,7 @@ setup(
"Natural Language :: English"
,
"Programming Language :: Python :: 3.8"
,
"Programming Language :: Python :: 3.9"
,
"Programming Language :: Python :: 3.10"
,
],
keywords
=
"osdu"
,
python_requires
=
">=3.8"
,
...
...
@@ -58,7 +59,7 @@ setup(
package_dir
=
{
""
:
"src"
},
py_modules
=
[
splitext
(
basename
(
path
))[
0
]
for
path
in
glob
(
"src/*.py"
)],
include_package_data
=
True
,
install_requires
=
[
"click"
,
"jmespath"
,
"osdu-sdk==0.0.
7
"
,
"requests"
,
"tabulate"
,
"msal"
],
install_requires
=
[
"click"
,
"jmespath"
,
"osdu-sdk==0.0.
8
"
,
"requests"
,
"tabulate"
,
"msal"
],
project_urls
=
{
"Issue Tracker"
:
"https://community.opengroup.org/osdu/platform/data-flow/data-loading/osdu-cli/-/issues"
,
},
...
...
src/osducli/__init__.py
View file @
335c4b32
...
...
@@ -12,4 +12,4 @@
""" OSDU command line environment"""
__VERSION__
=
"0.0.2
1
"
__VERSION__
=
"0.0.2
2
"
src/osducli/commands/dataload/ingest.py
View file @
335c4b32
...
...
@@ -254,7 +254,7 @@ def _ingest_json_as_sequence_file(
for
entry
in
sequence_file
:
_sequence_run_ids
=
_ingest_files
(
config
,
[
entry
[
"FileName"
]
]
,
get_files_from_path
(
entry
[
"FileName"
]
)
,
files
,
runid_log
,
batch_size
,
...
...
src/osducli/commands/search/query.py
View file @
335c4b32
...
...
@@ -23,14 +23,24 @@ from osducli.cliclient import CliOsduClient, handle_cli_exceptions
@
click
.
command
(
cls
=
CustomClickCommand
)
@
click
.
option
(
"-k"
,
"--kind"
,
"kind"
,
help
=
"kind to search for"
)
@
click
.
option
(
"-id"
,
"--id"
,
"_id"
,
help
=
"id to search for"
)
@
click
.
option
(
"-l"
,
"--limit"
,
"limit"
,
default
=
10
,
show_default
=
True
,
help
=
"maximum number of records to return."
,
)
@
handle_cli_exceptions
@
command_with_output
(
"results[*].{Id:id,Kind:kind,CreateTime:createTime}"
)
def
_click_command
(
state
:
State
,
kind
:
str
,
_id
:
str
):
def
_click_command
(
state
:
State
,
kind
:
str
,
_id
:
str
,
limit
:
int
):
"""Query search service"""
return
query
(
state
,
kind
,
_id
)
return
query
(
state
,
kind
,
_id
,
limit
)
def
query
(
state
:
State
,
kind
:
str
,
id
:
str
):
# pylint: disable=invalid-name,redefined-builtin
def
query
(
state
:
State
,
kind
:
str
,
id
:
str
,
limit
:
int
):
# pylint: disable=invalid-name,redefined-builtin
"""Query search service
Args:
...
...
@@ -39,6 +49,6 @@ def query(state: State, kind: str, id: str): # pylint: disable=invalid-name,red
connection
=
CliOsduClient
(
state
.
config
)
search_client
=
SearchClient
(
connection
)
json_response
=
search_client
.
query
(
kind
,
id
)
json_response
=
search_client
.
query
(
kind
,
id
,
limit
)
return
json_response
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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