From 0850a8166f19d05daef9c85e2f8d38df162bf6c1 Mon Sep 17 00:00:00 2001 From: AyeshaFirdausTG Date: Wed, 1 Oct 2025 03:40:31 +0530 Subject: [PATCH 1/2] DOC-2921 support sampling local file [4.3] --- modules/API/pages/gsql-endpoints.adoc | 55 +++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/modules/API/pages/gsql-endpoints.adoc b/modules/API/pages/gsql-endpoints.adoc index da49134c..ce34e0e9 100644 --- a/modules/API/pages/gsql-endpoints.adoc +++ b/modules/API/pages/gsql-endpoints.adoc @@ -2915,6 +2915,61 @@ Sample Response:: ---- -- ==== +=== Get the sample data of local files +`POST /gsql/v1/sample-data` + +Get the sample data of local files + +==== 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://: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 From e30753467cbb1100b2315ab6b834e64857abc4d6 Mon Sep 17 00:00:00 2001 From: AyeshaFirdausTG Date: Mon, 6 Oct 2025 18:04:36 +0530 Subject: [PATCH 2/2] DOC-2921 Support sampling local-file-[4.3] --- modules/API/pages/gsql-endpoints.adoc | 78 ++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/modules/API/pages/gsql-endpoints.adoc b/modules/API/pages/gsql-endpoints.adoc index ce34e0e9..70bed97e 100644 --- a/modules/API/pages/gsql-endpoints.adoc +++ b/modules/API/pages/gsql-endpoints.adoc @@ -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: @@ -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://: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