From 910a9999370a9bcaebd659116841171685b272e3 Mon Sep 17 00:00:00 2001 From: Priyanka Danesh Gunaki Date: Wed, 8 Jul 2026 22:55:54 +0530 Subject: [PATCH 1/2] DOC-1227 ADD Example User_defined_header --- .../partials/load-part3B-specify-mapping.adoc | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/modules/data-loading/partials/load-part3B-specify-mapping.adoc b/modules/data-loading/partials/load-part3B-specify-mapping.adoc index 0170680ad..6b1928fce 100644 --- a/modules/data-loading/partials/load-part3B-specify-mapping.adoc +++ b/modules/data-loading/partials/load-part3B-specify-mapping.adoc @@ -23,6 +23,35 @@ LOAD file_Person TO VERTEX Person * `$0`, `$1`,... refer to the first, second, ... columns in each line a data file. * `SEPARATOR="|"` says the column separator character is the pipe (`|`). The default is comma (`,`). * `HEADER="true"` says that the first line in the source contains column header names instead of data. These names can be used instead of the columnn numbers. + +[[user-defined-header-example]] +.Example using USER_DEFINED_HEADER + +`USER_DEFINED_HEADER` specifies a header defined by `DEFINE HEADER`. The loader uses the user-defined column names instead of the column names in the input file. + +.Loading job +[source,gsql] +---- +# define the loading job +CREATE LOADING JOB load_simprod FOR GRAPH gsql_demo { + DEFINE HEADER head1 = "id", "hash", "words"; + DEFINE FILENAME f1; + + LOAD f1 + TO VERTEX Product VALUES ($"id", $"hash"), + TO TEMP_TABLE t (pid, description) + VALUES ($"id", FLATTEN($"words", ",", 1)) + USING QUOTE="double", + HEADER="true", + USER_DEFINED_HEADER="head1"; +} + +# load the data +RUN LOADING JOB load_simprod USING f1="../simprod/data/simprod_data.csv"; +---- + +In this example, the input file contains the column names `ProductID`, `ImageHash`, and `Description`. The loading job references these columns using the user-defined names `id`, `hash`, and `words` specified by `DEFINE HEADER` because `USER_DEFINED_HEADER="head1"` is used. + * `SPLIT` is one of GSQL's ETL functions. It says that there is a multi-valued column, which has a separator character to mark the subfields in that column. Refer to xref:{page-component-version}@gsql-ref:ddl-and-loading:creating-a-loading-job.adoc[] in the GSQL Language Reference for descriptions of all the options for loading jobs. \ No newline at end of file From d5bad49554b5e0f172718529ceb0c14380fa9e7c Mon Sep 17 00:00:00 2001 From: priyankagunaki-cloud Date: Fri, 10 Jul 2026 10:07:50 +0530 Subject: [PATCH 2/2] Update modules/data-loading/partials/load-part3B-specify-mapping.adoc Co-authored-by: Victor Lee --- modules/data-loading/partials/load-part3B-specify-mapping.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/data-loading/partials/load-part3B-specify-mapping.adoc b/modules/data-loading/partials/load-part3B-specify-mapping.adoc index 6b1928fce..cc39b46d3 100644 --- a/modules/data-loading/partials/load-part3B-specify-mapping.adoc +++ b/modules/data-loading/partials/load-part3B-specify-mapping.adoc @@ -50,7 +50,7 @@ CREATE LOADING JOB load_simprod FOR GRAPH gsql_demo { RUN LOADING JOB load_simprod USING f1="../simprod/data/simprod_data.csv"; ---- -In this example, the input file contains the column names `ProductID`, `ImageHash`, and `Description`. The loading job references these columns using the user-defined names `id`, `hash`, and `words` specified by `DEFINE HEADER` because `USER_DEFINED_HEADER="head1"` is used. +In this example, the input file contains the column names `ProductID`, `ImageHash`, and `Description` from left to right. The loading job overrides these names with `id`, `hash`, and `words` specified by `DEFINE HEADER` because `USER_DEFINED_HEADER="head1"` is used. * `SPLIT` is one of GSQL's ETL functions. It says that there is a multi-valued column, which has a separator character to mark the subfields in that column.