Skip to content

Commit b34af08

Browse files
authored
Merge pull request #282 from stackql/feature/provider-docs
updated snowflake
2 parents c76e681 + 2610f23 commit b34af08

File tree

1 file changed

+135
-26
lines changed
  • docs/snowflake-docs/providers/snowflake/sqlapi/statements

1 file changed

+135
-26
lines changed

docs/snowflake-docs/providers/snowflake/sqlapi/statements/index.md

Lines changed: 135 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,15 @@ Creates, updates, deletes, gets or lists a <code>statements</code> resource.
4444
| Name | Accessible by | Required Params | Description |
4545
|:-----|:--------------|:----------------|:------------|
4646
| <CopyableCode code="get_statement_status" /> | `SELECT` | <CopyableCode code="User-Agent, statementHandle, endpoint" /> | Checks the status of the execution of the statement with the specified statement handle. If the statement was executed successfully, the operation returns the requested partition of the result set. |
47-
| <CopyableCode code="submit_statement" /> | `SELECT` | <CopyableCode code="User-Agent, endpoint" /> | Submits one or more statements for execution. You can specify that the statement should be executed asynchronously. |
48-
| <CopyableCode code="cancel_statement" /> | `EXEC` | <CopyableCode code="User-Agent, statementHandle, endpoint" /> | Cancels the execution of the statement with the specified statement handle. |
47+
| <CopyableCode code="submit_statement" /> | `INSERT` | <CopyableCode code="User-Agent, endpoint" /> | Submits one or more statements for execution. You can specify that the statement should be executed asynchronously. |
48+
| <CopyableCode code="cancel_statement" /> | `DELETE` | <CopyableCode code="User-Agent, statementHandle, endpoint" /> | Cancels the execution of the statement with the specified statement handle. |
4949

5050
<br />
5151

5252
## `SELECT` examples
5353

54-
<Tabs
55-
defaultValue="submit_statement"
56-
values={[
57-
{ label: 'submit_statement', value: 'submit_statement' },
58-
{ label: 'get_statement_status', value: 'get_statement_status' }
59-
]
60-
}>
61-
<TabItem value="submit_statement">
54+
Checks the status of the execution of the statement with the specified statement handle. If the statement was executed successfully, the operation returns the requested partition of the result set.
6255

63-
Submits one or more statements for execution. You can specify that the statement should be executed asynchronously.
6456

6557
```sql
6658
SELECT
@@ -75,28 +67,145 @@ statementStatusUrl,
7567
stats
7668
FROM snowflake.sqlapi.statements
7769
WHERE User-Agent = '{{ User-Agent }}'
70+
AND statementHandle = '{{ statementHandle }}'
7871
AND endpoint = '{{ endpoint }}';
7972
```
73+
## `INSERT` example
74+
75+
Use the following StackQL query and manifest file to create a new <code>statements</code> resource.
76+
77+
<Tabs
78+
defaultValue="all"
79+
values={[
80+
{ label: 'Required Properties', value: 'required' },
81+
{ label: 'All Properties', value: 'all', },
82+
{ label: 'Manifest', value: 'manifest', },
83+
]
84+
}>
85+
<TabItem value="all">
86+
87+
```sql
88+
/*+ create */
89+
INSERT INTO snowflake.sqlapi.statements (
90+
data__statement,
91+
data__timeout,
92+
data__database,
93+
data__schema,
94+
data__warehouse,
95+
data__role,
96+
data__bindings,
97+
data__parameters,
98+
User-Agent,
99+
endpoint
100+
)
101+
SELECT
102+
'{{ statement }}',
103+
{{ timeout }},
104+
'{{ database }}',
105+
'{{ schema }}',
106+
'{{ warehouse }}',
107+
'{{ role }}',
108+
'{{ bindings }}',
109+
'{{ parameters }}',
110+
'{{ User-Agent }}',
111+
'{{ endpoint }}'
112+
;
113+
```
80114
</TabItem>
81-
<TabItem value="get_statement_status">
82115

83-
Checks the status of the execution of the statement with the specified statement handle. If the statement was executed successfully, the operation returns the requested partition of the result set.
116+
<TabItem value="required">
84117

85118
```sql
86-
SELECT
87-
code,
88-
createdOn,
89-
data,
90-
message,
91-
resultSetMetaData,
92-
sqlState,
93-
statementHandle,
94-
statementStatusUrl,
95-
stats
96-
FROM snowflake.sqlapi.statements
119+
/*+ create */
120+
INSERT INTO snowflake.sqlapi.statements (
121+
User-Agent,
122+
endpoint
123+
)
124+
SELECT
125+
'{{ User-Agent }}',
126+
'{{ endpoint }}'
127+
;
128+
```
129+
</TabItem>
130+
131+
<TabItem value="manifest">
132+
133+
```yaml
134+
# Description fields below are for documentation purposes only and are not required in the manifest
135+
- name: statements
136+
props:
137+
- name: User-Agent
138+
value: string
139+
description: Required parameter for the statements resource.
140+
- name: endpoint
141+
value: string
142+
description: Required parameter for the statements resource.
143+
- name: statement
144+
value: string
145+
description: >-
146+
SQL statement or batch of SQL statements to execute. You can specify
147+
query, DML and DDL statements. The following statements are not
148+
supported: PUT, GET, USE, ALTER SESSION, BEGIN, COMMIT, ROLLBACK,
149+
statements that set session variables, and statements that create
150+
temporary tables and stages.
151+
- name: timeout
152+
value: integer
153+
description: >-
154+
Timeout in seconds for statement execution. If the execution of a
155+
statement takes longer than the specified timeout, the execution is
156+
automatically canceled. To set the timeout to the maximum value (604800
157+
seconds), set timeout to 0.
158+
- name: database
159+
value: string
160+
description: >-
161+
Database in which the statement should be executed. The value in this
162+
field is case-sensitive.
163+
- name: schema
164+
value: string
165+
description: >-
166+
Schema in which the statement should be executed. The value in this
167+
field is case-sensitive.
168+
- name: warehouse
169+
value: string
170+
description: >-
171+
Warehouse to use when executing the statement. The value in this field
172+
is case-sensitive.
173+
- name: role
174+
value: string
175+
description: >-
176+
Role to use when executing the statement. The value in this field is
177+
case-sensitive.
178+
- name: bindings
179+
value: {}
180+
description: >-
181+
Values of bind variables in the SQL statement. When executing the
182+
statement, Snowflake replaces placeholders ('?' and ':name') in the
183+
statement with these specified values.
184+
- name: parameters
185+
value:
186+
timezone: string
187+
query_tag: string
188+
binary_output_format: string
189+
date_output_format: string
190+
time_output_format: string
191+
timestamp_output_format: string
192+
timestamp_ltz_output_format: string
193+
timestamp_ntz_output_format: string
194+
timestamp_tz_output_format: string
195+
multi_statement_count: integer
196+
description: Session parameters that should be set before executing the statement.
197+
```
198+
</TabItem>
199+
</Tabs>
200+
201+
## `DELETE` example
202+
203+
Deletes the specified <code>statements</code> resource.
204+
205+
```sql
206+
/*+ delete */
207+
DELETE FROM snowflake.sqlapi.statements
97208
WHERE User-Agent = '{{ User-Agent }}'
98209
AND statementHandle = '{{ statementHandle }}'
99210
AND endpoint = '{{ endpoint }}';
100211
```
101-
</TabItem>
102-
</Tabs>

0 commit comments

Comments
 (0)