You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/savanna/modules/graph-development/pages/advanced-features/write2-s3.adoc
+32-17Lines changed: 32 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,26 +31,34 @@ There are three main methods to write data to S3 from TigerGraph Savanna:
31
31
32
32
Set your AWS credentials and query timeout in the GSQL Editor.
33
33
34
-
```sql
34
+
[source,gsql]
35
+
----
35
36
set query_timeout=7200000;
36
37
set s3_aws_access_key_id = <AWS_KEY_ID>;
37
38
set s3_aws_secret_access_key = <AWS_ACCESS_KEY>;
38
-
```
39
+
set s3_region = <REGION>;
40
+
----
41
+
42
+
[NOTE]
43
+
====
44
+
The `s3_region` parameter specifies the AWS region where your S3 bucket is located. If you don't set this parameter, it defaults to `us-east-1`. Set the correct region to successfully write data to your S3 bucket. For example, if your bucket is in `us-west-2`, set `s3_region = "us-west-2"`.
45
+
====
39
46
40
47
4) **Create and Run the Query**:
41
48
42
49
Create a query to write data to S3 and run it.
43
50
44
-
```sql
51
+
[source,gsql]
52
+
----
45
53
CREATE QUERY print_to_csv_s3() FOR GRAPH ldbc_snb {
46
54
FILE f_hello ("s3://<s3_path>/" + "f_hello.csv");
47
55
print "f_hello", "world\n" TO_CSV f_hello;
48
56
}
49
57
50
58
run query print_to_csv_s3();
51
-
```
59
+
----
52
60
53
-
Replace `<AWS_KEY_ID>`, `<AWS_ACCESS_KEY>`, and `<s3_path>` with your actual AWS credentials and S3 path.
61
+
Replace `<AWS_KEY_ID>`, `<AWS_ACCESS_KEY>`, and `<s3_path>` with your actual AWS credentials, S3 region, and S3 path.
54
62
55
63
=== Method 2: Via API
56
64
@@ -60,15 +68,17 @@ Replace `<AWS_KEY_ID>`, `<AWS_ACCESS_KEY>`, and `<s3_path>` with your actual AWS
60
68
61
69
Use the following curl command to run the query via API.
Replace `$AWS_KEY_ID` and `$AWS_ACCESS_KEY` with your actual AWS credentials, `$HOST_ID` with your TigerGraph Savanna host ID, `$GRAPH_NAME` with your graph name, and `$QUERY_NAME` with your query name.
81
+
Replace `$AWS_KEY_ID` and `$AWS_ACCESS_KEY` with your actual AWS credentials, `$S3_REGION` with your S3 bucket region (for example, `us-west-2`), `$HOST_ID` with your TigerGraph Savanna host ID, `$GRAPH_NAME` with your graph name, and `$QUERY_NAME` with your query name.
72
82
73
83
=== Method 3: Using Graph Admin
74
84
@@ -94,33 +104,38 @@ It is recommended to always set up a default s3 access key ID and secret access
94
104
95
105
[NOTE]
96
106
====
97
-
Update Graph Admin configurations may require restart of certain services, which may impact the running queries/loading jobs/schema changes. Apply changes with caution.
107
+
Update Graph Admin configurations may require restart of certain services, which may impact the running queries, loading jobs, or schema changes. Apply changes with caution.
108
+
109
+
The Graph Admin method does not support setting the `s3_region` parameter. To specify a region other than the default `us-east-1`, use Method 1 (GSQL Editor) or Method 2 (API).
98
110
====
99
111
100
112
101
113
=== Example
102
114
103
-
Here’s an example of writing data to S3 using the GSQL Editor:
104
-
105
-
```sql
115
+
Here’s a complete example of writing data to S3 using the GSQL Editor with all required parameters:
106
116
117
+
[source,gsql]
118
+
----
107
119
set query_timeout=7200000;
108
120
set s3_aws_access_key_id = "your_aws_access_key_id";
109
121
set s3_aws_secret_access_key = "your_aws_secret_access_key";
122
+
set s3_region = "us-east-1";
110
123
111
124
CREATE QUERY print_to_csv_s3() FOR GRAPH ldbc_snb {
Replace `us-east-1` with the actual region of your S3 bucket.
119
133
120
134
== Troubleshooting
121
135
122
-
- **Permission Issues**: Ensure that the IAM role or user has the necessary permissions (`s3:PutObject`, `s3:ListBucket`).
123
-
- **Network Issues**: Verify that your TigerGraph workspace can reach the S3 endpoint.
124
-
- **Credential Issues**: Ensure that the correct credentials are provided either via GSQL Editor, API headers, or Graph Admin configurations.
136
+
* *Permission Issues*: Ensure that the IAM role or user has the necessary permissions (`s3:PutObject`, `s3:ListBucket`).
137
+
* *Network Issues*: Verify that your TigerGraph workspace can reach the S3 endpoint.
138
+
* *Credential Issues*: Ensure that the correct credentials are provided either via GSQL Editor, API headers, or Graph Admin configurations.
139
+
* *Region Mismatch*: If you receive errors when writing to S3, verify that the `s3_region` parameter matches the actual region of your S3 bucket. Using the wrong region will cause the write operation to fail.
125
140
126
-
For more detailed troubleshooting, refer to the [AWS S3 Documentation](https://docs.aws.amazon.com/s3/index.html).
141
+
For more detailed troubleshooting, refer to the [AWS S3 Documentation](https://docs.aws.amazon.com/s3/index.html).
0 commit comments