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
-`CONNECTION` specifies the connection parameters required for establishing a link to the object storage where the source table's data is stored. The connection parameters vary for different storage services based on their specific requirements and authentication mechanisms. For more information, see [Connection Parameters](../../../00-sql-reference/51-connect-parameters.md).
57
57
58
-
## Examples
58
+
## Tutorials
59
59
60
-
This example illustrates how to link a new table in Databend Cloud with an existing table in Databend, which stores data within an Amazon S3 bucket named "databend-toronto".
60
+
-[Linking Tables with ATTACH TABLE](/tutorials/databend-cloud/link-tables)
61
61
62
-
#### Step 1. Creating Table in Databend
62
+
##Examples
63
63
64
-
Create a table named "population" and insert some sample data:
64
+
This example creates an attached table, which includes all columns from a source table stored in AWS S3:
Use the [FUSE_SNAPSHOT](../../../20-sql-functions/16-system-functions/fuse_snapshot.md) function to obtain the database ID and table ID. The result below indicates that the database ID is **1**, and the table ID is **556**:
To verify the success of the link, run the following query in Databend Cloud:
108
-
109
-
```sql title='Databend Cloud:'
110
-
SELECT*FROM population_readonly;
111
-
112
-
-- Expected result:
113
-
┌────────────────────────────────────┐
114
-
│ city │ population │
115
-
├──────────────────┼─────────────────┤
116
-
│ Toronto │ 2731571 │
117
-
│ Montreal │ 1704694 │
118
-
│ Vancouver │ 631486 │
119
-
└────────────────────────────────────┘
120
-
```
121
-
122
-
You're all set! If you update the source table in Databend, you can observe the same changes reflected in the target table on Databend Cloud. For example, if you change the population of Toronto to 2,371,571 in the source table:
123
-
124
-
```sql title='Databend:'
125
-
UPDATE population
126
-
SET population =2371571
127
-
WHERE city ='Toronto';
128
-
```
129
-
130
-
You can see that the updates are synced to the attached table in Databend Cloud:
Copy file name to clipboardExpand all lines: docs/en/tutorials/databend-cloud/link-tables.md
+58-7Lines changed: 58 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Linking Tables with ATTACH TABLE
3
3
---
4
4
5
-
In this tutorial, we'll walk you through how to link a table in Databend Cloud with an existing Databend table stored in an S3 bucket using the ATTACH TABLE command.
5
+
In this tutorial, we'll walk you through how to link a table in Databend Cloud with an existing Databend table stored in an S3 bucket using the [ATTACH TABLE](/sql/sql-commands/ddl/table/attach-table) command.
0 commit comments