Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 131 additions & 2 deletions modules/API/pages/gsql-endpoints.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2757,11 +2757,11 @@ Sample Response::
====

'''
=== get the sample data of S3 file.uris or local files
=== get sample data from an S3 object

`POST /gsql/v1/sample-data`

Get the sample data of S3 file.uris or local files.
Get the first N lines from an S3 object

==== Parameters:

Expand Down Expand Up @@ -2884,6 +2884,80 @@ Sample Response::
--
====

=== Get the sample data from a local file
`POST /gsql/v1/sample-data`

Get the first N of lines of data from a local file, as a sample

==== Parameters:

[%autowidth]
|===
| Name | Required | Description

| `path`
| yes
| Local file URI, starts with `file://`

| `size`
| no
| Number of lines to return (default: 10).
|===

==== Example

[,tabs]
====
Sample Request::
+
--
[source,bash]
----
curl -u tigergraph:tigergraph 'http://<tigergraph-host>:14240/gsql/v1/sample-data' \
-d '{
"path": "file:///path/to/local/filename",
"size": 3
}'

----
--
Sample Response::
+
--
[source.wrap,console]
----
{
"error": false,
"message": "",
"results": {
"data": [
{
"user_id": 1001,
"age": 33,
"state": "fl"

},
{
"user_id": 1002,
"age": 41,
"state": "ca"
},
{
"user_id": 1003,
"age": 26,
"state": "az"
}
],
"header": [],
"json": true
}
}
----
--
====



'''
=== get all buckets of given S3 data source

Expand Down Expand Up @@ -2915,6 +2989,61 @@ Sample Response::
----
--
====
=== Get the sample data of local files
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
=== Get the sample data of local files
=== Get sample data from a local file

"The" is incorrect, because there is not just one possible or correct sample of data.
The data is coming from only one file, not "files"

`POST /gsql/v1/sample-data`

Get the sample data of local files
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Get the sample data of local files
Get the first N of lines of data from a local file, as a sample

"Sample" is a generic, non-specific concept. To a statistician, "sample" actually suggests that the data is chosen randomly. But I assume our selection is not random. We are selecting the first N lines. Is that correct?
We should provide a clearly explanation of how the data is chosen.


==== Parameters:

[%autowidth]
|===
| Name | Required | Description

| `path`
| yes
| local file path (`file://`).

| `size`
| no
| Number of lines to return (default: 10).
|===

==== Example

[,tabs]
====
Sample Request::
+
--
[source,bash]
----
curl -u tigergraph:tigergraph 'http://<tigergraph-host>:14240/gsql/v1/sample-data' \
-d '{
"path": "file:///path/to/local/filename",
"size": 10
}'

----
--
Sample Response::
+
--
[source.wrap,console]
----
{
"error": false,
"message": "Sample data loaded successfully",
"results": {
"file": "file:///path/to/local/filename",
"loadedRecords": 10
}
}
----
--
====



'''
=== get all files and directories under given S3 bucket path
Expand Down