Skip to content

Commit f16b5e1

Browse files
authored
Snowflake destination connector: update CREATE TABLE statement (#610)
1 parent 6091146 commit f16b5e1

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

snippets/general-shared-text/snowflake.mdx

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@
142142
SHOW SCHEMAS;
143143
```
144144

145-
The following Snowflake query returns a list of available schemas for the database named `<database-name>` in the current account:
145+
The following Snowflake query returns a list of available schemas for the database named `<database_name>` in the current account:
146146

147147
```text
148-
SHOW SCHEMAS IN DATABASE <database-name>;
148+
SHOW SCHEMAS IN DATABASE <database_name>;
149149
```
150150

151151
- The name of the [table](https://docs.snowflake.com/sql-reference/sql/create-table) in the schema.
@@ -159,35 +159,41 @@
159159
5. Expand **Tables**.
160160

161161
Alternatively, the following Snowflake query returns a list of available tables for the schema named `<schema_name>` in the datbase named
162-
`<database-name>` in the current account:
162+
`<database_name>` in the current account:
163163

164164
```text
165-
SHOW TABLES IN SCHEMA <database-name>.<schema_name>;
165+
SHOW TABLES IN SCHEMA <database_name>.<schema_name>;
166166
```
167167

168168
Snowflake requires the target table to have a defined schema before Unstructured can write to the table. The recommended table
169-
schema for Unstructured is as follows:
169+
schema for Unstructured is as follows. In the following `CREATE TABLE` statement, replace the following placeholders with the appropriate values:
170+
171+
- `<database_name>`: The name of the target database in the Snowflake account.
172+
- `<schema_name>`: The name of the target schema in the database.
173+
- `<number-of-dimensions>`: The number of dimensions for any embeddings that you plan to use. This value must match the number of dimensions for any embeddings that are
174+
specified in your related Unstructured workflows or pipelines. If you plan to use Snowflake vector embedding generation or Snowflake vector search,
175+
this value must match the number of dimensions that you plan to have Snowflake generate or search against.
170176

171177
```sql SQL
172-
CREATE TABLE ELEMENTS (
173-
ID VARCHAR(36) NOT NULL DEFAULT UUID_STRING(),
178+
CREATE TABLE <database_name>.<schema_name>.ELEMENTS (
179+
ID VARCHAR(36) PRIMARY KEY NOT NULL DEFAULT UUID_STRING(),
174180
RECORD_ID VARCHAR,
175181
ELEMENT_ID VARCHAR,
176-
TEXT VARCHAR,
177-
EMBEDDINGS ARRAY,
182+
TEXT TEXT,
183+
EMBEDDINGS VECTOR(FLOAT, <number-of-dimensions>),
178184
TYPE VARCHAR,
179185
SYSTEM VARCHAR,
180-
LAYOUT_WIDTH NUMBER,
181-
LAYOUT_HEIGHT NUMBER,
182-
POINTS VARCHAR,
183-
URL VARCHAR,
186+
LAYOUT_WIDTH DECIMAL,
187+
LAYOUT_HEIGHT DECIMAL,
188+
POINTS TEXT,
189+
URL TEXT,
184190
VERSION VARCHAR,
185191
DATE_CREATED TIMESTAMP_TZ,
186192
DATE_MODIFIED TIMESTAMP_TZ,
187193
DATE_PROCESSED TIMESTAMP_TZ,
188-
PERMISSIONS_DATA VARCHAR,
189-
RECORD_LOCATOR VARCHAR,
190-
CATEGORY_DEPTH NUMBER,
194+
PERMISSIONS_DATA TEXT,
195+
RECORD_LOCATOR TEXT,
196+
CATEGORY_DEPTH INTEGER,
191197
PARENT_ID VARCHAR,
192198
ATTACHED_FILENAME VARCHAR,
193199
FILETYPE VARCHAR,
@@ -196,7 +202,7 @@
196202
FILENAME VARCHAR,
197203
LANGUAGES ARRAY,
198204
PAGE_NUMBER VARCHAR,
199-
LINKS VARCHAR,
205+
LINKS TEXT,
200206
PAGE_NAME VARCHAR,
201207
LINK_URLS ARRAY,
202208
LINK_TEXTS ARRAY,
@@ -207,11 +213,13 @@
207213
HEADER_FOOTER_TYPE VARCHAR,
208214
EMPHASIZED_TEXT_CONTENTS ARRAY,
209215
EMPHASIZED_TEXT_TAGS ARRAY,
210-
TEXT_AS_HTML VARCHAR,
211-
REGEX_METADATA VARCHAR,
212-
DETECTION_CLASS_PROB NUMBER,
213-
PRIMARY KEY (ID),
214-
PARTITIONER_TYPE VARCHAR
216+
TEXT_AS_HTML TEXT,
217+
REGEX_METADATA TEXT,
218+
DETECTION_CLASS_PROB DECIMAL,
219+
IMAGE_BASE64 VARCHAR,
220+
IMAGE_MIME_TYPE VARCHAR,
221+
ORIG_ELEMENTS VARCHAR,
222+
IS_CONTINUATION BOOLEAN
215223
);
216224
```
217225

0 commit comments

Comments
 (0)